Skip to main content

Crate tower_rate_limiter

Crate tower_rate_limiter 

Source
Expand description

Keyed HTTP rate limiting middleware for Tower.

The crate is Tower-first: the core interfaces do not require Axum, Tokio, Redis, or a particular request identity policy. Optional adapters are enabled through Cargo features.

Structs§

ClientIpKeyExtractor
Extract a client IP key from supported client-IP headers, falling back to the socket IP.
DefaultResponseFactory
The default empty-body response factory.
IpKeyExtractor
Extract an IP client key from only the socket peer.
MemoryStore
In-process Store whose clones share one counter set.
Policy
A policy’s rate-limit state exposed to a downstream handler.
RateLimit
Tower service produced by super::RateLimitLayer.
RateLimitBuilder
Builder for a rate-limit layer with compile-time store/resolver/factory types.
RateLimitContext
Read-only rate-limit state carried in request extensions for allowed requests.
RateLimitLayer
Layer that applies RateLimit.
RedisStore
Redis-backed implementation of the common fixed-window Store seam.
ResponseFuture
Response future for super::RateLimit.
TrustedProxyClientIpKeyExtractor
Extract a client IP key only when the socket peer satisfies an application trust policy.
Usage
The usage and reset duration returned by a store.

Enums§

ConfigError
Errors produced while validating a rate-limit builder.
MemoryStoreError
Errors returned by the in-memory rate limit store.
RateLimitError
A failure produced while resolving or charging a rate-limit policy.
RateLimitFields
The Rate Limit Fields revision emitted in responses.
RedisStoreError
Errors returned by the Redis rate-limit store.
ResponseReason
The structured reason passed to a ResponseFactory.
StoreFailureMode
The operating mode to use when the rate-limit store fails.

Traits§

KeyExtractor
Extract a client key synchronously from a request.
LimitProvider
Resolve a fixed or request-derived quota limit asynchronously.
ResponseFactory
A factory for responses to rate-limit middleware results.
Store
An asynchronous fixed-window rate-limit store.