[package]
name = "nng-core"
version = "0.3.0"
edition = "2024"
description = "Pure-Rust implementation of the NNG Scalability Protocols"
license = "MIT OR Apache-2.0"
rust-version = "1.85"
authors = ["Brian Rogoff <brogoff@gmail.com>"]
repository = "https://github.com/bpr/nng-core"
readme = "README.md"

keywords = ["nng", "nanomsg", "zeromq", "zmq"]


[features]
default = ["std"]
std = ["dep:tokio", "embedded-io-async/std"]
ws      = ["std", "dep:tokio-tungstenite", "dep:futures-util"]
wss     = ["ws", "tokio-tungstenite/rustls-tls-native-roots", "dep:tokio-rustls", "dep:rustls", "dep:rustls-pemfile"]
tls-tcp = ["std", "dep:tokio-rustls", "dep:rustls", "dep:rustls-pemfile", "dep:rustls-native-certs"]
quic    = ["std", "dep:quinn", "dep:rustls", "dep:rustls-pemfile", "dep:rustls-native-certs"]
vsock   = ["std", "dep:tokio-vsock"]
udp     = ["std"]
tower   = ["std", "dep:tower-service"]
streams = ["std", "dep:futures-core", "dep:futures-sink", "dep:futures-util"]
kcp     = ["std", "dep:kcp-tokio"]

[dependencies]
embedded-io-async = "0.7"
thiserror = { version = "2", default-features = false }
tokio = { version = "1", optional = true, features = ["net", "sync", "rt", "io-util", "macros", "time"] }
tokio-tungstenite = { version = "0.29.0", optional = true }
futures-core = { version = "0.3", optional = true }
futures-sink = { version = "0.3", optional = true }
futures-util = { version = "0.3", optional = true, features = ["sink"] }
tokio-rustls = { version = "0.26", optional = true }
rustls = { version = "0.23", optional = true, default-features = false, features = ["std"] }
rustls-pemfile = { version = "2", optional = true }
rustls-native-certs = { version = "0.8", optional = true }
quinn = { version = "0.11", optional = true }
tokio-vsock = { version = "0.7", optional = true }
tower-service = { version = "0.3", optional = true }
kcp-tokio = { version = "0.5", optional = true }

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(kani)'] }

[dev-dependencies]
criterion = { version = "0.5", features = ["html_reports"] }
proptest = "1"
proptest-state-machine = "0.3"
tokio = { version = "1", features = ["full"] }
rcgen = "0.14"
tempfile = "3"
tower-service = "0.3"
futures-util = { version = "0.3" }

[[example]]
name = "quic_reqrep"
required-features = ["quic"]

#[[example]]
#name = "kcp_reqrep"
#required-features = ["kcp"]

[[example]]
name = "auth_then_data"

[[example]]
name = "tictactoe"

[[bench]]
name = "latency"
harness = false

[[bench]]
name = "throughput"
harness = false

[[bench]]
name = "codec"
harness = false

[[bench]]
name = "bus0_broadcast"
harness = false

[[bench]]
name = "req0_resend"
harness = false

[[bench]]
name = "pubsub"
harness = false

[[bench]]
name = "large_msg"
harness = false
