Virtual Socket
Virtual UDP sockets that share a single physical
[tokio::net::UdpSocket].
Features
A top-level "router" task owns the physical socket and reads from it.
For each inbound datagram, the router applies whatever demultiplex
rule the calling system needs (peer address, QUIC Connection ID, DNS
query ID, listener kind, ...) and pushes the datagram onto the
matching VirtualUdpSocket's bounded inbound queue. Consumers drain
that queue.
Outbound is mux: every virtual socket forwards try_send_to /
poll_send_ready to the shared physical socket.
The crate is transport-policy free — it does not parse datagrams, does not own a routing table, and does not implement any application protocol. Pair it with whatever demultiplex strategy the calling system needs.
Example
use SocketAddr;
use Arc;
use Bytes;
use UdpSocket;
use VirtualUdpSocket;
# async
See also
quinn-shared-socket— adapter that exposes aVirtualUdpSocketas aquinn::AsyncUdpSocket, so aquinn::Endpointcan run on top.
License
Released under the MIT License © 2026 Canmi