custommiddleware

package
v1.9.4 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultCleanupTTL is the default cleanup duration for unused limiters.
	DefaultCleanupTTL = 10 * time.Second
	// DefaultCleanupEvery is the default interval for running the cleanup routine.
	DefaultCleanupEvery = 5 * time.Minute
)

Variables

This section is empty.

Functions

func APIKeyFunc added in v1.9.4

func APIKeyFunc(c echo.Context) string

func IPKeyFunc added in v1.9.4

func IPKeyFunc(c echo.Context) string

func IPRestriction added in v1.3.2

func IPRestriction() echo.MiddlewareFunc

IPRestriction permit access by IP address.

func OptionsMethodSkipper

func OptionsMethodSkipper(c echo.Context) bool

OptionsMethodSkipper skip when option method requested.

Types

type RateLimitConfig added in v1.9.4

type RateLimitConfig struct {
	Rate         rate.Limit
	Burst        int
	KeyFunc      func(c echo.Context) string
	ErrorMsg     string
	Skipper      func(c echo.Context) bool
	CleanupTTL   time.Duration // How long to keep unused limiters
	CleanupEvery time.Duration // How often to run cleanup
}

type RateLimiter added in v1.9.4

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

func NewRateLimiter added in v1.9.4

func NewRateLimiter(config RateLimitConfig) *RateLimiter

func (*RateLimiter) Middleware added in v1.9.4

func (rl *RateLimiter) Middleware() echo.MiddlewareFunc

Jump to

Keyboard shortcuts

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