Function async_socks5::connect
source · pub async fn connect<S, A>(
socket: &mut S,
addr: A,
auth: Option<Auth>
) -> Result<AddrKind>
Expand description
Proxifies a TCP connection. Performs the CONNECT
command under the hood.
use async_socks5::connect;
use tokio::{io::BufStream, net::TcpStream};
let stream = TcpStream::connect("my-proxy-server.com:54321").await?;
let mut stream = BufStream::new(stream);
connect(&mut stream, ("google.com", 80), None).await?;