handler

package
v1.0.12-0...-16f252f Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2020 License: MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Authorize

func Authorize(secret string, opts ...AuthorizeOption) func(http.Handler) http.Handler

func BreakerHandler

func BreakerHandler(method, path string, metrics *stat.Metrics) func(http.Handler) http.Handler

func ContentSecurityHandler

func ContentSecurityHandler(decrypters map[string]codec.RsaDecrypter, tolerance time.Duration,
	strict bool, callbacks ...UnsignedCallback) func(http.Handler) http.Handler

func CryptionHandler

func CryptionHandler(key []byte) func(http.Handler) http.Handler

func DetailedLogHandler

func DetailedLogHandler(next http.Handler) http.Handler

func GunzipHandler

func GunzipHandler(next http.Handler) http.Handler

func LogHandler

func LogHandler(next http.Handler) http.Handler

func MaxBytesHandler

func MaxBytesHandler(n int64) func(http.Handler) http.Handler

func MaxConns

func MaxConns(n int) func(http.Handler) http.Handler

func MetricHandler

func MetricHandler(metrics *stat.Metrics) func(http.Handler) http.Handler

func PromMetricHandler

func PromMetricHandler(path string) func(http.Handler) http.Handler

func RecoverHandler

func RecoverHandler(next http.Handler) http.Handler

func SheddingHandler

func SheddingHandler(shedder load.Shedder, metrics *stat.Metrics) func(http.Handler) http.Handler

func TimeoutHandler

func TimeoutHandler(duration time.Duration) func(http.Handler) http.Handler

func TracingHandler

func TracingHandler(next http.Handler) http.Handler

Types

type AuthorizeOption

type AuthorizeOption func(opts *AuthorizeOptions)

func WithPrevSecret

func WithPrevSecret(secret string) AuthorizeOption

func WithUnauthorizedCallback

func WithUnauthorizedCallback(callback UnauthorizedCallback) AuthorizeOption

type AuthorizeOptions

type AuthorizeOptions struct {
	PrevSecret string
	Callback   UnauthorizedCallback
}

type DetailLoggedResponseWriter

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

func (*DetailLoggedResponseWriter) Header

func (*DetailLoggedResponseWriter) Write

func (w *DetailLoggedResponseWriter) Write(bs []byte) (int, error)

func (*DetailLoggedResponseWriter) WriteHeader

func (w *DetailLoggedResponseWriter) WriteHeader(code int)

type LoggedResponseWriter

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

func (*LoggedResponseWriter) Header

func (w *LoggedResponseWriter) Header() http.Header

func (*LoggedResponseWriter) Write

func (w *LoggedResponseWriter) Write(bytes []byte) (int, error)

func (*LoggedResponseWriter) WriteHeader

func (w *LoggedResponseWriter) WriteHeader(code int)

type UnauthorizedCallback

type UnauthorizedCallback func(w http.ResponseWriter, r *http.Request, err error)

type UnsignedCallback

type UnsignedCallback func(w http.ResponseWriter, r *http.Request, next http.Handler, strict bool, code int)

Jump to

Keyboard shortcuts

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