Expand description
Adapter that exposes a virtual_socket::VirtualUdpSocket as a
quinn::AsyncUdpSocket, so a quinn::Endpoint can run on a
UDP socket that is shared with other consumers.
Typical setup:
- A “router” task owns the physical
tokio::net::UdpSocketandrecv_froms it. - Each consumer (a
quinn::Endpoint, an L4 forwarder, a DNS parser, …) gets its ownvirtual_socket::VirtualUdpSocketbacked by the same physical socket. - For inbound traffic, the router applies its own demultiplex
rule and pushes each datagram onto the matching virtual
socket’s queue with
virtual_socket::VirtualUdpSocket::enqueue_inbound. - The QUIC consumer wraps its virtual socket in
SharedSocket::newand hands the wrapper toquinn::Endpoint::new_with_abstract_socket. quinn then sees the virtual socket as if it were exclusive — it can demux QUIC Connection IDs internally without knowing about the shared physical layer.
For outbound, SharedSocket forwards every transmit through
virtual_socket’s try_send_to, which in turn writes through to
the physical socket. quinn never owns the physical socket, so
other consumers can keep writing through it concurrently.
Structs§
- Shared
Socket - Adapter that satisfies
quinn::AsyncUdpSocketfor avirtual_socket::VirtualUdpSocket.