Expand description
Token bucket rate limiting middleware. Token bucket rate limiter implemented as a tower Layer/Service.
Requests are counted per caller: the token’s sub (else jti, else its
agent) when the request is authenticated, otherwise the peer IP address.
The layer must sit inside the auth middleware so it sees the caller.
Structs§
- Rate
Limit Service - Rate
Limiter - Shared rate limiter state.
Constants§
- DEFAULT_
BURST - Default bucket size (
MENTEDB_RATE_LIMIT_BURST). - DEFAULT_
PER_ SEC - Default refill per second (
MENTEDB_RATE_LIMIT_PER_SEC).