middlewares

package
v2.2.10 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLoggerCtx

func GetLoggerCtx(ctx context.Context, middleware, middlewareType string) context.Context

GetLoggerCtx creates a logger context with the middleware fields.

func GetSourceExtractor

func GetSourceExtractor(ctx context.Context, sourceMatcher *dynamic.SourceCriterion) (utils.SourceExtractor, error)

GetSourceExtractor returns the SourceExtractor function corresponding to the given sourceMatcher. It defaults to a RemoteAddrStrategy IPStrategy if need be. It returns an error if more than one source criterion is provided.

Types

type HTTPHandlerSwitcher

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

HTTPHandlerSwitcher allows hot switching of http.ServeMux.

func NewHandlerSwitcher

func NewHandlerSwitcher(newHandler http.Handler) (hs *HTTPHandlerSwitcher)

NewHandlerSwitcher builds a new instance of HTTPHandlerSwitcher.

func (*HTTPHandlerSwitcher) GetHandler

func (h *HTTPHandlerSwitcher) GetHandler() (newHandler http.Handler)

GetHandler returns the current http.ServeMux.

func (*HTTPHandlerSwitcher) ServeHTTP

func (h *HTTPHandlerSwitcher) ServeHTTP(rw http.ResponseWriter, req *http.Request)

func (*HTTPHandlerSwitcher) UpdateHandler

func (h *HTTPHandlerSwitcher) UpdateHandler(newHandler http.Handler)

UpdateHandler safely updates the current http.ServeMux with a new one.

type Stateful

Stateful interface groups all http interfaces that must be implemented by a stateful middleware (ie: recorders).

Directories

Path Synopsis
Package headers Middleware based on https://github.com/unrolled/secure.
Package headers Middleware based on https://github.com/unrolled/secure.
Package ratelimiter implements a rate limiting and traffic shaping middleware with a set of token buckets.
Package ratelimiter implements a rate limiting and traffic shaping middleware with a set of token buckets.

Jump to

Keyboard shortcuts

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