[package]
edition = "2024"
rust-version = "1.96.0"
name = "tower-rate-limiter"
version = "0.1.6"
authors = ["nivek-ph <h499871809@gmail.com>"]
build = false
include = [
"/src/**",
"/examples/**",
"/tests/**",
"/Cargo.toml",
"/README.md",
"/LICENSE-APACHE",
"/LICENSE-MIT",
]
autolib = false
autobins = false
autoexamples = false
autotests = false
autobenches = false
description = "Keyed fixed-window rate limiting middleware for Tower"
homepage = "https://github.com/nivek-ph/tower-rate-limiter"
readme = "README.md"
keywords = [
"rate-limit",
"tower",
"axum",
"redis",
]
categories = ["web-programming::http-server"]
license = "MIT OR Apache-2.0"
repository = "https://github.com/nivek-ph/tower-rate-limiter"
[package.metadata.docs.rs]
all-features = true
[features]
axum = ["http-extract/axum"]
default = ["memory"]
memory = ["dep:moka"]
redis = ["dep:redis"]
redis-lua = [
"redis",
"redis/script",
]
runtime-smol = ["redis?/smol-comp"]
runtime-tokio = ["redis?/tokio-comp"]
tracing = ["dep:tracing"]
[lib]
name = "tower_rate_limiter"
path = "src/lib.rs"
[[example]]
name = "axum_memory"
path = "examples/axum_memory.rs"
required-features = [
"axum",
"memory",
]
[[example]]
name = "axum_redis"
path = "examples/axum_redis.rs"
required-features = [
"axum",
"redis",
"runtime-tokio",
]
[[example]]
name = "tower_dynamic"
path = "examples/tower_dynamic.rs"
required-features = ["memory"]
[[example]]
name = "tower_memory"
path = "examples/tower_memory.rs"
required-features = ["memory"]
[[example]]
name = "trusted_proxy_client_ip"
path = "examples/trusted_proxy_client_ip.rs"
required-features = [
"axum",
"memory",
]
[[test]]
name = "axum"
path = "tests/axum.rs"
required-features = ["axum"]
[[test]]
name = "memory_store"
path = "tests/memory_store.rs"
[[test]]
name = "package_interfaces"
path = "tests/package_interfaces.rs"
[[test]]
name = "rate_limit"
path = "tests/rate_limit.rs"
[[test]]
name = "redis_store_smol"
path = "tests/redis/smol.rs"
required-features = [
"redis",
"runtime-smol",
]
[[test]]
name = "redis_store_tokio"
path = "tests/redis/tokio.rs"
required-features = [
"redis",
"runtime-tokio",
]
[[test]]
name = "tracing"
path = "tests/tracing.rs"
[dependencies.http]
version = "1"
[dependencies.http-extract]
version = "0.1.3"
features = ["client-ip"]
default-features = false
[dependencies.moka]
version = "0.12"
features = ["sync"]
optional = true
[dependencies.pin-project-lite]
version = "0.2"
[dependencies.redis]
version = "1"
optional = true
default-features = false
[dependencies.thiserror]
version = "2"
[dependencies.tower-layer]
version = "0.3"
[dependencies.tower-service]
version = "0.3"
[dependencies.tracing]
version = "0.1"
features = ["std"]
optional = true
default-features = false
[dev-dependencies.axum]
version = "0.8"
[dev-dependencies.dotenvy]
version = "0.15"
[dev-dependencies.smol]
version = "2"
[dev-dependencies.tokio]
version = "1"
features = [
"macros",
"rt-multi-thread",
"time",
]
[dev-dependencies.tower]
version = "0.5"
features = ["util"]