Skip to content

Commit b05019b

Browse files
committed
feat(tunnel): phase 1 — ipstack datapath + forwarder
Wire the WireGuard transport to a real network. `WgDevice` is a zero-alloc AsyncRead+AsyncWrite packet device: it owns the UDP socket and WgTunnel and does decapsulate/encapsulate inline against a reused buffer in poll_read/ poll_write (no channels, no Arc<Mutex>, no per-packet allocation). The endpoint drives ipstack over the device and forwards each guest flow to a real socket — TCP via copy_bidirectional, UDP via a datagram relay; the forward destination is the stream's peer_addr (confirmed = dst_addr from ipstack source). - Add tokio `net` feature, ipstack 1.0 dependency, etherparse (dev) - Document the datapath decisions in TUNNEL.md Tests: 90 lib total (+1). A loopback integration test stands up the real WgDevice + ipstack over two localhost UDP sockets, drives an actual WireGuard handshake from a bare guest tunnel, sends an etherparse-built IPv4/UDP packet, and asserts ipstack surfaces a stream addressed to the packet's destination — validating the whole receive datapath without a container.
1 parent 429c434 commit b05019b

5 files changed

Lines changed: 498 additions & 4 deletions

File tree

Cargo.lock

Lines changed: 135 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ tokio = { version = "1", features = [
2525
"io-util",
2626
"io-std",
2727
"fs",
28+
"net",
2829
"sync",
2930
"signal",
3031
"time",
@@ -59,9 +60,11 @@ tempfile = "3"
5960
boringtun = { version = "0.7", default-features = false }
6061
base64 = "0.22"
6162
getrandom = "0.4.2"
63+
ipstack = "1.0.0"
6264

6365
[dev-dependencies]
6466
assert_cmd = "2"
67+
etherparse = "0.19"
6568
predicates = "3"
6669

6770
[features]

0 commit comments

Comments
 (0)