http

package
v0.1.20 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 4, 2018 License: Apache-2.0 Imports: 18 Imported by: 4

Documentation

Index

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 NewServer

func NewServer(handler http.Handler) *Server

NewServer creates a HTTP server with given handler as a default handler

func (*Server) GetHandler

func (s *Server) GetHandler() http.Handler

GetHandler returns a handler useful for testing

func (*Server) HTTPListener

func (s *Server) HTTPListener() (net.Listener, error)

HTTPListener returns the http listener

func (*Server) HTTPSURL

func (s *Server) HTTPSURL() string

HTTPSURL returns https url server is available at

func (*Server) HTTPURL

func (s *Server) HTTPURL() string

HTTPURL returns the http url server is available at

func (*Server) Listen

func (s *Server) Listen() error

Listen creates the listeners for the server

func (*Server) Serve

func (s *Server) Serve() (err error)

Serve the api

func (*Server) SetHandler

func (s *Server) SetHandler(handler http.Handler)

SetHandler allows for setting a http handler on this server

func (*Server) Shutdown

func (s *Server) Shutdown() error

Shutdown server and clean up resources

func (*Server) TLSListener

func (s *Server) TLSListener() (net.Listener, error)

TLSListener returns the https listener

func (*Server) Wait

func (s *Server) Wait()

Wait waits until server is initialized

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL