[package]
edition = "2024"
rust-version = "1.85"
name = "throttle-kit"
version = "2.0.0"
build = false
exclude = [
"/target",
"/target",
"/fuzz",
]
autolib = false
autobins = false
autoexamples = false
autotests = false
autobenches = false
description = "Rate limiting for Rust — GCRA algorithm with in-memory and Redis backends, Tower layer integration"
readme = "README.md"
keywords = [
"rate-limit",
"gcra",
"throttle",
]
categories = ["web-programming"]
license = "MIT OR Apache-2.0"
repository = "https://github.com/WyattAu/ratelimit"
[package.metadata.docs.rs]
all-features = true
rustdoc-args = [
"--cfg",
"docsrs",
]
[features]
default = ["in-memory"]
in-memory = ["dep:dashmap"]
metrics = ["dep:metrics"]
redis = ["dep:redis"]
sliding-window = ["dep:dashmap"]
sqlite = ["dep:rusqlite"]
test-util = []
tower = [
"dep:tower",
"dep:tower-layer",
"dep:http",
"dep:axum",
]
[lib]
name = "throttle_kit"
path = "src/lib.rs"
[[test]]
name = "client_ip"
path = "tests/client_ip.rs"
[[test]]
name = "config_matrix"
path = "tests/config_matrix.rs"
[[test]]
name = "integration"
path = "tests/integration.rs"
[[test]]
name = "kani"
path = "tests/kani.rs"
[[test]]
name = "proptest"
path = "tests/proptest.rs"
[[test]]
name = "redis_error_paths"
path = "tests/redis_error_paths.rs"
[[test]]
name = "redis_gcra_live"
path = "tests/redis_gcra_live.rs"
[[test]]
name = "zero_alloc_hot_path"
path = "tests/zero_alloc_hot_path.rs"
[[bench]]
name = "head_to_head"
path = "benches/head_to_head.rs"
harness = false
[[bench]]
name = "iai_hot_path"
path = "benches/iai_hot_path.rs"
harness = false
[[bench]]
name = "ratelimit_bench"
path = "benches/ratelimit_bench.rs"
harness = false
[dependencies.axum]
version = "0.8"
optional = true
[dependencies.dashmap]
version = "6"
optional = true
[dependencies.http]
version = "1"
optional = true
[dependencies.metrics]
version = "0.24"
optional = true
[dependencies.redis]
version = "0.25"
features = [
"tokio-comp",
"connection-manager",
]
optional = true
[dependencies.rusqlite]
version = "0.31"
features = ["bundled"]
optional = true
[dependencies.thiserror]
version = "2"
[dependencies.tokio]
version = "1"
features = [
"time",
"sync",
"rt",
]
[dependencies.tower]
version = "0.5"
optional = true
[dependencies.tower-layer]
version = "0.3"
optional = true
[dependencies.tracing]
version = "0.1"
[dev-dependencies.criterion]
version = "0.5"
features = ["html_reports"]
[dev-dependencies.governor]
version = "0.10"
features = [
"std",
"dashmap",
"quanta",
]
default-features = false
[dev-dependencies.iai-callgrind]
version = "0.16"
[dev-dependencies.proptest]
version = "1"
[dev-dependencies.redis]
version = "0.25"
features = [
"tokio-comp",
"connection-manager",
]
[dev-dependencies.testcontainers]
version = "0.23"
[dev-dependencies.testcontainers-modules]
version = "0.11"
features = ["redis"]
[dev-dependencies.tokio]
version = "1"
features = ["full"]
[lints.clippy]
expect_used = "warn"
indexing_slicing = "deny"
panic = "deny"
unwrap_used = "deny"
[lints.rust.unexpected_cfgs]
level = "warn"
priority = 0
check-cfg = ["cfg(kani)"]