fast

package
v1.3.5 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2022 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func BasicAuth

func BasicAuth() func(inner fasthttp.RequestHandler) fasthttp.RequestHandler

BasicAuth adds http basic auth validation

func BulkHead

func BulkHead(workers int, maxWaitTime time.Duration) func(inner fasthttp.RequestHandler) fasthttp.RequestHandler

BulkHead add bulk head pattern middleware based on https://github.com/slok/goresilience workers is the number of workers in the execution pool. maxWaitTime is the max time an incoming request will wait to execute before being dropped its execution and return 429 response.

func ContextWithRealIp

func ContextWithRealIp(ctx *fasthttp.RequestCtx, ip string)

func ContextWithRid

func ContextWithRid(ctx *fasthttp.RequestCtx, rid []byte)

func FallbackContentType

func FallbackContentType(contentType string) func(inner fasthttp.RequestHandler) fasthttp.RequestHandler

FallbackContentType set fallback response Content-Type to contentType

func Metrics

Metrics logs some metrics for http request

func RealIpFromContext

func RealIpFromContext(ctx *fasthttp.RequestCtx) string

func Recovery

Recovery handles panic from processing incoming http request

func ReqLog

ReqLog logs http request body and response body for debugging

func RequestIDHandler

func RequestIDHandler(inner fasthttp.RequestHandler) fasthttp.RequestHandler

RequestIDHandler sets unique request id. If header `X-Request-ID` is already present in the request, that is considered the request id. Otherwise, generates a new unique ID.

func Rest

Rest set Content-Type to application/json

func RidFromContext

func RidFromContext(ctx *fasthttp.RequestCtx) []byte

func Tracing

Tracing add jaeger tracing middleware

Types

type MiddlewareFunc

type MiddlewareFunc func(inner fasthttp.RequestHandler) fasthttp.RequestHandler

func (MiddlewareFunc) Middleware

Middleware allows MiddlewareFunc to implement the middleware interface.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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