1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//! Userspace NAT stack (userspace SLIRP-style routing).
//!
//! [`Stack`] is an [`L3Device`](crate::L3Device): packets handed to it via
//! `send` are translated to real OS-level [`TcpStream`](std::net::TcpStream)
//! / [`UdpSocket`](std::net::UdpSocket) connections. Responses are pushed
//! back through the handler installed with `set_handler`.
//!
//! [`Stack`] is also an [`L3Connector`](crate::L3Connector): each device
//! attached gets its own private NAT namespace, so multiple peers may use
//! overlapping IPs without colliding in the connection-tracking table.
//!
//! # Limitations versus the Go upstream
//!
//! - The virtual TCP listener path (`Stack::listen` + `Listener::accept`) is
//! wired through the in-tree `vtcp` engine: inbound SYNs destined for a
//! registered listener mint a server-side [`vtcp::Conn`](crate::vtcp::Conn)
//! and, on ESTABLISHED, surface a [`TcpStream`] to the application.
//! - SYN-cookie defense (`vtcp::SynCookies`) for the accept-queue overflow
//! case is not yet wired in — see `TODO(slirp)` in `usernat`.
//! - The *outbound* (virtual→real) NAT path still uses a hand-rolled subset
//! (see `tcp_nat`); it handles the SYN/SYN-ACK/ACK handshake, bulk data in
//! both directions, FIN-initiated graceful close, and RST. Out-of-order
//! reassembly, SACK, and congestion control are missing there.
pub use Listener;
pub use Listener6;
pub use TcpStream;
pub use ;