middleware

package
v0.0.0-...-aa97e0a Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RequestLoggingMiddleware

func RequestLoggingMiddleware(log logger.Logger) web.HandlerFunc

LoggerMiddleware logs request details for each HTTP request

func SecureHeadersMiddleware

func SecureHeadersMiddleware() web.HandlerFunc

SecureHeadersMiddleware adds security-related headers to HTTP responses.

Types

type RateLimiter

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

RateLimiter manages rate limiting for clients.

func NewRateLimiter

func NewRateLimiter(config RateLimiterConfig) *RateLimiter

NewRateLimiter creates a new RateLimiter.

func (*RateLimiter) Middleware

func (rl *RateLimiter) Middleware() web.HandlerFunc

Middleware enforces rate limiting based on client IP.

type RateLimiterConfig

type RateLimiterConfig struct {
	Requests int
	Window   time.Duration
	Burst    int
}

RateLimiterConfig defines the configuration for the rate limiter.

Jump to

Keyboard shortcuts

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