pub struct Authenticated(/* private fields */);Expand description
A TCP stream that has been authenticated.
To get the command from the SOCKS5 client, use
wait_request.
It can also be converted back into a raw tokio::TcpStream with From trait.
Implementations§
Source§impl Authenticated
impl Authenticated
Sourcepub async fn wait_request(self) -> Result<ClientConnection>
pub async fn wait_request(self) -> Result<ClientConnection>
Waits the SOCKS5 client to send a request.
This method will return a Command if the client sends a valid command.
When encountering an error, the stream will be returned alongside the error.
Note that this method will not implicitly close the connection even if the client sends an invalid request.
Sourcepub async fn shutdown(&mut self) -> Result<()>
pub async fn shutdown(&mut self) -> Result<()>
Causes the other peer to receive a read of length 0, indicating that no more data will be sent. This only closes the stream in one direction.
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.