pub enum ProxyConfig {
Automatic,
Direct,
HttpConnect {
host: String,
port: u16,
tls: bool,
basic_auth: Option<String>,
},
Socks5 {
host: String,
port: u16,
auth: Option<(String, String)>,
remote_dns: bool,
},
}Expand description
How to reach the upstream server.
Variants§
Automatic
Resolve shared environment/native policy for the destination at setup.
Direct
Connect directly to the target.
HttpConnect
Tunnel through an HTTP(S) proxy using CONNECT.
Fields
Socks5
Tunnel through a SOCKS5 proxy.
Implementations§
Source§impl ProxyConfig
impl ProxyConfig
Sourcepub fn from_env(target_host: &str) -> Result<Self, Error>
Available on crate feature std only.
pub fn from_env(target_host: &str) -> Result<Self, Error>
std only.Resolves shared environment/native proxy policy for an HTTPS host.
Uppercase variables take precedence, including empty values. Honors
native exclusions, NO_PROXY domains/IPs/CIDRs/*, and CGI protection.
The returned route is scoped to this host on port 443. For a URL with
a different scheme/port or local overrides, use Self::from_options.
Sourcepub fn from_options(
target: &Url,
options: &UpstreamProxyOptions,
) -> Result<Self, Error>
Available on crate feature std only.
pub fn from_options( target: &Url, options: &UpstreamProxyOptions, ) -> Result<Self, Error>
std only.Resolves a route for one origin using shared proxy selection and bypass options. Use the returned configuration only for this origin.
Discovery/validation errors propagate. A selected protocol unsupported by this connector (currently SOCKS4/4a) returns an explicit error.
Sourcepub fn parse(input: &str) -> Result<Self, Error>
pub fn parse(input: &str) -> Result<Self, Error>
Parses a proxy URL such as http://user:pass@host:port or
socks5h://host:port.
Produces an explicit route with no inherited bypass rules. URL syntax
uses shared validation; paths, queries, fragments, and port zero fail.
Use Self::Automatic or, with std, from_options for bypass policy.
Trait Implementations§
Source§impl Clone for ProxyConfig
impl Clone for ProxyConfig
Source§impl Debug for ProxyConfig
impl Debug for ProxyConfig
Auto Trait Implementations§
impl Forget for ProxyConfig
impl Freeze for ProxyConfig
impl Move for ProxyConfig
impl RefUnwindSafe for ProxyConfig
impl Send for ProxyConfig
impl Sync for ProxyConfig
impl Unpin for ProxyConfig
impl UnsafeUnpin for ProxyConfig
impl UnwindSafe for ProxyConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more