pub enum ProxyMode {
None,
Environment,
Explicit(String),
System,
}Expand description
How requests reach the network.
Threat model. A direct connection is the strongest case: this crate resolves the
name, checks every address and connects to exactly those addresses. Through a proxy it
cannot: the proxy resolves the destination name itself, so the address a connection
reaches cannot be checked or pinned here. The guarantee through a proxy is therefore
name- and literal-based, and weaker than a direct connection. ProxyMode::None stays
the default for that reason.
With a proxy:
- The proxy endpoint is trusted (it is user or administrator configuration, often on a
private address such as
http://10.0.0.5:3128). It gets no address-class denial. Onlyhttpandhttpsproxies are accepted. - Every destination is still vetted: IP literals (and
localhost) by class, hostnames by the name rules (localhost,*.localhost,*.local,*.internaland single-label names are refused unless anallow_ifrule lists the host), cloud metadata names, and the first-party host pin.deny_rangesanddeny_ifapply to literals only, because a hostname’s address is not known. A hostname that resolves to a private address at the proxy is not caught. - Every redirect hop is vetted the same way.
- Hosts that match
NO_PROXYconnect directly and get the full direct-connection check. ClientConfig::proxy_bypass_first_partyskips the proxy for a first-party client.
The proxy is trusted: it sees destinations and can forward anywhere. Credentials in a
proxy URL never appear in Debug output or errors.
Variants§
None
No proxy. Environment proxy variables are ignored. This is the default.
Environment
ALL_PROXY, HTTPS_PROXY, HTTP_PROXY (first set, either case) and NO_PROXY.
Explicit(String)
A proxy URL such as http://proxy.corp:3128 or socks5://127.0.0.1:1080.
System
The proxy the operating system is configured with for the current user.
Windows: the static proxy and bypass list of the system proxy settings, followed
exactly or not at all. One http or https proxy for both schemes with a bypass list
of plain hosts (host, *.example.com) is used. Anything else (different routes per
scheme, <local>, a scheme-limited or inner-wildcard bypass entry, a proxy
auto-config script, automatic detection) is
HttpError::SystemProxyUnsupported and
nothing is sent; catch it and use the mode the app used before. When nothing is
configured, and on other systems, this is ProxyMode::Environment.