middlewares

package
v0.0.0-...-8717a1f Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2020 License: GPL-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	LogMetricKeys = []string{"method", "route", "status_code"}
)

Functions

func Authorize

func Authorize(next http.Handler, args ...interface{}) http.Handler

func PanicHandler

func PanicHandler(nextHandler http.Handler) http.Handler

PanicHandler will return statusCOde 500 and log panic error

func ParseClientInfo

func ParseClientInfo(next http.Handler) http.Handler

LogRequest with info level every http request, unless production

func TraceRequest

func TraceRequest(nextHandler http.Handler) http.Handler

TraceRequest add X-Request-ID header to request

Types

type Middleware

type Middleware func(next http.Handler) http.Handler

func BasicAuth

func BasicAuth(username, password string) Middleware

func LogMetricRequest

func LogMetricRequest(latencyObserver metrics.Histogram) Middleware

LogRequest with info level every http request, unless production

func TokenAuth

func TokenAuth(keyValueService userland.KeyValueService, jwtSecret string) Middleware

Authenticate request

type MiddlewareWithArgs

type MiddlewareWithArgs func(next http.Handler, args ...interface{}) http.Handler

func RateLimit

func RateLimit(redisClient *redis.Client) MiddlewareWithArgs

Jump to

Keyboard shortcuts

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