pub struct PortPublisher { /* private fields */ }Expand description
Manages published port listeners and inbound connections.
Spawns tokio listeners for each published port. When connections arrive, they are queued for the poll loop to create smoltcp sockets and initiate connections to the guest.
Implementations§
Source§impl PortPublisher
impl PortPublisher
Sourcepub fn new(
ports: &[PublishedPort],
guest_ipv4: Ipv4Addr,
tokio_handle: &Handle,
) -> Self
pub fn new( ports: &[PublishedPort], guest_ipv4: Ipv4Addr, tokio_handle: &Handle, ) -> Self
Create a new publisher and spawn listeners for all published ports.
Sourcepub fn accept_inbound(
&mut self,
iface: &mut Interface,
sockets: &mut SocketSet<'_>,
shared: &Arc<SharedState>,
tokio_handle: &Handle,
)
pub fn accept_inbound( &mut self, iface: &mut Interface, sockets: &mut SocketSet<'_>, shared: &Arc<SharedState>, tokio_handle: &Handle, )
Accept queued inbound connections: create smoltcp sockets and initiate connections to the guest.
Must be called each poll iteration.
Sourcepub fn relay_data(&mut self, sockets: &mut SocketSet<'_>)
pub fn relay_data(&mut self, sockets: &mut SocketSet<'_>)
Relay data between smoltcp sockets and host relay tasks.
Sourcepub fn cleanup_closed(&mut self, sockets: &mut SocketSet<'_>)
pub fn cleanup_closed(&mut self, sockets: &mut SocketSet<'_>)
Remove closed inbound connections.
Only removes sockets in Closed state. Sockets in TimeWait are
left for smoltcp’s 2*MSL timer to handle naturally.
Auto Trait Implementations§
impl Freeze for PortPublisher
impl RefUnwindSafe for PortPublisher
impl Send for PortPublisher
impl Sync for PortPublisher
impl Unpin for PortPublisher
impl UnsafeUnpin for PortPublisher
impl UnwindSafe for PortPublisher
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