socks5_impl::client

Function connect

Source
pub async fn connect<S, A>(
    socket: &mut S,
    addr: A,
    auth: Option<UserKey>,
) -> Result<Address>
Expand description

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

use socks5_impl::client;
use tokio::{io::BufStream, net::TcpStream};

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