Versions in this module Expand all Collapse all v1 v1.0.1 May 12, 2022 Changes in this version + var ErrInternalServerHTTPError = &JSONError + var ErrInvalidCoordinatesFmt = errors.New("invalid coordinates format") + func RoutesHandler(router Router) http.HandlerFunc + type Coordinates struct + Latitude float64 + Longitude float64 + func CoordinatesFromString(s string) (*Coordinates, error) + func (d Coordinates) String() string + type JSONError struct + Message string + Status int + Wrapped error + func (e *JSONError) Error() string + func (e *JSONError) Is(target error) bool + func (e *JSONError) ServeHTTP(w http.ResponseWriter, r *http.Request) + func (e *JSONError) Unwrap() error + type OSRMClient struct + Client *http.Client + ServiceURL string + func (c *OSRMClient) Routes(ctx context.Context, req RoutesRequest) (*OSRMRouteResponse, error) + type OSRMRoute struct + Distance float64 + Duration float64 + type OSRMRouteResponse struct + Code string + Routes []OSRMRoute + type Route struct + Destination Coordinates + Distance float64 + Duration float64 + type Router interface + Routes func(ctx context.Context, src Coordinates, dst ...Coordinates) ([]Route, error) + type RoutesRequest struct + Destination Coordinates + Source Coordinates + type RoutesSorter struct + Wrapped Router + func (rs *RoutesSorter) Routes(ctx context.Context, src Coordinates, dst ...Coordinates) ([]Route, error) + type Server struct + func NewServer(router Router) *Server + func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) + type Service struct + Client *OSRMClient + func (s *Service) Routes(ctx context.Context, src Coordinates, dst ...Coordinates) ([]Route, error) v1.0.0 May 12, 2022