Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Limitador
Limitador is a generic rate-limiter written in Rust. It can be used as a library, as an HTTP service, or as a GRPC service that implements the Envoy Rate Limit protocol.
Status: Experimental
Getting started
Rust library
Add this to your Cargo.toml
:
[]
= { = "0.1.0" }
To use limitador in a project that compiles to WASM, there are some features
that need to be disabled. Add this to your Cargo.toml
instead:
[]
= { = "0.1.0", = false }
HTTP service
The OpenAPI spec of the service is here.
Run with Docker (replace latest
with the version you want):
To use Redis, specify the URL with REDIS_URL
:
You can also run the service locally:
You can change the host and port with the HOST
and PORT
envs.
GRPC server that implements Envoy's RLS
To run Limitador, you need to provide a YAML file with the limits. There's an
example file that allows 10 requests per minute and per
user_id when the HTTP method is "GET" and 5 when it is a "POST". You can run it
with Docker (replace latest
with the version you want):
To use Redis, specify the URL with REDIS_URL
:
You can also run the service locally:
LIMITS_FILE=./examples/limits.yaml
There's a minimal Envoy config to try limitador here. The config forwards the "userid" header and the request method to Limitador. It assumes that there's an upstream API deployed in the port 1323. You can use echo, for example.
You can change the host and port with the HOST
and PORT
envs.
Limits storage
Limitador can store its limits and counters in memory or in Redis. In memory is faster, but the limits are applied per instance. When using Redis, multiple instances of limitador can share the same limits, but it's slower.
Development
Build
Run the tests
Some tests need a redis deployed in localhost:6379
. You can run it in Docker with:
Then, run the tests: