pub struct RateLimitCfg {
pub enabled: bool,
pub rate: String,
pub burst: u32,
pub routes: Vec<RouteRateLimit>,
pub per_key: PerKeyRateLimit,
pub store: String,
pub redis_url: String,
pub redis_prefix: String,
pub fail_open: bool,
}Fields§
§enabled: bool§rate: StringDefault per-client-IP limit, e.g. “60/min”, “10/sec”, “1000/hour”.
burst: u32§routes: Vec<RouteRateLimit>Per-route overrides. A request whose path starts with path uses that route’s limit
(still keyed per client IP) instead of the global one; the longest matching prefix
wins, so /api/admin/ can be stricter than /api/.
per_key: PerKeyRateLimitAn additional limit keyed by the authenticated principal (API-key id or JWT subject) rather than IP, so a single credential can’t fan out across many IPs. Only applies to authenticated requests.
store: StringWhere limiter state lives: "local" (default) is the in-process governor limiter (fast,
no dependency, but per-replica). "redis" shares GCRA state across replicas via a Redis
store, so N instances enforce one global limit. "memory" uses the same shared-store code
path backed by an in-process map (a single-replica/testing backend). All three honor the
same rate/burst/route/per-key settings above.
redis_url: StringRedis connection URL for store = "redis", e.g. redis://host:6379 or (TLS)
rediss://host:6379. Prefer the EDGEGUARD_REDIS_URL env var over this file.
redis_prefix: StringKey prefix/namespace for the shared store, so multiple EdgeGuard deployments can share one
Redis without colliding. Keys look like <prefix>:ip:<addr>.
fail_open: boolWhat to do when the shared store is unreachable. false (default) fails closed — a
store error returns 503, so an outage can’t silently disable rate limiting. true fails
open — a store error allows the request (favor availability over strict limiting).
Only relevant for store = "redis".
Trait Implementations§
Source§impl Clone for RateLimitCfg
impl Clone for RateLimitCfg
Source§fn clone(&self) -> RateLimitCfg
fn clone(&self) -> RateLimitCfg
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more