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 can be configured globally and are tracked per client IP address.

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()
RateLimitConfig
Rate limiting configuration
SmartIpKeyExtractor
A [KeyExtractor] that tries to get the client IP address from the x-forwarded-for, x-real-ip, and forwarded headers in that order. Falls back to the peer IP address.