pub struct Associate<S> { /* private fields */ }Expand description
Socks5 command type Associate
Reply the client with Associate::reply() to complete the command negotiation.
Implementations§
Source§impl Associate<Ready>
impl Associate<Ready>
Sourcepub async fn wait_close(&mut self) -> Result<(), Error>
pub async fn wait_close(&mut self) -> Result<(), Error>
Wait until the SOCKS5 client closes this TCP connection.
Socks5 protocol defines that when the client closes the TCP connection used to send the associate command, the server should release the associated UDP socket.
Source§impl<S> Associate<S>
impl<S> Associate<S>
Sourcepub async fn close(&mut self) -> Result<(), Error>
pub async fn close(&mut self) -> Result<(), Error>
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, Error>
pub fn local_addr(&self) -> Result<SocketAddr, Error>
Returns the local address that this stream is bound to.
Sourcepub fn peer_addr(&self) -> Result<SocketAddr, Error>
pub fn peer_addr(&self) -> Result<SocketAddr, Error>
Returns the remote address that this stream is connected to.
Sourcepub fn get_ref(&self) -> &TcpStream
pub fn get_ref(&self) -> &TcpStream
Returns a shared reference to the underlying stream.
Note that this may break the encapsulation of the SOCKS5 connection and you should not use this method unless you know what you are doing.
Sourcepub fn get_mut(&mut self) -> &mut TcpStream
pub fn get_mut(&mut self) -> &mut TcpStream
Returns a mutable reference to the underlying stream.
Note that this may break the encapsulation of the SOCKS5 connection and you should not use this method unless you know what you are doing.
Sourcepub fn into_inner(self) -> TcpStream
pub fn into_inner(self) -> TcpStream
Consumes the Associate<S> and returns the underlying TcpStream.