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 limiter 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 PostgreSQL and Redis limiters 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 PostgreSQL and Redis limiters.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package pglimiter is the sliding-window rate limiter over ratelimit.Limit buckets in PostgreSQL (rate_limits), shared by every replica: AuthKit's limiter of record, and the Redis limiter's while Redis fails.
|
Package pglimiter is the sliding-window rate limiter over ratelimit.Limit buckets in PostgreSQL (rate_limits), shared by every replica: AuthKit's limiter of record, and the Redis limiter's while Redis fails. |
|
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. |