pub struct SnapTunnel { /* private fields */ }Expand description
A SNAP tunnel connection.
Implementations§
Source§impl SnapTunnel
impl SnapTunnel
Sourcepub fn try_send(&self, packet: Packet) -> Result<()>
pub fn try_send(&self, packet: Packet) -> Result<()>
Try to send a packet to the remote server. Returns error of try_send_to.
Sourcepub async fn recv(&self) -> Result<Bytes, SnapTunnelReceiveError>
pub async fn recv(&self) -> Result<Bytes, SnapTunnelReceiveError>
Receive a packet from the remote server.
Sourcepub fn try_recv(&self) -> Result<Option<Bytes>, SnapTunnelReceiveError>
pub fn try_recv(&self) -> Result<Option<Bytes>, SnapTunnelReceiveError>
Try to receive a packet from the remote server without blocking.
Returns Ok(None) if no packet is currently available.
Sourcepub fn poll_recv(
&self,
cx: &mut Context<'_>,
) -> Poll<Result<Bytes, SnapTunnelReceiveError>>
pub fn poll_recv( &self, cx: &mut Context<'_>, ) -> Poll<Result<Bytes, SnapTunnelReceiveError>>
Poll for a packet from the remote server.
Sourcepub fn local_addr(&self) -> SocketAddr
pub fn local_addr(&self) -> SocketAddr
Get the local socket address. Assigned by the remote server.
Sourcepub fn data_plane_address(&self) -> SocketAddr
pub fn data_plane_address(&self) -> SocketAddr
The data plane the tunnel is connected to.
Sourcepub fn discarded_datagrams(&self) -> u64
pub fn discarded_datagrams(&self) -> u64
Total number of outbound datagrams the underlay socket refused since the tunnel was created.
A refused datagram is dropped rather than retried, because retrying one the socket will
never accept blocks every packet queued behind it. The tunnel therefore stays up when
sending fails persistently, for example because the interface went down or a firewall
answers EPERM, and this counter is what tells such a tunnel apart from a healthy one.
Trait Implementations§
Source§impl Drop for SnapTunnel
impl Drop for SnapTunnel
Auto Trait Implementations§
impl !Freeze for SnapTunnel
impl !Unpin for SnapTunnel
impl !UnsafeUnpin for SnapTunnel
impl RefUnwindSafe for SnapTunnel
impl Send for SnapTunnel
impl Sync for SnapTunnel
impl UnwindSafe for SnapTunnel
Blanket Implementations§
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more