Crates.io | fair-rate-limiter |
lib.rs | fair-rate-limiter |
version | 0.1.0 |
source | src |
created_at | 2022-05-03 04:29:36.682646 |
updated_at | 2022-05-03 04:29:36.682646 |
description | Detect overload and fairly shed load from diverse IPs, subnets, users, or systems. Mitigate denial-of-service (DoS) attacks. |
homepage | |
repository | https://gitlab.com/leonhard-llc/ops |
max_upload_size | |
id | 579493 |
size | 34,778 |
Use RateLimiter
struct to detect overload and
fairly shed load from diverse IP addresses, users, or systems.
Mitigate denial-of-service (DoS
) attacks.
DoS
attacks to
backend systems.forbid(unsafe_code)
, depends only on crates that are forbid(unsafe_code)
DDoS
mitigation tracking 30M clients: 750ns per check, 1.3M checks per secondunsafe
parking_lot
unsafe
or depslet mut limiter = new_fair_ip_address_rate_limiter(10.0).unwrap();
let mut now = Instant::now();
let key = IpAddrKey::from(Ipv4Addr::new(10,0,0,1));
assert!(limiter.check(key, 4, now));
assert!(limiter.check(key, 4, now));
now += Duration::from_secs(1);
assert!(limiter.check(key, 4, now));
assert!(limiter.check(key, 4, now));
now += Duration::from_secs(1);
assert!(limiter.check(key, 4, now));
assert!(limiter.check(key, 4, now));
now += Duration::from_secs(1);
assert!(limiter.check(key, 4, now));
assert!(limiter.check(key, 4, now));
assert!(!limiter.check(key, 4, now));
Metric output format: x/y
x = unsafe code used by the build
y = total unsafe code found in the crate
Symbols:
🔒 = No `unsafe` usage found, declares #![forbid(unsafe_code)]
❓ = No `unsafe` usage found, missing #![forbid(unsafe_code)]
☢️ = `unsafe` usage found
Functions Expressions Impls Traits Methods Dependency
0/0 0/0 0/0 0/0 0/0 🔒 fair-rate-limiter 0.1.0
0/0 0/0 0/0 0/0 0/0 🔒 └── oorandom 11.1.3
0/0 0/0 0/0 0/0 0/0
governor
License: Apache-2.0