pub struct UdpRelay { /* private fields */ }Expand description
Relays non-DNS UDP traffic between the guest and the real network.
Each unique (guest_src, guest_dst) pair gets a host-side UDP socket
and a tokio relay task. The poll loop calls relay_outbound() to
send guest datagrams; response frames are injected directly into
rx_ring.
Implementations§
Source§impl UdpRelay
impl UdpRelay
Sourcepub fn new(
shared: Arc<SharedState>,
gateway_mac: [u8; 6],
guest_mac: [u8; 6],
tokio_handle: Handle,
) -> Self
pub fn new( shared: Arc<SharedState>, gateway_mac: [u8; 6], guest_mac: [u8; 6], tokio_handle: Handle, ) -> Self
Create a new UDP relay.
Sourcepub fn relay_outbound(&mut self, frame: &[u8], src: SocketAddr, dst: SocketAddr)
pub fn relay_outbound(&mut self, frame: &[u8], src: SocketAddr, dst: SocketAddr)
Relay an outbound UDP datagram from the guest.
Extracts the UDP payload from the raw ethernet frame, looks up or creates a session, and sends the payload to the relay task.
Sourcepub fn cleanup_expired(&mut self)
pub fn cleanup_expired(&mut self)
Remove expired sessions.
Auto Trait Implementations§
impl Freeze for UdpRelay
impl RefUnwindSafe for UdpRelay
impl Send for UdpRelay
impl Sync for UdpRelay
impl Unpin for UdpRelay
impl UnsafeUnpin for UdpRelay
impl UnwindSafe for UdpRelay
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more