Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetNativeContext ¶
func GetNativeContext(ctx *fasthttp.RequestCtx) context.Context
GetNativeContext retrieve a standard library context from FastHTTP request context.
func WithNativeContext ¶
func WithNativeContext(ctx *fasthttp.RequestCtx, nativeCtx context.Context)
WithNativeContext stores a standard library context into FastHTTP request context.
Types ¶
type ConnManager ¶
type ConnManager struct {
// contains filtered or unexported fields
}
ConnManager keeps track of active TCP connections and their corresponding contexts.
When a connection is closed by the client it cancel its context.
func NewConnManager ¶
NewConnManager creates a connection manager
func (*ConnManager) ContextForConnection ¶
func (cm *ConnManager) ContextForConnection(conn net.Conn) context.Context
ContextForConnection get the connections context, if it exists. Otherwise it create a context and start the connection watcher.
type Decorator ¶
type Decorator struct {
// contains filtered or unexported fields
}
Decorator is a type responsible for wrapping handlers with default and config enabled middlewares.
func NewDecorator ¶
NewDecorator creates a middleware Decorator
func (*Decorator) Apply ¶
func (d *Decorator) Apply(h fasthttp.RequestHandler) fasthttp.RequestHandler
Apply takes a base handler and fetches all middlewares enabled in configuration decorating the argument with each one.
type Middleware ¶
type Middleware interface {
Apply(h fasthttp.RequestHandler) fasthttp.RequestHandler
}
Middleware defines a generic handler wrapper capable of controlling request flow.