feat: add token-bucket rate limiting for action endpoints
Add per-context and per-action rate limiting using golang.org/x/time/rate. Configure globally via Options.ActionRateLimit or per-action with WithRateLimit(). Defaults to 10 req/s with burst of 20.
This commit is contained in:
@@ -61,4 +61,9 @@ type Options struct {
|
||||
// connection before the background reaper disposes it.
|
||||
// Default: 30s. Negative value disables the reaper.
|
||||
ContextTTL time.Duration
|
||||
|
||||
// ActionRateLimit configures the default token-bucket rate limiter for
|
||||
// action endpoints. Zero values use built-in defaults (10 req/s, burst 20).
|
||||
// Set Rate to -1 to disable rate limiting entirely.
|
||||
ActionRateLimit RateLimitConfig
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user