#[non_exhaustive]pub enum ProxyStep {
Direct,
Http(ProxyEndpoint),
Https(ProxyEndpoint),
Socks4(ProxyEndpoint),
Socks5(ProxyEndpoint),
}resolve only.Expand description
Routing decisions, behind the resolve feature (on by default).
Routing decisions, behind the resolve feature (on by default).
Routing decisions, behind the resolve feature (on by default).
One way to reach a destination (resolve).
Names the protocol to the proxy; bare host:port → ProxyStep::Http.
Socks4a/Socks5h collapse to Socks4/Socks5;
to_url keeps socks4a/socks5h, scheme does not.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Direct
Connect directly.
Http(ProxyEndpoint)
Plain HTTP proxy (absolute-form requests, CONNECT for TLS).
Https(ProxyEndpoint)
HTTP proxy over TLS.
Socks4(ProxyEndpoint)
SOCKS4 proxy.
Socks5(ProxyEndpoint)
SOCKS5 proxy.
Implementations§
Source§impl ProxyStep
impl ProxyStep
Sourcepub fn endpoint(&self) -> Option<&ProxyEndpoint>
pub fn endpoint(&self) -> Option<&ProxyEndpoint>
The proxy endpoint, or None for ProxyStep::Direct.
Sourcepub fn to_url(&self) -> Option<Url>
pub fn to_url(&self) -> Option<Url>
Proxy URL for HTTP clients, or None for Direct.
None also when the endpoint’s host cannot be written into a URL. Host::Domain
wraps a String without validating it and Host is re-exported from the crate
root, so a hand-built endpoint can hold characters no URL host may carry; one from
ProxyEndpoint::parse cannot. Do not read None as “connect directly”:
endpoint is what answers that question.
Percent-encodes credentials (do not log), a % among them. An empty user name with
an empty password writes no userinfo, and an empty password beside a user name
writes no :; ProxyAuth::password_state still
tells the two apart. Keeps socks4a/socks5h from
ProxyEndpoint::scheme_hint, unlike scheme. HTTP 407: client
job.
let e = ProxyEndpoint::parse("socks5h://proxy.example:1080", 80).unwrap();
assert_eq!(ProxyStep::Socks5(e).to_url().unwrap().scheme(), "socks5h");
assert!(ProxyStep::Direct.to_url().is_none());