Documentation ¶
Index ¶
- Constants
- Variables
- func EndTrip(ctx context.Context, logger logging.Logger, statter stats.Statter) func(http.ResponseWriter, *http.Request)
- func Erroring(_ context.Context, w http.ResponseWriter, err error, logger logging.Logger)
- func GatewayEndTrip(ctx context.Context, conf configuration.GatewayConfiguration, ...) func(http.ResponseWriter, *http.Request)
- func GatewayGetBikeByID(ctx context.Context, conf configuration.GatewayConfiguration, ...) func(http.ResponseWriter, *http.Request)
- func GatewayListOfBikes(ctx context.Context, conf configuration.GatewayConfiguration, ...) func(http.ResponseWriter, *http.Request)
- func GatewayStartTrip(ctx context.Context, conf configuration.GatewayConfiguration, ...) func(http.ResponseWriter, *http.Request)
- func GetBikeByID(ctx context.Context, conf configuration.BikeConfiguration, ...) func(http.ResponseWriter, *http.Request)
- func GetPaginationArguments(req *http.Request) (string, int64)
- func ListOfBikes(ctx context.Context, conf configuration.BikeConfiguration, ...) func(http.ResponseWriter, *http.Request)
- func LockBikeByID(ctx context.Context, conf configuration.BikeConfiguration, ...) func(http.ResponseWriter, *http.Request)
- func NewBikeService(ctx context.Context, m Metadata, conf configuration.BikeConfiguration, ...) (*http.Server, error)
- func NewGatewayService(ctx context.Context, m Metadata, conf configuration.GatewayConfiguration, ...) (*http.Server, error)
- func NewServer(ctx context.Context, conf configuration.Server, router http.Handler) (*http.Server, error)
- func NewTripService(ctx context.Context, m Metadata, conf configuration.TripConfiguration, ...) (*http.Server, error)
- func StartTrip(ctx context.Context, logger logging.Logger, statter stats.Statter) func(http.ResponseWriter, *http.Request)
- func TrackTrip(ctx context.Context, conf configuration.GatewayConfiguration, ...) func(http.ResponseWriter, *http.Request)
- func UnLockBikeByID(ctx context.Context, conf configuration.BikeConfiguration, ...) func(http.ResponseWriter, *http.Request)
- type Metadata
Constants ¶
const ( HSTS = "max-age=63072000; preload" HSTSKey = "Strict-Transport-Security" XFrameDeny = "DENY" XFrameKey = "X-Frame-Options" NoSniff = "nosniff" XContent = "X-Content-Type-Options" JSONContentType = "application/json" XContentTypeKey = "Content-Type" )
HTTP Header for security.
Variables ¶
var ( TLSConfiguration = &tls.Config{ MinVersion: tls.VersionTLS12, CurvePreferences: []tls.CurveID{tls.CurveP521, tls.CurveP384, tls.CurveP256}, PreferServerCipherSuites: true, CipherSuites: []uint16{ tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, tls.TLS_RSA_WITH_AES_256_GCM_SHA384, tls.TLS_RSA_WITH_AES_256_CBC_SHA, }, } TLSNextProto = make(map[string]func(*http.Server, *tls.Conn, http.Handler)) )
TLS configuration for https server. like accepted ciphers
Functions ¶
func EndTrip ¶
func EndTrip( ctx context.Context, logger logging.Logger, statter stats.Statter) func(http.ResponseWriter, *http.Request)
EndTrip is the handler for starting a trip.
func GatewayEndTrip ¶
func GatewayEndTrip( ctx context.Context, conf configuration.GatewayConfiguration, logger logging.Logger, statter stats.Statter) func(http.ResponseWriter, *http.Request)
GatewayEndTrip is the handler for starting a trip.
func GatewayGetBikeByID ¶
func GatewayGetBikeByID(ctx context.Context, conf configuration.GatewayConfiguration, logger logging.Logger, statter stats.Statter) func(http.ResponseWriter, *http.Request)
GatewayGetBikeByID returns a bike given an ID.
func GatewayListOfBikes ¶
func GatewayListOfBikes(ctx context.Context, conf configuration.GatewayConfiguration, logger logging.Logger, statter stats.Statter, ) func(http.ResponseWriter, *http.Request)
GatewayListOfBikes returns a paginated list of bikes.
func GatewayStartTrip ¶
func GatewayStartTrip( ctx context.Context, conf configuration.GatewayConfiguration, logger logging.Logger, statter stats.Statter) func(http.ResponseWriter, *http.Request)
GatewayStartTrip is the handler for starting a trip.
func GetBikeByID ¶
func GetBikeByID(ctx context.Context, conf configuration.BikeConfiguration, logger logging.Logger, statter stats.Statter) func(http.ResponseWriter, *http.Request)
GetBikeByID returns a bike given an ID.
func GetPaginationArguments ¶
GetPaginationArguments extract limit and cursor from request.
func ListOfBikes ¶
func ListOfBikes(ctx context.Context, conf configuration.BikeConfiguration, logger logging.Logger, statter stats.Statter, ) func(http.ResponseWriter, *http.Request)
ListOfBikes returns a paginated list of bikes.
func LockBikeByID ¶
func LockBikeByID(ctx context.Context, conf configuration.BikeConfiguration, logger logging.Logger, statter stats.Statter) func(http.ResponseWriter, *http.Request)
LockBikeByID lock a bike given an ID.
func NewBikeService ¶
func NewBikeService( ctx context.Context, m Metadata, conf configuration.BikeConfiguration, logger logging.Logger, statter stats.Statter) (*http.Server, error)
NewBikeService returns the bike service wrapped in a valid http.Server.
func NewGatewayService ¶
func NewGatewayService( ctx context.Context, m Metadata, conf configuration.GatewayConfiguration, logger logging.Logger, statter stats.Statter, messenger messaging.Emitter) (*http.Server, error)
NewGatewayService returns the gateway service wrapped in a valid http.Server.
func NewServer ¶
func NewServer(ctx context.Context, conf configuration.Server, router http.Handler) (*http.Server, error)
NewServer sets up HTTP the server.
func NewTripService ¶
func NewTripService( ctx context.Context, m Metadata, conf configuration.TripConfiguration, logger logging.Logger, statter stats.Statter) (*http.Server, error)
NewTripService returns the trip service wrapped in a valid http.Server.
func StartTrip ¶
func StartTrip( ctx context.Context, logger logging.Logger, statter stats.Statter) func(http.ResponseWriter, *http.Request)
StartTrip is the handler for starting a trip.
func TrackTrip ¶
func TrackTrip(ctx context.Context, conf configuration.GatewayConfiguration, logger logging.Logger, statter stats.Statter, messenger messaging.Emitter) func(http.ResponseWriter, *http.Request)
TrackTrip is the middleware for tracking a trip. By tracking, we mean here, adding a location to a trip.
func UnLockBikeByID ¶
func UnLockBikeByID(ctx context.Context, conf configuration.BikeConfiguration, logger logging.Logger, statter stats.Statter) func(http.ResponseWriter, *http.Request)
UnLockBikeByID lock a bike given an ID.