Skip to main content

phantom_protocol/transport/
mod.rs

1//! Phantom Protocol
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 liveness;
39#[cfg(feature = "std")]
40pub mod multiplexer;
41#[cfg(feature = "std")]
42pub mod pacer;
43#[cfg(feature = "std")]
44pub mod packet_coalescer;
45#[cfg(feature = "std")]
46pub mod packet_coalescer_codec;
47#[cfg(feature = "std")]
48pub mod path;
49#[cfg(feature = "std")]
50pub mod path_validation_codec;
51#[cfg(feature = "std")]
52pub mod reputation;
53#[cfg(feature = "std")]
54pub mod sack;
55#[cfg(feature = "std")]
56pub mod scheduler;
57#[cfg(feature = "std")]
58pub mod session;
59#[cfg(feature = "std")]
60pub mod session_cache;
61#[cfg(feature = "std")]
62pub mod shaping;
63#[cfg(feature = "std")]
64pub mod stream;
65#[cfg(feature = "std")]
66pub mod types;
67
68// ── Native-only sub-modules (Phase 3.5) ────────────────────────────────
69// These pull in `tokio::net::*` / raw sockets / libc and have no wasm
70// equivalent. On wasm32 the corresponding functionality is provided
71// either by `legs::WebSocketLeg` (transport) or by simply not being
72// available (listening for incoming TCP — browsers cannot listen).
73// All require `std`.
74#[cfg(all(feature = "std", not(target_arch = "wasm32")))]
75pub mod framing;
76#[cfg(all(feature = "std", not(target_arch = "wasm32")))]
77pub mod phantom_udp;
78#[cfg(all(feature = "std", not(target_arch = "wasm32")))]
79pub mod udp_transport;
80
81// Re-exports for convenience
82#[cfg(feature = "std")]
83pub use fallback::{FallbackStateMachine, TransportMode};
84#[cfg(feature = "std")]
85pub use scheduler::Scheduler;
86#[cfg(feature = "std")]
87pub use session::Session;
88#[cfg(feature = "std")]
89pub use stream::Stream;
90#[cfg(feature = "std")]
91pub use types::*;