#[non_exhaustive]pub enum ProxyScheme {
Http,
Https,
Socks4,
Socks4a,
Socks5,
Socks5h,
}Expand description
The wire protocol used to reach the proxy itself.
Only ever a hint: most operating system sources (the Windows registry in
particular) store a bare host:port and leave the protocol implicit.
Where a source names SOCKS without a version (GNOME’s socks child, KDE’s socksProxy
and macOS’s SOCKSProxy) this crate reports ProxyScheme::Socks5. That is a
compatibility choice and not something read out of the setting: Chromium makes the same
one and calls it a “policy decision” where it makes it, in
proxy_config_service_linux.cc. GIO chose otherwise, treating such a setting as
standing for SOCKS5, SOCKS4a and SOCKS4 alike, so a proxy that speaks only SOCKS4 is
reachable from a GIO application and not from a caller that takes this hint literally.
A version written into the value is kept: socks4://proxy.example.com in GNOME’s host
child or KDE’s socksProxy reads as Socks4, because the
readers apply their default only when the value specifies no version. Chromium reads it
the same way: “we default to socks 5, but if the user specifically set it to
socks4://, then use that”, in FixupProxyHostScheme. The native stacks do not:
glib-networking formats socks://%s:%u from the host key verbatim, and KF5-era KIO
replaces whatever scheme it finds with a bare socks://. This spelling is an escape
hatch from this crate’s default; the platform’s own resolver still sees SOCKS5 or an
invalid value.
The same word can mean different versions in different sources: a socks:// URI is SOCKS5,
while the Windows registry’s socks=host:port is read as SOCKS4. Microsoft gives that token
no version of its own, but WinINet owns the key, and the feature table in
WinINet vs. WinHTTP
grants it SOCKS4 alone: “SOCKS4 (SOCKS version 4) support. Doesn’t include v4a” is yes
for WinINet, and “SOCKS5 (SOCKS version 5) support” is no.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Http
Plain HTTP proxy (CONNECT for TLS). Default port 80.
Https
TLS-wrapped HTTP proxy. Default port 443.
Socks4
SOCKS4, names resolved locally. Default port 1080.
Socks4a
SOCKS4a, names resolved by the proxy. Default port 1080.
Socks5
SOCKS5, names resolved locally. Default port 1080.
Socks5h
SOCKS5, names resolved by the proxy. Default port 1080.