Documentation
¶
Overview ¶
Package ratelimit provides the bounded, LRU-evicting per-key token-bucket store shared by the HTTP and gRPC server-side rate limiters. Keeping it in one place means both transports get identical memory-safety guarantees rather than two divergent stores.
Index ¶
Constants ¶
const DefaultMaxTrackedKeys = 8192
DefaultMaxTrackedKeys bounds the per-key store so an attacker rotating source keys cannot allocate unbounded *rate.Limiter values and exhaust memory.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is a bounded, LRU-evicting map of per-key token buckets. It is mutex-guarded and caps the number of tracked keys; when full, the least-recently-used key is evicted. A re-sighted evicted key gets a fresh, full bucket — acceptable because eviction only happens under key churn.