pub async fn connect(
stream: BoxStream,
target: &Target,
username: Option<&str>,
password: Option<&str>,
proxy_addr: IpAddr,
skip_verify: bool,
) -> Result<BoxStream>Expand description
Connect through an HTTPS CONNECT proxy.
- Wraps
streamin a TLS session to the proxy. - 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.skip_verify— whentrue, certificate validation is skipped entirely (equivalent tohttps_insecureproxy type). Whenfalse, the system CA store is used and the connection fails if the certificate is untrusted.
§Errors
Returns an error if the TLS handshake or HTTP CONNECT negotiation fails.