socks5_connect

Function socks5_connect 

Source
pub async fn socks5_connect<T>(
    stream: &mut T,
    command: &Socks5Command,
    address: &Address,
    auth: &[AuthMethod],
) -> Result<Address>
where T: AsyncRead + AsyncWrite + Unpin,
Available on crate feature socks5 only.
Expand description

Establishes a SOCKS5 proxy connection to a target server.

This function sends an SOCKS5 handshake to a proxy server with the specified target address and authentication credentials, then verifies the response.

§Arguments

  • stream - A mutable reference to an asynchronous stream.
  • command - The SOCKS5 command to execute (Connect, Bind, or UdpAssociate).
  • address - The target address to connect to.
  • auth - An array of supported authentication methods.

§Returns

  • Result<Address> - The bound address returned by the server on success, or an error if the connection fails or is rejected by the server.