Expand description
net-mux is an asynchronous connection multiplexing library built on
Tokio.
It multiplexes a single ordered, connection-oriented byte stream (TCP, KCP, TLS-over-TCP, …) into many bidirectional logical streams with credit-based flow control, ping keepalive, and graceful shutdown.
§Quick start
use net_mux::{Config, Session};
use tokio::net::TcpStream;
let conn = TcpStream::connect("127.0.0.1:7777").await?;
let session = Session::client(conn, Config::default());
let mut stream = session.open().await?;
tokio::io::AsyncWriteExt::write_all(&mut stream, b"hello").await?;See the examples/ directory for end-to-end demos.
Re-exports§
pub use crate::config::Config;pub use crate::config::ConfigBuilder;
Modules§
- config
- Session configuration.
Structs§
- Session
- Multiplexed session over a single connection of type
T. - Stream
- One bidirectional logical stream multiplexed over a session.