Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ServerContextKey = serverContextKey{}
ServerContextKey is the context key that store *parapet.Server
Functions ¶
This section is empty.
Types ¶
type Middleware ¶
Middleware is the http middleware
type MiddlewareFunc ¶
MiddlewareFunc is the adapter type for Middleware
func (MiddlewareFunc) ServeHandler ¶
func (f MiddlewareFunc) ServeHandler(h http.Handler) http.Handler
ServeHandler calls f
type Middlewares ¶
type Middlewares []Middleware
Middlewares type
func (Middlewares) ServeHandler ¶
func (ms Middlewares) ServeHandler(h http.Handler) http.Handler
ServeHandler implements middleware interface
type Server ¶
type Server struct { Addr string Handler http.Handler ReadTimeout time.Duration ReadHeaderTimeout time.Duration WriteTimeout time.Duration IdleTimeout time.Duration TCPKeepAlivePeriod time.Duration GraceTimeout time.Duration WaitBeforeShutdown time.Duration ErrorLog *log.Logger TrackConnState bool TrustProxy bool H2C bool ReusePort bool // contains filtered or unexported fields }
Server is the parapet server
func New ¶
func New() *Server
New creates new middleware server default config
This server should not expose to the internet but run behide reverse proxy
func NewBackend ¶
func NewBackend() *Server
NewBackend creates new backend server default config
This server use to run behide parapet server or run behide other reverse proxy
func NewFrontend ¶
func NewFrontend() *Server
NewFrontend creates new frontend server default config
func (*Server) ListenAndServe ¶
ListenAndServe starts web server
func (*Server) RegisterOnShutdown ¶ added in v0.1.2
func (s *Server) RegisterOnShutdown(f func())
RegisterOnShutdown calls f when server received SIGTERM