Expand description
Rate Limiting middleware for brute-force protection.
Provides configurable rate limiting to protect against brute-force attacks, DDoS attempts, and API abuse.
§Spring Security Equivalent
Similar to Spring Security’s RateLimiter and integration with Bucket4j.
§Example
ⓘ
use actix_security::http::security::rate_limit::{RateLimiter, RateLimitConfig};
use actix_web::{App, HttpServer};
let rate_limiter = RateLimiter::new(
RateLimitConfig::new()
.requests_per_second(10)
.burst_size(20)
);
HttpServer::new(move || {
App::new()
.wrap(rate_limiter.clone())
.route("/api/login", web::post().to(login))
})Structs§
- Rate
Limit Builder - Builder for endpoint-specific rate limits.
- Rate
Limit Config - Rate limit configuration.
- Rate
Limit Exceeded - Rate limit exceeded error response.
- Rate
Limit Info - Rate limit information for headers.
- Rate
Limiter - Rate limiter middleware.
- Rate
Limiter Middleware - Rate limiter middleware service.
- Rate
Limiter State - Rate limiter state.
Enums§
- KeyExtractor
- Strategy for identifying clients for rate limiting.
- Rate
Limit Algorithm - Rate limiting algorithm.
Type Aliases§
- KeyExtractor
Fn - Type alias for custom key extractor function.