[package]
name = "lazydns"
version = "0.2.31"
edition = "2024"
authors = ["lazywalker <lazywalkerz@gmail.com>"]
description = "A DNS server implementation in Rust, inspired by mosdns"
repository = "https://github.com/lazywalker/lazydns"
license = "GPL-3.0-or-later"
readme = "README.md"
keywords = ["dns", "smartdns", "doh", "dot", "doq"]
categories = ["network-programming"]

[dependencies]
tokio = { version = "1.35", default-features = false, features = [
    "rt",
    "signal",
    "macros",
    "process",
] }

# DNS protocol
hickory-proto = "0.24"

# Serialization
serde = { version = "1.0", default-features = false, features = ["derive"] }
serde_yaml = "0.9"
serde_json = "1.0"

# Error handling
anyhow = "1.0"
thiserror = "2.0"

# Logging
tracing = "0.1"
tracing-subscriber = { version = "0.3", default-features = false, features = [
    "fmt",
], optional = true }
tracing-appender = { version = "0.2", optional = true }
# time crate is used for constructing UTC fallback for OffsetTime
time = { version = "0.3", default-features = false, optional = true }

# cron expression parsing for cron plugin
cronexpr = { version = "1.4", optional = true }

# Async utilities
async-trait = "0.1"

# Concurrent data structures
dashmap = "6.1"
parking_lot = "0.12"

# Networking
axum = { version = "0.8", default-features = false, features = [
    "json",
    "query",
    "tokio",
    "macros",
    # FIXME: connection will reset when test curl with admin features with http2
    "http1",
], optional = true }
rustls = { version = "0.23", default-features = false, features = [
    "ring",
], optional = true }
tokio-rustls = { version = "0.26", optional = true }
rustls-pemfile = { version = "2.0", optional = true }
reqwest = { version = "0.11", default-features = false, features = [
    "json",
    "rustls-tls",
] }
# reqwest = { version = "0.11", features = ["json", "rustls-tls"] }

# QUIC / DoQ support (optional)
quinn = { version = "0.11", optional = true }

# Base64 encoding
base64 = "0.21"

# Metrics
prometheus = { version = "0.13", optional = true }

# File watching for hot reload
notify = "6.1"

# CLI
pico-args = "0.5"

# Utilities
once_cell = "1.19"
paste = "1.0"
regex = "1.10"
ipnet = "2.9"
rand = "0.8"

# Optional TLS-enabled HTTP server for DoH production deployments.
axum-server = { version = "0.7", optional = true, package = "axum-server", default-features = false, features = [
    "tls-rustls-no-provider",
] }

[dev-dependencies]
tempfile = "3.8"
rcgen = "0.14"

[features]
default = ["log-ansi"]
# Enable cron expression parsing for cron plugin
cron = ["cronexpr", "time/local-offset", "time/parsing", "time/formatting"]
# Enable structured  JSON logging output with time stamps
log = [
    "tracing-subscriber/env-filter",
    "tracing-subscriber/json",
    "tracing-subscriber/local-time",
    "time/local-offset",
    "time/macros",
]
# Enable ANSI-colored logging output to terminal
log-ansi = ["log", "tracing-subscriber/ansi"]
# Enable logging to file
log-file = ["log", "tracing-appender"]
# Enable TLS-backed (DoT using tokio-rustls) server implementation
dot = ["rustls", "rustls-pemfile", "tokio-rustls"]
# Enable TLS-backed (DoH using axum-server + rustls) server implementation
doh = ["rustls", "rustls-pemfile", "tokio-rustls", "axum-server", "axum"]
# Enable DoQ (QUIC) server implementation
doq = ["rustls", "rustls-pemfile", "quinn"]
# Enable admin HTTP server
admin = ["axum"]
# Enable metrics endpoint
metrics = ["axum", "prometheus"]

[profile.release]
opt-level = 3
lto = true
debug = false
codegen-units = 1
split-debuginfo = "off"
strip = true

[profile.dev]
opt-level = 0

[profile.test]
opt-level = 1

[profile.minimal]
inherits = "release"
panic = "abort"
opt-level = "z"

[profile.full]
inherits = "minimal"

[[bin]]
name = "lazydns"
path = "src/main.rs"

[lib]
name = "lazydns"
path = "src/lib.rs"
