Skip to main content

Module ratelimit

Module ratelimit 

Source
Expand description

Rate-limit policy and storage trait (RFC-008).

Short human-friendly codes must be protected against online guessing. codlet’s rate-limit model is:

  1. The host computes a RateLimitKey from a trustworthy source (e.g. a verified client IP from a trusted proxy header, or a scope+purpose combination).
  2. codlet checks the key before the expensive lookup.
  3. On a failed redemption, codlet records the failure.
  4. On a successful redemption, the caller may clear the failures.

codlet never parses network headers. Trustworthiness of the key is the host’s responsibility (RFC-008 §6).

Structs§

RateLimitKey
A rate-limit dimension key supplied by the host (RFC-008 §4).
RateLimitPolicy
Rate-limit policy (RFC-008 §4).

Enums§

RateLimitOutcome
The result of a rate-limit check.
RateLimitUnavailable
Behaviour when the rate-limit store is unavailable (RFC-008 §4).

Traits§

RateLimitStore
Rate-limit storage (RFC-008 §4).