[package]
name = "rust-web-utils"
version = "0.1.0"
edition = "2024"
rust-version = "1.88"
description = "Lightweight web utilities: client IP & trusted proxies, bot/browser detection, unified JSON response, business timezone, auth cookies + CSRF, cron guards, Next.js static export hosting"
license = "MIT"
repository = "https://github.com/woodchen-ink/rust-web-utils"
homepage = "https://rust-web-utils.czl.net"
documentation = "https://rust-web-utils.czl.net/docs"
readme = "README.md"
keywords = ["web", "http", "axum", "client-ip", "nextjs"]
categories = ["web-programming", "web-programming::http-server"]
exclude = ["docs/", ".github/", "CLAUDE.md"]
[features]
default = ["iputil", "uautil", "resputil", "timex", "cookieutil", "cronutil", "nextstatic"]
iputil = []
uautil = []
resputil = ["dep:serde", "dep:serde_json", "dep:bytes", "dep:http-body-util"]
timex = ["dep:chrono", "dep:chrono-tz"]
cookieutil = ["dep:getrandom", "dep:base64", "dep:subtle", "dep:httpdate"]
cronutil = ["dep:tokio", "tokio/rt", "tokio/time", "tokio/sync", "tokio/macros"]
nextstatic = [
"dep:tokio",
"tokio/fs",
"dep:tower-http",
"dep:tower-service",
"dep:bytes",
"dep:http-body-util",
"dep:percent-encoding",
]
tower = ["uautil", "dep:tower-layer", "dep:tower-service", "dep:bytes", "dep:http-body-util"]
axum = ["dep:axum", "axum/tokio"]
[dependencies]
http = "1.3"
thiserror = "2"
axum = { version = "0.8", optional = true, default-features = false }
base64 = { version = "0.23", optional = true }
bytes = { version = "1", optional = true }
chrono = { version = "0.4.40", optional = true, default-features = false, features = ["clock", "std"] }
chrono-tz = { version = "0.10", optional = true }
getrandom = { version = "0.4", optional = true }
http-body-util = { version = "0.1", optional = true }
httpdate = { version = "1", optional = true }
percent-encoding = { version = "2", optional = true }
serde = { version = "1", optional = true }
serde_json = { version = "1", optional = true }
subtle = { version = "2.6", optional = true }
tokio = { version = "1.40", optional = true, default-features = false }
tower-http = { version = "0.7", optional = true, default-features = false, features = ["fs"] }
tower-layer = { version = "0.3", optional = true }
tower-service = { version = "0.3", optional = true }
[dev-dependencies]
axum = { version = "0.8", default-features = false, features = ["tokio", "http1"] }
serde = { version = "1", features = ["derive"] }
tempfile = "3"
tokio = { version = "1.40", features = ["rt-multi-thread", "macros", "time", "test-util"] }
tower = { version = "0.5", features = ["util"] }
[lints.rust]
unsafe_code = "forbid"
missing_docs = "warn"
[lints.clippy]
all = { level = "warn", priority = -1 }
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]