[package]
name = "freenet"
version = "0.1.50"
edition = "2021"
rust-version = "1.80"
publish = true
description = "Freenet core software"
license-file = "LICENSE.md"
repository = "https://github.com/freenet/freenet-core"
readme = "README.md"

[package.metadata.binstall]
pkg-url = "{ repo }/releases/download/v{ version }/freenet-{ target }.tar.gz"
pkg-fmt = "tgz"
bin-dir = "freenet"

[[bin]]
name = "freenet"
path = "src/bin/freenet.rs"

[dependencies]
ahash = "0.8"
anyhow = "1"
aes-gcm = "0.10"
axum = { default-features = false, features = ["http1", "matched-path", "query", "tower-log", "ws", "json"], workspace = true }
bincode = "1"
blake3 = { workspace = true }
bs58 = "0.5"
byteorder = "1"
bytes = "1"
chacha20poly1305 = { workspace = true }
chrono = { workspace = true }
clap = { features = ["derive", "env"], workspace = true }
cookie = "0.18"
crossbeam = { workspace = true }
ctrlc = { features = ["termination"], workspace = true }
dashmap = { workspace = true }
delegate = "0.13"
directories = "6"
either = { features = ["serde"], workspace = true }
flatbuffers = "25.9"
futures = "0.3"
semver = { version = "1",  features = ["serde"] }
headers = "0.4"
hickory-resolver = { version = "0.24", features = ["dns-over-rustls"] }
itertools = "0.14"
notify = "8"
pav_regression = "0.6.1"
parking_lot = "0.12"
pin-project = "1"
rand = { features = ["small_rng"], workspace = true }
once_cell = "1"
redb = { optional = true, version = "3" }
serde = { features = ["derive", "rc"], workspace = true }
serde_json = { workspace = true }
toml = "0.9"
serde_with = { workspace = true }
sqlx = { features = ["runtime-tokio-rustls", "sqlite"], optional = true, version = "0.8" }
stretto = { features = ["async", "sync"], version = "0.8" }
tar = { version = "0.4" }
thiserror = "2"
tokio = { features = ["fs", "macros", "rt-multi-thread", "sync", "process", "tracing"], version = "1" }
tokio-tungstenite = "0.27.0"
tower-http = { features = ["fs", "trace"], version = "0.6" }
ulid = { features = ["serde"], version = "1.1" }
wasmer = { features = ["sys"], workspace = true }
wasmer-middlewares = "6.1.0"
wasmer-compiler-singlepass = { workspace = true }
xz2 = { version = "0.1" }
reqwest = { version = "0.12", features = ["json"] }
rsa = { version = "0.9", features = ["serde", "pem"] }
pkcs8 = { version = "0.10", features = ["std", "pem"] }
sha2 = "0.10"

# Tracing deps
opentelemetry = "0.31"
opentelemetry-jaeger = { features = ["collector_client", "isahc", "rt-tokio"], optional = true, version = "0.22" }
# In release builds, TRACE/DEBUG spans are compiled out entirely via
# release_max_level_info, reducing the number of spans EnvFilter must evaluate.
# Debug builds retain all levels. RUST_LOG can filter among compiled-in levels.
tracing = { version = "0.1", features = ["release_max_level_info"] }
tracing-opentelemetry = { optional = true, version = "0.32.0" }
tracing-subscriber = { optional = true, version = "0.3", features = ["json"] }
opentelemetry-otlp = { optional = true, version = "0.31.0" }
opentelemetry_sdk = { optional = true, version = "0.31", features = ["rt-tokio"] }

# internal deps
freenet-stdlib = { features = ["net"], workspace = true }
console-subscriber = { version = "0.5.0", optional = true }
tokio-stream = "0.1.17"
freenet-test-network = { version = "0.1.15", optional = true }

[target.'cfg(unix)'.dependencies]
libc = "0.2"  # For sendmmsg syscall batching on Linux

[target.'cfg(windows)'.dependencies]
winapi = { version = "0.3", features = ["sysinfoapi"] }
wmi = "0.18.0"
serde = { version = "1.0", features = ["derive"] }

[dev-dependencies]
arbitrary = { features = ["derive"], version = "1" }
chrono = { features = ["arbitrary"], workspace = true }
criterion = { version = "0.8", features = ["async_tokio"] }
freenet-stdlib = { features = ["net", "testing"], workspace = true }
freenet-macros = { path = "../freenet-macros" }
httptest = "0.16"
libc = "0.2"  # For sendmmsg syscall batching benchmarks
statrs = "0.18"
tempfile = "3"
test-log = "0.2"
testresult.workspace = true
tokio-tungstenite = "0.27.0"
# console-subscriber = { version = "0.4" }
ureq = { version = "3.1", features = ["json"] }
which = "8.0"
regex = "1"

# CI-optimized benchmark suite (~8 min, deterministic)
[[bench]]
name = "transport_ci"
harness = false
required-features = ["bench"]

# LEDBAT validation benchmarks (manual, ~60 min)
[[bench]]
name = "transport_ledbat"
harness = false
required-features = ["bench"]

# Full benchmark suite (manual, ~78 min, requires bench_full feature)
[[bench]]
name = "transport_full"
harness = false
required-features = ["bench", "bench_full"]

[build-dependencies]
chrono = "0.4"

[features]
default = ["redb", "trace", "websocket"]
sqlite = ["sqlx"]
trace = ["tracing-subscriber"]
trace-ot = ["opentelemetry-jaeger", "trace", "tracing-opentelemetry", "opentelemetry-otlp"]
websocket = ["axum/ws"]
testing = ["freenet-stdlib/testing"]
console-subscriber = ["dep:console-subscriber"]
test-network = ["dep:freenet-test-network"]
bench = []  # Exposes internal test infrastructure for benchmarking
bench_full = []  # Enables full benchmark suite (slow, ~78 min)
