Documentation
¶
Index ¶
- type AllInOneRouter
- type Server
- func (s *Server) GetHandler() http.Handler
- func (s *Server) HTTPListener() (net.Listener, error)
- func (s *Server) HTTPSURL() string
- func (s *Server) HTTPURL() string
- func (s *Server) Listen() error
- func (s *Server) Serve() (err error)
- func (s *Server) SetHandler(handler http.Handler)
- func (s *Server) Shutdown() error
- func (s *Server) TLSListener() (net.Listener, error)
- func (s *Server) Wait()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AllInOneRouter ¶
type AllInOneRouter struct {
EventsHandler http.Handler
FunctionsHandler http.Handler
SecretsHandler http.Handler
ImagesHandler http.Handler
IdentityHandler http.Handler
ServicesHandler http.Handler
APIHandler http.Handler
}
AllInOneRouter implements a simple HTTP handler that routes requests to proper sub-service handlers When executing dispatch in a single binary mode.
func (*AllInOneRouter) ServeHTTP ¶
func (d *AllInOneRouter) ServeHTTP(rw http.ResponseWriter, r *http.Request)
ServeHTTP implements the http.Handler interface
type Server ¶
type Server struct {
// Logger configures the logger to use.
Logger log.FieldLogger
// EnabledListeners set the listeners to enable.
EnabledListeners []string
// CleanupTimeout is a grace period for which to wait before shutting down the server.
CleanupTimeout time.Duration
// MaxHeaderSize controls the maximum number of bytes the server will read parsing the request header's keys and values,
// including the request line. It does not limit the size of the request body.
MaxHeaderSize int
// Host (or IP) to listen on.
Host string
// Port to listen on for plain HTTP connections.
Port int
// ListenLimit sets the maximum number of outstanding requests.
ListenLimit int
// KeepAlive sets the TCP keep-alive timeouts on accepted plain HTTP connections. It prunes dead TCP connections.
KeepAlive time.Duration
// ReadTimeout sets maximum duration before timing out read of the request for plain HTTP connections.
ReadTimeout time.Duration
// WriteTimeout sets the maximum duration before timing out write of the response for plain HTTP connections.
WriteTimeout time.Duration
// TLSPort sets the port to listen on for HTTPS connections.
TLSPort int
// TLSCertificate sets the certificate file path to use for HTTPS connections.
TLSCertificate string
// TLSCertificateKey sets the private key file path to use for HTTPS connections.
TLSCertificateKey string
// TLSCACertificate sets the certificate authority file path to be used for HTTPS connections. Use only when verifying client certificate.
TLSCACertificate string
// TLSListenLimit set the maximum number of outstanding requests for HTTPS connections.
TLSListenLimit int
// TLSKeepAlive sets the TCP keep-alive timeouts on accepted HTTPS connections. It prunes dead TCP connections.
TLSKeepAlive time.Duration
// TLSReadTimeout sets maximum duration before timing out read of the request for HTTPS connections.
TLSReadTimeout time.Duration
// TLSWriteTimeout sets the maximum duration before timing out write of the response for HTTPS connections.
TLSWriteTimeout time.Duration
// contains filtered or unexported fields
}
Server provides an HTTP server with reasonable defaults, ability to handle both http and https, and proper shutdown.
func (*Server) GetHandler ¶
GetHandler returns a handler useful for testing
func (*Server) HTTPListener ¶
HTTPListener returns the http listener
func (*Server) SetHandler ¶
SetHandler allows for setting a http handler on this server
func (*Server) TLSListener ¶
TLSListener returns the https listener
Click to show internal directories.
Click to hide internal directories.