middleware

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CORSMiddleware

func CORSMiddleware(next http.Handler) http.Handler

func Chain

func Chain(h http.Handler, middleware ...func(http.Handler) http.Handler) http.Handler

Chain applies multiple middleware to a handler in the order they are provided

func WithBucketAccessControl

func WithBucketAccessControl(policy BucketPolicy, logger *slog.Logger, enabled bool) func(http.Handler) http.Handler

func WithLogging

func WithLogging(logger *slog.Logger) func(http.Handler) http.Handler

func WithValidation

func WithValidation(config ValidationConfig) func(http.Handler) http.Handler

Types

type BucketPolicy

type BucketPolicy struct {
	AllowedOperations map[string][]string // bucket -> operations
	AllowedIPs        map[string][]string // bucket -> IP ranges
}

type MetricsMiddleware

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

func NewMetricsMiddleware

func NewMetricsMiddleware() *MetricsMiddleware

func (*MetricsMiddleware) ServeHTTP

func (m *MetricsMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*MetricsMiddleware) WithMetrics

func (m *MetricsMiddleware) WithMetrics(next http.Handler) http.Handler

type ValidationConfig

type ValidationConfig struct {
	ExcludedPaths []string
	BucketAccess  map[string]string
}

Jump to

Keyboard shortcuts

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