Skip to main content

phantom_protocol/transport/
mod.rs

1//! Phantom Universal Transport Core
2//!
3//! A meta-transport layer combining SCTP, QUIC, and KCP advantages:
4//! - Multi-homing (seamless Wi-Fi ↔ LTE)
5//! - Multi-streaming (independent streams, no HoL blocking)
6//! - 0-RTT connection establishment
7//! - Connection migration (session persists across IP changes)
8//! - Adaptive fallback (Turbo → Reliable → Stealth)
9
10// ── no_std-clean subset (Phase 3.6) ────────────────────────────────────
11// `session_transport` and `legs::embedded` compile on bare-metal and are the
12// only modules required for the embedded build.
13pub mod legs;
14pub mod session_transport;
15
16// ── std-bound modules ──────────────────────────────────────────────────
17// Everything below pulls `tokio`, `parking_lot`, `dashmap`, `arc-swap`,
18// `std::sync::*`, `std::time::Instant`, raw sockets, or a std-bound crypto dep
19// (`ring`, `ml-kem`, `ml-dsa`, `x25519-dalek`, `ed25519-dalek`).
20// Gated behind `std`.
21#[cfg(feature = "std")]
22pub mod api;
23#[cfg(feature = "std")]
24pub mod bandwidth_estimator;
25#[cfg(feature = "std")]
26pub mod buffer_pool;
27#[cfg(feature = "std")]
28pub mod compression;
29#[cfg(feature = "std")]
30pub mod device_profile;
31#[cfg(feature = "std")]
32pub mod fallback;
33#[cfg(feature = "std")]
34pub mod fragmentation;
35#[cfg(feature = "std")]
36pub mod handshake;
37#[cfg(feature = "std")]
38pub mod multiplexer;
39#[cfg(feature = "std")]
40pub mod pacer;
41#[cfg(feature = "std")]
42pub mod packet_coalescer;
43#[cfg(feature = "std")]
44pub mod packet_coalescer_codec;
45#[cfg(feature = "std")]
46pub mod path;
47#[cfg(feature = "std")]
48pub mod path_validation_codec;
49#[cfg(feature = "std")]
50pub mod reputation;
51#[cfg(feature = "std")]
52pub mod scheduler;
53#[cfg(feature = "std")]
54pub mod session;
55#[cfg(feature = "std")]
56pub mod session_cache;
57#[cfg(feature = "std")]
58pub mod stream;
59#[cfg(feature = "std")]
60pub mod types;
61
62// ── Native-only sub-modules (Phase 3.5) ────────────────────────────────
63// These pull in `tokio::net::*` / raw sockets / libc and have no wasm
64// equivalent. On wasm32 the corresponding functionality is provided
65// either by `legs::WebSocketLeg` (transport) or by simply not being
66// available (listening for incoming TCP — browsers cannot listen).
67// All require `std`.
68#[cfg(all(feature = "std", not(target_arch = "wasm32")))]
69pub mod framing;
70#[cfg(all(feature = "std", not(target_arch = "wasm32")))]
71pub mod udp_transport;
72#[cfg(all(feature = "std", not(target_arch = "wasm32")))]
73pub mod virtual_socket;
74
75// Re-exports for convenience
76#[cfg(feature = "std")]
77pub use fallback::{FallbackStateMachine, TransportMode};
78#[cfg(feature = "std")]
79pub use scheduler::Scheduler;
80#[cfg(feature = "std")]
81pub use session::Session;
82#[cfg(feature = "std")]
83pub use stream::Stream;
84#[cfg(feature = "std")]
85pub use types::*;
86
87#[cfg(all(feature = "std", not(target_arch = "wasm32")))]
88pub use virtual_socket::VirtualSocket;