Documentation
¶
Index ¶
Constants ¶
const ( ReasonCooldown = "cooldown" ReasonLimitExceeded = "limit_exceeded" )
Variables ¶
This section is empty.
Functions ¶
func Remaining ¶
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 ¶
ValidateLimits rejects policies that the millisecond-based backends cannot enforce identically. Disabling a limiter is an explicit HTTP configuration.
Types ¶
type Limit ¶
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 ¶
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-process sliding-window rate limiter over ratelimit.Limit buckets: AuthKit's limiter without Redis, and the Redis limiter's fallback.
|
Package memorylimiter is the in-process sliding-window rate limiter over ratelimit.Limit buckets: AuthKit's limiter without Redis, and the Redis limiter's fallback. |
|
Package redislimiter is the Redis-backed sliding-window rate limiter over ratelimit.Limit buckets, shared by every replica.
|
Package redislimiter is the Redis-backed sliding-window rate limiter over ratelimit.Limit buckets, shared by every replica. |