Available on crate feature
std only.Expand description
Phantom Protocol Public API
Transport session facade for the SDK.
session::PhantomSession— Client-first transport session (all targets)stream::PhantomStream— Multiplexed reliable stream (all targets)listener::PhantomListener— Server socket listener (native only)tcp_transport::TcpSessionTransport— Length-prefixed framing over TCP (native only)
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;Non-WebAssembly pub use tcp_transport::TcpSessionTransport;Non-WebAssembly pub use udp_listener::PhantomUdpListener;Non-WebAssembly pub use udp_transport::UdpClientTransport;Non-WebAssembly
Modules§
- listener
Non-WebAssembly - session
- Client-First Transport Session
- stream
- tcp_
transport Non-WebAssembly - Length-prefixed
SessionTransportovertokio::net::TcpStream. - udp_
listener Non-WebAssembly - 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 mirroringPhantomListener. Rust-only in Phase 1 (no UniFFI surface yet). - udp_
transport Non-WebAssembly SessionTransportimpls over raw UDP (PhantomUDP).UdpClientTransportis an unconnected-socket client (itsend_tos a tracked server address andrecv_froms any source, so it can hear — and later follow — a server that migrates to a new address);UdpServerTransportis 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 asTcpSessionTransportadds / strips its 4-byte length prefix, sorun_data_pump/run_client_handshake/drive_server_handshakeare reused.