Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DoNothingRequestMiddleware ¶
type DoNothingRequestMiddleware struct{}
DoNothingRequestMiddleware an NO-OP implemenation of the RequestMiddleware interface
func NewDoNothingRequestMiddleware ¶
func NewDoNothingRequestMiddleware() *DoNothingRequestMiddleware
NewDoNothingRequestMiddleware returns an DoNothingRequestMiddleware
func (*DoNothingRequestMiddleware) Do ¶
func (a *DoNothingRequestMiddleware) Do(rw http.ResponseWriter, req *http.Request)
Do does nothing to the given request
func (*DoNothingRequestMiddleware) Wrap ¶
func (a *DoNothingRequestMiddleware) Wrap(fn http.HandlerFunc) RequestMiddleware
Wrap adds functionality to a middleware
type MiddlewareNodeFn ¶
type MiddlewareNodeFn func( rw http.ResponseWriter, req *http.Request, next http.HandlerFunc, )
MiddlewareNodeFn represents the functionality of a single middleware in the chain. Each of these functions is responsible for invoking the next() middleware in the chain and handling the error.
type RequestMiddleware ¶
type RequestMiddleware interface { Do(http.ResponseWriter, *http.Request) Wrap(http.HandlerFunc) RequestMiddleware }
RequestMiddleware represents the request-processing middleware functionality of a multiple-host proxy
type RequestMiddlewareChain ¶
type RequestMiddlewareChain struct {
// contains filtered or unexported fields
}
RequestMiddlewareChain represents a linked-list-like data structure where each node is a middleware to be executed
func NewRequestMiddlewareChain ¶
func NewRequestMiddlewareChain(layers ...MiddlewareNodeFn) *RequestMiddlewareChain
NewRequestMiddlewareChain returns a new RequestMiddlewareChain initialized with the given list of MiddlewareNodeFn. They will be executed in the order in which they are given.
func (*RequestMiddlewareChain) Do ¶
func (c *RequestMiddlewareChain) Do(rw http.ResponseWriter, req *http.Request)
Do executes the current MiddlewareNodeFn, with the next MiddlewareNodeFn as the next argument
func (*RequestMiddlewareChain) Wrap ¶
func (c *RequestMiddlewareChain) Wrap(fn http.HandlerFunc) RequestMiddleware
Wrap adds a function to the end of a RequestMiddlewareChain