VT-Muxer
the Vrtgs Tcp Muxer
[]
= "0.1.0"
Basic Example
use ;
use TcpStream;
use ;
// Server side
async
// Client side
async
Core Types
MuxListener
The server-side multiplexer that accepts new logical connections:
new(stream: TcpStream) -> MuxListener- Create a new multiplexer from a TCP streamaccept() -> Future<Result<MuxConnection>>- Accept a new multiplexed connectionadd_connection(addr: SocketAddr) -> Future<Result<MuxConnection>>- Explicitly add a new connection
MuxPipe
The client-side interface for creating new multiplexed connections:
new(stream: TcpStream) -> MuxPipe- Create a new multiplexer from a TCP streamadd_connection(addr: SocketAddr) -> Future<Result<MuxConnection>>- Create a new multiplexed connection
MuxConnection
Represents a single Buffered multiplexed connection:
- Implements
AsyncReadandAsyncWritefor standard async I/O operations addr() -> SocketAddr- Get the address associated with this connection
MuxConnection should always be shutdown, otherwise a task will be spawned to shutdown the connection
Address Types
The library provides optimized address types that merge Ipv4 and Ipv6 addresses into one using Ipv6 mapped/compatible addresses for network operations:
SocketAddr- A compact socket address representationIpAddr- A lightweight IP address type
Performance
- Zero-copy packet handling using
bytemuck - Efficient multiplexing with minimal overhead
- Optimized for high-throughput scenarios
- Spawning of tasks/threads only occurs when a MuxConnection is dropped without being shutdown