zmiddlewares

package
v0.18.3 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PathUsageByJWTKey = "jwt_path_usage"
)
View Source
const (
	RequestIDHeader = "X-Request-ID"
)

Variables

This section is empty.

Functions

func CacheMiddleware added in v0.14.2

func CacheMiddleware(metricServer metrics.TaskMetrics, cache zcache.ZCache, config domain.CacheConfig) func(next http.Handler) http.Handler

func GetRoutePattern added in v0.16.1

func GetRoutePattern(r *http.Request) string

func GetSubRoutePattern added in v0.18.2

func GetSubRoutePattern(r *http.Request) string

func JWTUsageMiddleware added in v0.17.0

func JWTUsageMiddleware(zCache zcache.RemoteCache, tokenDetailsTTL, usageMetricTTL time.Duration) func(next http.Handler) http.Handler

func LoggingMiddleware added in v0.14.4

func LoggingMiddleware(options LoggingMiddlewareOptions) func(http.Handler) http.Handler

func ParseCacheConfigPaths added in v0.15.2

func ParseCacheConfigPaths(paths map[string]string) (domain.CacheConfig, error)

func PathToRegexp added in v0.15.3

func PathToRegexp(path string) *regexp.Regexp

func RegisterRequestMetrics

func RegisterRequestMetrics(metricsServer metrics.TaskMetrics) []error

Types

type CacheProcessedPath added in v0.15.3

type CacheProcessedPath struct {
	Regex *regexp.Regexp
	TTL   time.Duration
}

type CorsOptions

type CorsOptions struct {
	AllowedOrigins     []string
	AllowOriginFunc    func(r *http.Request, origin string) bool
	AllowedMethods     []string
	AllowedHeaders     []string
	ExposedHeaders     []string
	AllowCredentials   bool
	MaxAge             int
	OptionsPassthrough bool
	Debug              bool
}

type LoggingMiddlewareOptions added in v0.15.3

type LoggingMiddlewareOptions struct {
	ExcludePaths []string
	Enable       bool
}

type Middleware

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

func Cors

func Cors(options CorsOptions) Middleware

func DefaultCors

func DefaultCors() Middleware

func ErrorHandlerMiddleware

func ErrorHandlerMiddleware() Middleware

func Logger

func Logger(options LoggingMiddlewareOptions) Middleware

func RateLimit

func RateLimit(maxRPM int) Middleware

func RateLimitByFullPath added in v0.10.2

func RateLimitByFullPath(maxRPM int) Middleware

func RequestID

func RequestID() Middleware

func RequestMetrics

func RequestMetrics(metricsServer metrics.TaskMetrics) Middleware

Jump to

Keyboard shortcuts

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