pub async fn connect(
stream: BoxStream,
target: &Target,
username: Option<&str>,
password: Option<&str>,
proxy_addr: IpAddr,
) -> Result<BoxStream>Expand description
Connect through an HTTPS CONNECT proxy.
- Wraps
streamin a TLS session directed at the proxy (cert validation skipped). - Sends an HTTP
CONNECT target HTTP/1.0request over the TLS channel. - Returns the TLS stream positioned after the proxy’s
200response, ready to relay tunnel traffic.
§Arguments
stream— a connected TCP stream to the proxy’s HTTPS port.target— the tunnel destination requested in the CONNECT line.username/password— optionalProxy-Authorization: Basiccredentials.proxy_addr— the proxy’s IP address, used as the TLS SNI value.
§Errors
Returns an error if the TLS handshake or HTTP CONNECT negotiation fails.