Skip to main content

Module api

Module api 

Source
Expand description

Phantom Protocol Public API

Transport session facade for the SDK.

On wasm32-unknown-unknown (browser) targets the TCP-based building blocks are absent; use WebSocketLeg as the SessionTransport implementation. On wasm32-wasi* targets with --features wasi-leg, use WasiLeg (paired with WasiRuntime) for a TCP-shaped transport over WASI Preview 2 sockets.

Re-exports§

pub use session::ConnectionState;
pub use session::PhantomSession;
pub use session::SessionTransport;
pub use stream::PhantomStream;
pub use listener::PhantomListener;
pub use tcp_transport::TcpSessionTransport;
pub use udp_listener::PhantomUdpListener;
pub use udp_transport::UdpClientTransport;

Modules§

listener
session
Client-First Transport Session
stream
tcp_transport
Length-prefixed SessionTransport over tokio::net::TcpStream.
udp_listener
PhantomUDP server listener: one bound UdpSocket, a central demux task routing datagrams by the 8-byte connection-ID into per-session channels, and a decoupled accept queue mirroring PhantomListener. Rust-only in Phase 1 (no UniFFI surface yet).
udp_transport
SessionTransport impls over raw UDP (PhantomUDP). UdpClientTransport is an unconnected-socket client (it send_tos a tracked server address and recv_froms any source, so it can hear — and later follow — a server that migrates to a new address); UdpServerTransport is a per-session shim fed by the listener demux that can migrate its own send socket. Both add / strip the outer [flags][cid] envelope exactly as TcpSessionTransport adds / strips its 4-byte length prefix, so run_data_pump / run_client_handshake / drive_server_handshake are reused.