Documentation
¶
Index ¶
Constants ¶
const ( ReasonCooldown = "cooldown" ReasonLimitExceeded = "limit_exceeded" )
Variables ¶
This section is empty.
Functions ¶
func Remaining ¶ added in v0.74.0
Remaining is the non-negative budget left after used requests. used is int64 because the Redis backend reads it straight from a Lua reply; it is clamped before any narrowing so an out-of-range count cannot wrap.
func ValidateLimits ¶ added in v0.100.0
ValidateLimits rejects policies that the millisecond-based backends cannot enforce identically. Disabling a limiter is an explicit HTTP configuration.
Types ¶
type Limit ¶ added in v0.74.0
Limit configures a named rate-limit bucket: at most Limit requests per Window, with an optional Cooldown between accepted requests. It is the single shared limit type consumed by the memory and redis limiter backends and the HTTP layer.
func LookupLimit ¶ added in v0.74.0
LookupLimit resolves the Limit for a bucket from a limits map: the bucket's own entry, else the "default" entry, else a conservative built-in fallback (found is false only for that fallback). Shared by the memory and redis backends.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package memorylimiter is the in-memory sliding-window rate limiter over ratelimit.Limit buckets.
|
Package memorylimiter is the in-memory sliding-window rate limiter over ratelimit.Limit buckets. |
|
Package redislimiter is the Redis-backed sliding-window rate limiter over ratelimit.Limit buckets.
|
Package redislimiter is the Redis-backed sliding-window rate limiter over ratelimit.Limit buckets. |