Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetLoggerCtx ¶
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 ¶
type Stateful interface { http.ResponseWriter http.Hijacker http.Flusher http.CloseNotifier }
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. |
Click to show internal directories.
Click to hide internal directories.