Module rate_limit

Module rate_limit 

Source
Expand description

Rate limiting middleware for HTTP requests

This module provides rate limiting functionality using the tower-governor crate, which implements the Generic Cell Rate Algorithm (GCRA). Rate limits are keyed on the real TCP peer IP (PeerIpKeyExtractor) rather than the spoofable X-Forwarded-For family of headers, so a client cannot evade the limit or exhaust another client’s bucket by forging a forwarding header.

Structs§

GovernorConfigBuilder
Helper struct for building a configuration for the governor middleware.
GovernorLayer
The Layer type that implements tower::Layer and is passed into .layer()
PeerIpKeyExtractor
A [KeyExtractor] that uses peer IP as key. This is the default key extractor and it may no do want you want.
RateLimitConfig
Rate limiting configuration