Documentation
¶
Overview ¶
Package ratelimit provides in-memory fixed-window limits and routing middleware.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Enforce ¶
func Enforce(l *Limiter, rule Rule) middleware.Middleware
func Inject ¶
func Inject(l *Limiter) middleware.Middleware
Types ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine applies registered rate-limit rules as middleware.
func (*Engine) Middleware ¶
func (e *Engine) Middleware() middleware.Middleware
type Limiter ¶
type Limiter struct {
// contains filtered or unexported fields
}
Limiter tracks fixed-window counters by action and key.
func NewLimiterWithCapacity ¶ added in v2.0.1
NewLimiterWithCapacity creates a limiter with a fail-closed cardinality bound. Existing callers of NewLimiter retain the historical API.