Skip to main content

Module rate_limit

Module rate_limit 

Source
Expand description

Three-layer token-bucket rate limiter for cdn/dht/v1 inbound traffic (ADR 022 §DHT Rate Limiting).

This is a thin DHT-flavoured wrapper over the shared crate::rate_limit::ThreeLayerRateLimiter engine: it pins the DHT-specific operator-visible metric names (via a private metrics sink) and re-exports the config/reject types under their historical DHT names. The layering, cheapest-first ordering, keyspace bound, and batch-token accounting all live in the shared engine — see its module docs.

Structs§

DhtRateLimiter
Three-layer rate limiter for inbound cdn/dht/v1 requests. Newtype over the shared ThreeLayerRateLimiter that injects the DHT metrics sink.

Type Aliases§

DhtRateLimitConfig
Resolved DHT rate-limit configuration. See ADR 022 §DHT Rate Limiting. Default returns the ADR 022 values (per-peer 20/40, per-IP 100/200, global 1000/2000).
DhtRejectLayer
Layer that triggered a cdn/dht/v1 rejection. Alias of the shared RejectLayer; the per_peer/per_ip/global label strings are stable.