Skip to main content

Module rate_limit

Module rate_limit 

Source
Expand description

Shared Actix rate-limit building blocks.

This module keeps product-neutral rate-limit mechanics in Forge while leaving product response envelopes and protocol-specific error bodies in application crates. It provides:

  • a trusted-proxy-aware IP key extractor for actix-governor;
  • small quota helpers for building Actix governor configs from non-zero (seconds_per_request, burst_size) pairs;
  • a keyed string limiter for protocol endpoints that rate-limit by usernames, emails, or other normalized business keys.

Re-exports§

pub use crate::shared::rate_limit::NormalizedStringRateLimiter;
pub use crate::shared::rate_limit::RateLimitRejection;
pub use crate::shared::rate_limit::retry_after_seconds;

Structs§

TrustedProxyIpKeyExtractor

Functions§

build_ip_governor_config
Builds an Actix governor config using the trusted-proxy-aware IP extractor.
build_ip_governor_config_with_rejection_response
Builds an Actix governor config with a product-provided rejection response.