middleware

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package middleware provides http middlewares

The middleware package's functions get added to http services automatically.

Package middleware provides http middlewares

The middleware package's functions get added to http services automatically.

Package middleware provides http middlewares

The middleware package's functions get added to http services automatically.

Package middleware provides http middlewares

The middleware package's functions get added to http services automatically.

Package middleware provides http middlewares

The middleware package's functions get added to http services automatically.

Package middleware provides http middlewares

The middleware package's functions get added to http services automatically.

Package middleware provides http middlewares

The middleware package's functions get added to http services automatically.

Package middleware provides http middlewares

The middleware package's functions get added to http services automatically.

Index

Constants

View Source
const (
	InstrumentationName = "github.com/go-micro/plugins/v4/wrapper/trace/opentelemetry"
)

Variables

This section is empty.

Functions

func Cors

func Cors(AllowedOrigins, AllowedMethods, AllowedHeaders []string, AllowCredentials bool) func(http.Handler) http.Handler

Cors creates a new CORS middleware.

func Log

func Log(logger log.Logger) func(http.Handler) http.Handler

Log creates a new debug logging middleware.

func LogTraceMiddleware

func LogTraceMiddleware(next http.Handler) http.Handler

LogTraceMiddleware starts tracing with spans

func NewRateLimiter

func NewRateLimiter(limit uint64, exp time.Duration, keyFunc Option) func(next http.Handler) http.Handler

NewRateLimiter creates a ratelimiter middleware.

func NoCache

func NoCache(next http.Handler) http.Handler

NoCache sets no-cache headers.

func Secure

func Secure(next http.Handler) http.Handler

Secure creates a new CSP, X-Frame, X-Content-Type headers middleware.

func Timeout

func Timeout(timeout time.Duration) func(next http.Handler) http.Handler

Timeout sets up a timeout request handler.

func TracePropagationMiddleware

func TracePropagationMiddleware(next http.Handler) http.Handler

TracePropagationMiddleware inject previous context into a new request

func Version

func Version(version string) func(http.Handler) http.Handler

Version creates a new X-Version header middleware.

func WithKeyFuncAll

func WithKeyFuncAll() httplimit.KeyFunc

WithKeyFuncAll sets global ratelimiter.

func WithKeyFuncIP

func WithKeyFuncIP() httplimit.KeyFunc

WithKeyFuncIP sets ratelimiter based on IP.

Types

type Option

type Option func() httplimit.KeyFunc

Option defines a single option.

Directories

Path Synopsis
Package wrapper provides middleware wrappers for http/rpc services.
Package wrapper provides middleware wrappers for http/rpc services.

Jump to

Keyboard shortcuts

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