Documentation
¶
Index ¶
- Constants
- func APIKeyFunc(c *echo.Context) string
- func IPKeyFunc(c *echo.Context) string
- func IPRestriction() echo.MiddlewareFunc
- func JSONRequestLogger() echo.MiddlewareFunc
- func JSONRequestLoggerConfig() middleware.RequestLoggerConfig
- func OptionsMethodSkipper(c *echo.Context) bool
- type RateLimitConfig
- type RateLimiter
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 JSONRequestLogger ¶ added in v1.11.0
func JSONRequestLogger() echo.MiddlewareFunc
JSONRequestLogger returns middleware that outputs the legacy JSON log format.
func JSONRequestLoggerConfig ¶ added in v1.11.0
func JSONRequestLoggerConfig() middleware.RequestLoggerConfig
JSONRequestLoggerConfig returns a request logger config that outputs the legacy JSON log format.
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.