phantom_protocol/transport/legs/mod.rs
1//! Transport Legs Module
2//!
3//! Pluggable physical transports, each a `SessionTransport` impl. The browser
4//! `wasm32` target exposes a WebSocket leg (Phase 3.3) since browsers cannot open
5//! raw TCP/UDP sockets; WASI Preview 2 uses a TCP leg; bare-metal uses the
6//! `embedded` leg; the off-by-default `mimicry` feature adds a TLS-mimicry leg.
7//!
8//! The native KCP / TCP / FakeTLS legs and the `TransportLeg` multipath trait
9//! were removed in Phase 0 of the PhantomUDP rewrite — they were never wired
10//! into the session data plane (`PhantomSession` consumes `SessionTransport`,
11//! not `TransportLeg`). The production reliable transport is now PhantomUDP
12//! (`UdpClientTransport` / `UdpServerTransport`, which live outside this module
13//! under `transport/phantom_udp/` + `api/udp_transport.rs`), and FakeTLS-style
14//! traffic mimicry has returned as the `MimicTlsLeg` (`mimic_tls`, below). The
15//! plain TCP byte-pipe is `TcpSessionTransport` (in `api/tcp_transport.rs`).
16
17#[cfg(all(feature = "std", target_arch = "wasm32", target_os = "unknown"))]
18pub mod websocket;
19
20#[cfg(all(feature = "std", target_arch = "wasm32", target_os = "unknown"))]
21pub use websocket::WebSocketLeg;
22
23// Section B / B3 — WASI Preview 2 TCP leg. Same `cfg` gate as
24// `runtime::wasi_runtime`: only built when the `wasi-leg` feature is
25// active AND the build target is a WASI triple (`cfg(target_os = "wasi")`).
26// Mutual exclusion with `wasm32-unknown-unknown` is enforced in
27// `core/src/lib.rs`.
28#[cfg(all(feature = "wasi-leg", target_os = "wasi"))]
29pub mod wasi;
30
31#[cfg(all(feature = "wasi-leg", target_os = "wasi"))]
32pub use wasi::WasiLeg;
33
34// `EmbeddedLeg` — `SessionTransport` over `embedded-io-async` byte streams,
35// behind the `embedded` feature. Compiles on any target (host included) so the
36// tests run there. Phase 3.4. no_std-clean, so it is NOT gated behind `std`.
37#[cfg(feature = "embedded")]
38pub mod embedded;
39
40// `MimicTlsLeg` — TLS-over-TCP active-mimicry `SessionTransport`. Native-only
41// (rides `tokio::net`), behind the off-by-default `mimicry` feature. Comprises the
42// record layer (`mimic_tls::record`), a TLS-1.3 handshake "theater", and the leg
43// itself (`mimic_tls::leg`). The outer TLS is anti-DPI obfuscation ONLY (never a
44// confidentiality boundary) and is detectable by active probing — the inner Phantom
45// session provides the real auth/conf. See the module head and Security Invariant 3.
46#[cfg(all(feature = "mimicry", not(target_arch = "wasm32")))]
47pub mod mimic_tls;