Documentation ¶
Index ¶
- func SetBackend2FrontendMap(newMap *map[string]string)
- type Authenticator
- type CircuitBreaker
- type Compress
- type HandlerSwitcher
- type Logger
- type ResponseRecorder
- func (rw *ResponseRecorder) CloseNotify() <-chan bool
- func (rw *ResponseRecorder) Flush()
- func (rw *ResponseRecorder) Header() http.Header
- func (rw *ResponseRecorder) Hijack() (net.Conn, *bufio.ReadWriter, error)
- func (rw *ResponseRecorder) Write(buf []byte) (int, error)
- func (rw *ResponseRecorder) WriteHeader(code int)
- type Retry
- type Rewrite
- type Routes
- type SaveBackend
- type StripPrefix
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetBackend2FrontendMap ¶
SetBackend2FrontendMap is called by server.go to set up frontend translation
Types ¶
type Authenticator ¶ added in v1.1.0
type Authenticator struct {
// contains filtered or unexported fields
}
Authenticator is a middleware that provides HTTP basic and digest authentication
func NewAuthenticator ¶ added in v1.1.0
func NewAuthenticator(authConfig *types.Auth) (*Authenticator, error)
NewAuthenticator builds a new Autenticator given a config
func (*Authenticator) ServeHTTP ¶ added in v1.1.0
func (a *Authenticator) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc)
type CircuitBreaker ¶
type CircuitBreaker struct {
// contains filtered or unexported fields
}
CircuitBreaker holds the oxy circuit breaker.
func NewCircuitBreaker ¶
func NewCircuitBreaker(next http.Handler, expression string, options ...cbreaker.CircuitBreakerOption) (*CircuitBreaker, error)
NewCircuitBreaker returns a new CircuitBreaker.
func (*CircuitBreaker) ServeHTTP ¶
func (cb *CircuitBreaker) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc)
type Compress ¶ added in v1.1.0
type Compress struct { }
Compress is a middleware that allows redirections
func (*Compress) ServeHTTP ¶ added in v1.1.0
func (c *Compress) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc)
ServerHTTP is a function used by negroni
type HandlerSwitcher ¶
type HandlerSwitcher struct {
// contains filtered or unexported fields
}
HandlerSwitcher allows hot switching of http.ServeMux
func NewHandlerSwitcher ¶
func NewHandlerSwitcher(newHandler *mux.Router) (hs *HandlerSwitcher)
NewHandlerSwitcher builds a new instance of HandlerSwitcher
func (*HandlerSwitcher) GetHandler ¶
func (hs *HandlerSwitcher) GetHandler() (newHandler *mux.Router)
GetHandler returns the current http.ServeMux
func (*HandlerSwitcher) ServeHTTP ¶
func (hs *HandlerSwitcher) ServeHTTP(rw http.ResponseWriter, r *http.Request)
func (*HandlerSwitcher) UpdateHandler ¶
func (hs *HandlerSwitcher) UpdateHandler(newHandler *mux.Router)
UpdateHandler safely updates the current http.ServeMux with a new one
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger writes each request and its response to the access log. It gets some information from the logInfoResponseWriter set up by previous middleware.
func (*Logger) ServeHTTP ¶
func (l *Logger) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc)
type ResponseRecorder ¶
type ResponseRecorder struct { Code int // the HTTP response code from WriteHeader HeaderMap http.Header // the HTTP response headers Body *bytes.Buffer // if non-nil, the bytes.Buffer to append written data to // contains filtered or unexported fields }
ResponseRecorder is an implementation of http.ResponseWriter that records its mutations for later inspection in tests.
func NewRecorder ¶
func NewRecorder() *ResponseRecorder
NewRecorder returns an initialized ResponseRecorder.
func (*ResponseRecorder) CloseNotify ¶ added in v1.1.0
func (rw *ResponseRecorder) CloseNotify() <-chan bool
CloseNotify returns a channel that receives at most a single value (true) when the client connection has gone away.
func (*ResponseRecorder) Flush ¶ added in v1.1.0
func (rw *ResponseRecorder) Flush()
Flush sends any buffered data to the client.
func (*ResponseRecorder) Header ¶
func (rw *ResponseRecorder) Header() http.Header
Header returns the response headers.
func (*ResponseRecorder) Hijack ¶
func (rw *ResponseRecorder) Hijack() (net.Conn, *bufio.ReadWriter, error)
Hijack hijacks the connection
func (*ResponseRecorder) Write ¶
func (rw *ResponseRecorder) Write(buf []byte) (int, error)
Write always succeeds and writes to rw.Body, if not nil.
func (*ResponseRecorder) WriteHeader ¶
func (rw *ResponseRecorder) WriteHeader(code int)
WriteHeader sets rw.Code.
type Retry ¶
type Retry struct {
// contains filtered or unexported fields
}
Retry is a middleware that retries requests
type Rewrite ¶
type Rewrite struct {
// contains filtered or unexported fields
}
Rewrite is a middleware that allows redirections
func NewRewrite ¶
NewRewrite creates a Rewrite middleware
func (*Rewrite) ServeHTTP ¶
func (rewrite *Rewrite) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc)
type Routes ¶
type Routes struct {
// contains filtered or unexported fields
}
Routes holds the gorilla mux routes (for the API & co).
func (*Routes) ServeHTTP ¶
func (router *Routes) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc)
type SaveBackend ¶
type SaveBackend struct {
// contains filtered or unexported fields
}
SaveBackend sends the backend name to the logger.
func NewSaveBackend ¶
func NewSaveBackend(next http.Handler) *SaveBackend
NewSaveBackend creates a SaveBackend
func (*SaveBackend) ServeHTTP ¶
func (sb *SaveBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request)
type StripPrefix ¶
StripPrefix is a middleware used to strip prefix from an URL request
func (*StripPrefix) ServeHTTP ¶
func (s *StripPrefix) ServeHTTP(w http.ResponseWriter, r *http.Request)
func (*StripPrefix) SetHandler ¶
func (s *StripPrefix) SetHandler(Handler http.Handler)
SetHandler sets handler