Actix Extensible Rate Limit

Build status crates.io docs.rs

An attempt at a more flexible rate limiting middleware for actix-web

Allows for:

Provided Backends

| Backend | Algorithm | Store | |-----------------|--------------|------------------------------------------------| | InMemoryBackend | Fixed Window | Dashmap | | RedisBackend | Fixed Window | Redis |

Getting Started

```rust // A backend is responsible for storing rate limit data, and choosing whether to allow/deny requests let backend = InMemoryBackend::builder().build();

// Assign a limit of 5 requests per minute per client ip address let input = SimpleInputFunctionBuilder::new(Duration::fromsecs(60), 5) .realip_key() .build();

let middleware = RateLimiter::builder(backend, input).add_headers().build();

// Apply the middleware to your actix app/routes App::new().wrap(middleware) ```