[][src]Function async_socks5::connect

pub async fn connect<'_, S, A>(
    socket: &'_ mut S,
    addr: A,
    auth: Option<Auth>
) -> Result<AddrKind> where
    S: AsyncWriteExt + AsyncReadExt + Send + Unpin,
    A: Into<AddrKind>, 

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

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

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