Expand description
Shield: request rate limiting.
The proxy runs embedded on each service instance, so every decision is made
locally with a per-instance GCRA shaper (store::GcraStore) that adds no
blocking latency to the request path. When a shared store is configured, a
background task reconciles counters across instances asynchronously to
approximate a fleet-wide limit; the request path never blocks on it.
A request is limited by the first rule whose glob matches its path. The rule’s key selects who is limited (client IP, a header value, or a validated JWT claim) and its profile selects how much.
Modules§
- gcra
- GCRA (Generic Cell Rate Algorithm) rate limiter core.
- global
- Cross-instance reconciliation of the fleet-wide limit view via a shared store.
- matcher
- Compile Shield config into runtime matchers, limiters, and rules.
- rate
- Rate-limit rate parsing.
- resolve
- Limit resolution: derive a key’s
{rate, burst}from the JWT itself or from an external service, on top of the static config profiles. - store
- In-process GCRA state store.
- window
- Sliding-window counter math for the global (cross-instance) limit view.
Structs§
- Shield
- Compiled Shield rules, limit tiers, and the local GCRA store.
Functions§
- post_
auth_ middleware - Post-auth middleware: enforces rules keyed by a validated JWT claim. Layered inside auth so the verified claims are available on the request.
- pre_
auth_ middleware - Pre-auth middleware: enforces rules that need no validated claims (IP / header keys). Layered outside auth so anonymous floods are shed before any signature verification.