tokilake_smux/lib.rs
1//! # tokilake-smux
2//!
3//! Wire-compatible smux protocol implementation for Rust.
4//!
5//! Zero-overhead design following monolake patterns:
6//! - Generic over transport (`AsyncRead + AsyncWrite`), no `Box<dyn>`
7//! - `impl Future` in trait returns, no `async_trait` crate
8//! - Channel-based stream multiplexing
9//!
10//! ## Protocol
11//!
12//! Header format (8 bytes, little-endian):
13//! ```text
14//! | VERSION (1B) | CMD (1B) | LENGTH (2B) | STREAM_ID (4B) |
15//! ```
16//!
17//! Commands: SYN(0), FIN(1), PSH(2), NOP(3), UPD(4)
18//!
19//! ## Usage
20//!
21//! ```ignore
22//! use tokilake_smux::{Session, Config};
23//!
24//! // Server side
25//! let mut session = Session::server(stream, Config::default());
26//! let mut stream = session.accept().await?;
27//!
28//! // Client side
29//! let mut session = Session::client(stream, Config::default());
30//! let mut stream = session.open().await?;
31//! ```
32
33mod frame;
34mod session;
35mod stream;
36
37pub use frame::{Frame, HEADER_SIZE, MAX_PAYLOAD_SIZE, VERSION_1, VERSION_2};
38pub use session::{Config, Session};
39pub use stream::Stream;