Documentation ¶
Index ¶
- func GetLogger(ctx context.Context, middleware, middlewareType string) *zerolog.Logger
- func GetSourceExtractor(ctx context.Context, sourceMatcher *dynamic.SourceCriterion) (utils.SourceExtractor, error)
- func NewResponseModifier(w http.ResponseWriter, r *http.Request, modifier func(*http.Response) error) http.ResponseWriter
- type HTTPHandlerSwitcher
- type ResponseModifier
- type Stateful
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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.
func NewResponseModifier ¶
func NewResponseModifier(w http.ResponseWriter, r *http.Request, modifier func(*http.Response) error) http.ResponseWriter
NewResponseModifier returns a new ResponseModifier instance. The given modifier can be nil.
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 ResponseModifier ¶
type ResponseModifier struct {
// contains filtered or unexported fields
}
ResponseModifier is a ResponseWriter to modify the response headers before sending them.
func (*ResponseModifier) Flush ¶
func (r *ResponseModifier) Flush()
Flush sends any buffered data to the client.
func (*ResponseModifier) Header ¶
func (r *ResponseModifier) Header() http.Header
func (*ResponseModifier) Hijack ¶
func (r *ResponseModifier) Hijack() (net.Conn, *bufio.ReadWriter, error)
Hijack hijacks the connection.
func (*ResponseModifier) WriteHeader ¶
func (r *ResponseModifier) WriteHeader(code int)
WriteHeader is, in the specific case of 1xx status codes, a direct call to the wrapped ResponseWriter, without marking headers as sent, allowing so further calls.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package capture is a middleware that captures requests/responses size, and status.
|
Package capture is a middleware that captures requests/responses size, and status. |
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. |
tcp
|
|