[package]
name = "microsandbox-network"
description = "Networking types and smoltcp engine for the microsandbox project."
version.workspace = true
authors.workspace = true
repository.workspace = true
license.workspace = true
edition.workspace = true

[lib]
path = "lib/lib.rs"

[dependencies]
base64 = "0.22"
bytes = { workspace = true }
crossbeam-queue = { workspace = true }
dirs = { workspace = true }
futures = { workspace = true }
# tls-ring unlocks `hickory_net::tls::tls_client_connect` for the
# upstream DoT client. The workspace already uses rustls with the ring
# crypto provider, so no new dependency is introduced.
hickory-net = { workspace = true, features = ["tls-ring"] }
hickory-proto = { workspace = true }
httlib-hpack = { workspace = true }
httparse = "1"
ipnetwork = { workspace = true }
libc = { workspace = true }
lru = { workspace = true }
microsandbox-protocol.workspace = true
microsandbox-types.workspace = true
microsandbox-utils.workspace = true
msb_krun = { workspace = true, features = ["net"] }
msb_krun_utils.workspace = true
parking_lot = { workspace = true }
pem = "3"
percent-encoding = "2"
rcgen = { workspace = true }
resolv-conf = { workspace = true }
rustls = { workspace = true }
rustls-native-certs = { workspace = true }
rustls-pki-types.workspace = true
serde = { workspace = true }
# Used for the `SO_LINGER(0)` (RST-on-drop) trick on rejected inbound
# connections in `publisher.rs`. tokio's `TcpStream::set_linger` is
# deprecated; `socket2::SockRef::from(&stream)` is the supported path.
socket2 = { workspace = true }
smoltcp = { workspace = true, features = [
    "alloc",
    "async",
    "medium-ethernet",
    "proto-ipv4",
    "proto-ipv6",
    "socket-dns",
    "socket-icmp",
    "socket-tcp",
    "socket-udp",
] }
thiserror = { workspace = true }
time = { workspace = true }
tokio = { workspace = true }
tokio-rustls = { workspace = true }
tracing = { workspace = true }
zeroize = { workspace = true }

# macOS reads DNS servers from SystemConfiguration / SCDynamicStore rather
# than /etc/resolv.conf. On VPN + split-DNS setups, the file version is
# stale or incomplete. These deps let us query the live system state.
[target.'cfg(target_os = "macos")'.dependencies]
# Pinned to 0.9 to match system-configuration 0.7. Bumping to 0.10 would
# create two incompatible CFString/CFArray/... types in the build.
core-foundation = "0.9"
system-configuration = "0.7"

[target.'cfg(target_os = "windows")'.dependencies]
windows-sys = { version = "0.61.2", features = ["Win32_Foundation", "Win32_NetworkManagement_IpHelper", "Win32_NetworkManagement_Ndis", "Win32_Networking_WinSock"] }

[dev-dependencies]
serde_json = { workspace = true }
