[−][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 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?;