Documentation ¶
Overview ¶
Package gateway provides an API gateway that routes incoming requests to different handlers based on the host.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Gateway ¶
type Gateway struct { Responder response.HttpResponder AccessLog logging.AccessLogger // contains filtered or unexported fields }
Gateway represents an API gateway that routes incoming requests to different handlers based on the host.
func NewFromServiceContext ¶
NewFromServiceContext creates a new instance of the API gateway using the provided service context.
func (*Gateway) HandleHost ¶
HandleHost associates the given host with the provided handler.
func (*Gateway) HasExactHost ¶
HasExactHost checks if the gateway has an exact match for the given host.
func (*Gateway) HasHost ¶
HasHost checks if the gateway has a handler associated with the given host.
func (*Gateway) ListenAndServe ¶
ListenAndServe starts the HTTP server and listens for incoming requests on the specified address.
func (*Gateway) ListenAndServeTLS ¶
ListenAndServeTLS starts the HTTPS server and listens for incoming requests on the specified address.
type HandlerFactory ¶
type HandlerFactory struct { Transport http.RoundTripper RequestHeader http.Header ModifyResponse func(*http.Response) error Services services.Context }
HandlerFactory creates HTTP handlers preconfigured using the service context and other configuration options.
func NewHandlerFactory ¶
func NewHandlerFactory(sc services.Context) *HandlerFactory
NewHandlerFactory creates a new instance of HandlerFactory with the given service context.
func (*HandlerFactory) MakeReverseProxy ¶
func (f *HandlerFactory) MakeReverseProxy(remote string) (*reverseproxy.ReverseProxyMux, error)
MakeReverseProxy creates a preconfigured reverseproxy.ReverseProxyMux instance for the given remote host.
func (*HandlerFactory) MakeRouter ¶
func (f *HandlerFactory) MakeRouter() *httprouter.Router
MakeRouter creates a preconfigured httprouter.Router instance.