[][src]Function async_socks5::connect

pub async fn connect<'_, A>(
    socket: &'_ mut TcpStream,
    addr: A,
    auth: Option<Auth>
) -> Result<AddrKind> where
    A: Into<AddrKind>, 

Proxifies a TCP connection. Performs the CONNECT command under the hood.

use tokio::net::TcpStream;
use async_socks5::connect;

let mut stream = TcpStream::connect("my-proxy-server.com:54321").await?;
connect(&mut stream, ("google.com", 80), None).await?;