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 // DefaultMaxKeys is the default maximum number of keys to store. DefaultMaxKeys = 10000 )
Variables ¶
This section is empty.
Functions ¶
func APIKeyFunc ¶ added in v1.9.4
func IPRestriction ¶ added in v1.3.2
func IPRestriction() echo.MiddlewareFunc
func OptionsMethodSkipper ¶
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
MaxKeys int // Maximum number of keys to store (0 = unlimited)
}
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
Click to show internal directories.
Click to hide internal directories.