When A selects B and B selects C, B’s own default route must not carry A’s forwarded packets on to C. Accept only locally sourced overlay traffic for the client default, while keeping authenticated member traffic on the physical uplink from its first packet. Replies still route to the owning member. Switching B’s default does not tear down A’s existing flows. On Linux, distinguish forwarded packets and SNAT replies from local traffic, including strict reverse-path checks when the agent runs as root. On macOS, tag packets on the offered utun and keep their PF NAT state on the physical interface. On Windows, use interface-bound sockets and a bounded smoltcp TCP endpoint, UDP flow mappings and ICMP echo. An offer and its live sockets survive changes to the client's split routes and transient uplink discovery failures. Remove only owned legacy WinNAT objects. Document the supported IPv4 protocols and resource limits. Real WireGuard agents exercised A, B and C. Two Linux ARM64 namespace tests passed in an isolated Colima container with strict reverse-path filtering. The same destination saw A keep its physical SNAT TCP session while B's local connections switched to C and back. Strict Linux core Clippy passed. Six portable socket regressions passed on macOS, including TCP resets, both half-close orders, UDP port stability and resource limits. The macOS PF rules passed native syntax checking and the Windows target cross-compiled on macOS. Extended privileged macOS and Windows fixtures are available in CI; neither native system routing test ran on this host.
122 lines
5.0 KiB
TOML
122 lines
5.0 KiB
TOML
[package]
|
|
name = "tsunagi-core"
|
|
version = "1.0.5"
|
|
description = "Small private mesh networks: persistent agent identity, deterministic network spaces, an iroh control plane, signed state and a local DNS view."
|
|
readme = "../../README.md"
|
|
keywords = ["mesh", "p2p", "iroh", "networking"]
|
|
categories = ["network-programming"]
|
|
edition.workspace = true
|
|
rust-version.workspace = true
|
|
license.workspace = true
|
|
repository.workspace = true
|
|
|
|
[lib]
|
|
name = "tsunagi"
|
|
|
|
[features]
|
|
default = []
|
|
# A real TUN device, so a plugin can carry actual IP traffic. On Linux it
|
|
# needs CAP_NET_ADMIN; on Windows the process must run elevated and
|
|
# `wintun.dll` must be reachable. Without either the in-memory device serves
|
|
# tests. The platform-specific dependencies are declared per target, so
|
|
# enabling this only pulls what the target it is built for actually uses.
|
|
tun-device = [
|
|
"dep:tun",
|
|
"dep:rtnetlink",
|
|
"dep:caps",
|
|
"dep:futures-util",
|
|
]
|
|
# Telling the operating system where to send its DNS questions. systemd-resolved
|
|
# on Linux, the Name Resolution Policy Table on Windows; the zone and the
|
|
# server work without it either way.
|
|
dns-publish = ["dep:zbus"]
|
|
# The test harness in `testing`, for this crate's own tests and for a
|
|
# protocol crate's. Not on by default: it is only of use to a test.
|
|
testing = ["dep:tempfile", "dep:tracing-subscriber"]
|
|
|
|
[dependencies]
|
|
tsunagi-speedtest = { path = "../tsunagi-speedtest", version = "0.1.0" }
|
|
arc-swap = "1.9"
|
|
iroh.workspace = true
|
|
# `net` for the local control interface: a Unix socket on Unix, a named pipe
|
|
# on Windows. Both live behind the same `net` feature.
|
|
tokio = { workspace = true, features = ["net"] }
|
|
tokio-stream = "0.1"
|
|
serde.workspace = true
|
|
postcard.workspace = true
|
|
bytes.workspace = true
|
|
thiserror.workspace = true
|
|
tracing.workspace = true
|
|
hex.workspace = true
|
|
data-encoding.workspace = true
|
|
rusqlite = { version = "0.40", features = ["bundled"] }
|
|
hkdf = "0.13"
|
|
hmac = "0.13"
|
|
sha2 = "0.11"
|
|
subtle = "2.6"
|
|
zeroize = { version = "1.9", features = ["derive"] }
|
|
rand = "0.10"
|
|
# Already in the tree through iroh. A packet codec, not a DNS server: the
|
|
# zone logic is ours and a full server framework would be a large dependency
|
|
# for answering A records from memory.
|
|
simple-dns = "0.12"
|
|
# IPv4 packet and checksum codecs shared by the Android VPN and Wintun.
|
|
smoltcp = { version = "0.12", default-features = false, features = ["std", "proto-ipv4"] }
|
|
# The IANA top-level domain list, compiled in: one function, no
|
|
# dependencies, no network. Used only to warn that a zone name shadows a
|
|
# real public domain, never to refuse one.
|
|
tld = "2.40"
|
|
fs4 = { version = "1.1", features = ["sync"] }
|
|
directories = "6.0"
|
|
# The real system hostname, without a libc call of our own: this crate is
|
|
# forbidden `unsafe` and will not make one.
|
|
gethostname = "1.1"
|
|
netwatch = "0.19.3"
|
|
netdev = "0.46"
|
|
mainline = "8.0"
|
|
futures-lite = "2.6"
|
|
tun = { version = "0.8", features = ["async"], optional = true }
|
|
# Only for the `testing` harness, which a protocol crate's tests use too.
|
|
tempfile = { version = "3.24", optional = true }
|
|
tracing-subscriber = { version = "0.3", features = ["env-filter"], optional = true }
|
|
|
|
# Linux-only interface provisioning. `rtnetlink` configures the interface in
|
|
# process, so no `ip` invocation is ever needed; `caps` keeps CAP_NET_ADMIN
|
|
# out of the effective set except during the moments it is used.
|
|
[target.'cfg(target_os = "linux")'.dependencies]
|
|
rtnetlink = { version = "0.23", optional = true }
|
|
# Pure Rust D-Bus, no libdbus to link against. `tokio` rather than the
|
|
# default reactor, because the agent brings its own.
|
|
zbus = { version = "5.19", default-features = false, features = ["tokio"], optional = true }
|
|
caps = { version = "0.5", optional = true }
|
|
futures-util = { version = "0.3", default-features = false, optional = true }
|
|
|
|
# Windows-only interface provisioning. The Wintun adapter itself is created
|
|
# and driven through the `tun` dependency, whose safe wrapper is the only way
|
|
# in — loading `wintun.dll` is an `unsafe` call this crate forbids. `netdev`
|
|
# (already in the tree through `netwatch`) reads the interface table through a
|
|
# safe wrapper, which is how the provisioner observes an adapter by name
|
|
# before deciding what to change. Creating an adapter needs the process to be
|
|
# elevated and `wintun.dll` to be reachable at run time.
|
|
[target.'cfg(target_os = "windows")'.dependencies]
|
|
smoltcp = { version = "0.12", default-features = false, features = ["medium-ip", "socket-tcp"] }
|
|
socket2 = { version = "0.6", features = ["all"] }
|
|
windows-sys = { version = "0.61", features = [
|
|
"Win32_Networking_WinSock",
|
|
"Win32_Security",
|
|
"Win32_Security_Authorization",
|
|
"Win32_Foundation",
|
|
] }
|
|
|
|
[dev-dependencies]
|
|
smoltcp = { version = "0.12", default-features = false, features = ["medium-ip", "socket-tcp"] }
|
|
socket2 = { version = "0.6", features = ["all"] }
|
|
# Its own tests use the harness it publishes.
|
|
tsunagi-core = { path = ".", features = ["testing"] }
|
|
tokio = { version = "1.53", features = ["rt", "rt-multi-thread", "sync", "time", "macros", "process", "test-util"] }
|
|
tempfile.workspace = true
|
|
tracing-subscriber.workspace = true
|
|
|
|
[lints]
|
|
workspace = true
|