pub struct ProxyConfig { /* private fields */ }Expand description
Explicit proxy routing. Defaults to direct connections and never reads proxy environment variables.
Implementations§
Source§impl ProxyConfig
impl ProxyConfig
Sourcepub fn direct() -> Self
pub fn direct() -> Self
Selects direct connections without consulting proxy environment variables.
Sourcepub fn http_connect(
url: &str,
auth: Option<ProxyBasicAuth>,
) -> Result<Self, NetError>
pub fn http_connect( url: &str, auth: Option<ProxyBasicAuth>, ) -> Result<Self, NetError>
Routes ws and wss targets through an HTTP CONNECT tunnel.
Accepts only http://host[:port]; credentials must be supplied separately.
Authentication is rejected before any network activity. Use
Self::https_connect to protect credentials, or explicitly opt in with
Self::http_connect_with_auth_policy and
ProxyAuthTransportPolicy::AllowPlaintext.
Sourcepub fn http_connect_with_auth_policy(
url: &str,
auth: Option<ProxyBasicAuth>,
policy: ProxyAuthTransportPolicy,
) -> Result<Self, NetError>
pub fn http_connect_with_auth_policy( url: &str, auth: Option<ProxyBasicAuth>, policy: ProxyAuthTransportPolicy, ) -> Result<Self, NetError>
Routes targets through an HTTP CONNECT tunnel using the explicit authentication transport policy.
AllowPlaintext permits credentials to be sent without encryption,
including when the target uses wss. This is an explicit compatibility
exception; prefer Self::https_connect.
Sourcepub fn https_connect(
url: &str,
auth: Option<ProxyBasicAuth>,
proxy_tls: TlsConfig,
) -> Result<Self, NetError>
pub fn https_connect( url: &str, auth: Option<ProxyBasicAuth>, proxy_tls: TlsConfig, ) -> Result<Self, NetError>
Establishes TLS to an HTTPS proxy before sending HTTP/1.1 CONNECT.
Accepts only https://host[:port], with port 443 by default. Proxy
certificates are validated against the URL host using proxy_tls.
Proxy roots, client identity, and explicit provider are independent of
NetworkConfig::with_tls. Failure never falls back to plaintext.
For ws targets, only the client-to-proxy connection is encrypted.
Sourcepub fn endpoint(&self) -> Option<&str>
pub fn endpoint(&self) -> Option<&str>
Returns the credential-free normalized HTTP or HTTPS proxy URL, or None
for direct mode.
Sourcepub fn is_authenticated(&self) -> bool
pub fn is_authenticated(&self) -> bool
Returns whether proxy credentials are configured.
Sourcepub fn proxy_tls(&self) -> Option<&TlsConfig>
pub fn proxy_tls(&self) -> Option<&TlsConfig>
Returns the independent TLS configuration for an HTTPS proxy.
Direct connections and plaintext HTTP proxies return None.
Sourcepub fn auth_transport_policy(&self) -> Option<ProxyAuthTransportPolicy>
pub fn auth_transport_policy(&self) -> Option<ProxyAuthTransportPolicy>
Returns the configured proxy authentication transport policy, or None
for direct connections. HTTPS proxies always require TLS.