middleware

package
v4.4.4 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2021 License: MIT Imports: 22 Imported by: 0

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 added in v4.0.6

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 added in v4.0.6

func NewConnManager(log restql.Logger, enabled bool, watchInterval time.Duration) *ConnManager

NewConnManager creates a connection manager

func (*ConnManager) ContextForConnection added in v4.0.6

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 added in v4.0.6

type Decorator struct {
	// contains filtered or unexported fields
}

Decorator is a type responsible for wrapping handlers with default and config enabled middlewares.

func NewDecorator added in v4.0.6

func NewDecorator(log restql.Logger, cfg *conf.Config, pm plugins.Lifecycle) *Decorator

NewDecorator creates a middleware Decorator

func (*Decorator) Apply added in v4.0.6

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.

Jump to

Keyboard shortcuts

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