pub struct IncomingConnection<O> { /* private fields */ }Expand description
An incoming connection. This may not be a valid socks5 connection. You need to call authenticate()
to perform the socks5 handshake. It will be converted to a proper socks5 connection after the handshake succeeds.
Implementations§
Source§impl<O: 'static> IncomingConnection<O>
impl<O: 'static> IncomingConnection<O>
Sourcepub fn local_addr(&self) -> Result<SocketAddr>
pub fn local_addr(&self) -> Result<SocketAddr>
Returns the local address that this stream is bound to.
Sourcepub fn peer_addr(&self) -> Result<SocketAddr>
pub fn peer_addr(&self) -> Result<SocketAddr>
Returns the remote address that this stream is connected to.
Sourcepub fn nodelay(&self) -> Result<bool>
pub fn nodelay(&self) -> Result<bool>
Gets the value of the TCP_NODELAY option on this socket.
For more information about this option, see
set_nodelay.
Sourcepub fn set_nodelay(&self, nodelay: bool) -> Result<()>
pub fn set_nodelay(&self, nodelay: bool) -> Result<()>
Sets the value of the TCP_NODELAY option on this socket.
If set, this option disables the Nagle algorithm. This means that segments are always sent as soon as possible, even if there is only a small amount of data. When not set, data is buffered until there is a sufficient amount to send out, thereby avoiding the frequent sending of small packets.
Sourcepub fn ttl(&self) -> Result<u32>
pub fn ttl(&self) -> Result<u32>
Gets the value of the IP_TTL option for this socket.
For more information about this option, see
set_ttl.
Sourcepub fn set_ttl(&self, ttl: u32) -> Result<()>
pub fn set_ttl(&self, ttl: u32) -> Result<()>
Sets the value for the IP_TTL option on this socket.
This value sets the time-to-live field that is used in every packet sent from this socket.
Sourcepub async fn authenticate_with_timeout(
self,
timeout: Duration,
) -> Result<(Authenticated, O)>
pub async fn authenticate_with_timeout( self, timeout: Duration, ) -> Result<(Authenticated, O)>
Set a timeout for the SOCKS5 handshake.
Sourcepub async fn authenticate(self) -> Result<(Authenticated, O)>
pub async fn authenticate(self) -> Result<(Authenticated, O)>
Perform a SOCKS5 authentication handshake using the given
AuthExecutor adapter.
If the handshake succeeds, an Authenticated
alongs with the output of the AuthExecutor adapter is returned.
Otherwise, the error and the original TcpStream is returned.
Note that this method will not implicitly close the connection even if the handshake failed.