pub struct ProxyBuilder { /* private fields */ }Expand description
Builder for configuring a proxy.
Obtained via Proxy::builder().
Implementations§
Source§impl ProxyBuilder
impl ProxyBuilder
Sourcepub fn host(self, host: &str) -> Self
pub fn host(self, host: &str) -> Self
Set the proxy hostname
Defaults to localhost. Invalid hostnames surface in ProxyBuilder::build().
Sourcepub fn port(self, port: u16) -> Self
pub fn port(self, port: u16) -> Self
Set the proxy port
Defaults to whatever is default for the chosen ProxyProtocol.
Sourcepub fn username(self, v: &str) -> Self
pub fn username(self, v: &str) -> Self
Set the username
Defaults to none. Invalid usernames surface in ProxyBuilder::build().
Sourcepub fn password(self, v: &str) -> Self
pub fn password(self, v: &str) -> Self
Set the password
If you want to set only a password, no username, i.e. https://secret@foo.com,
you need to set it as ProxyBuilder::username().
Defaults to none. Invalid passwords surface in ProxyBuilder::build().
Sourcepub fn resolve_target(self, do_resolve: bool) -> Self
pub fn resolve_target(self, do_resolve: bool) -> Self
Whether to resolve the target host locally before calling the proxy.
true- resolve target host locally before calling proxy.false- let proxy resolve the host.
For SOCKS4, this defaults to true, for all other protocols false. I.e.
in the “normal” case, we let the proxy itself resolve host names.
Sourcepub fn no_proxy(self, expr: &str) -> Self
pub fn no_proxy(self, expr: &str) -> Self
Add a NO_PROXY expression to not route proxy through.
Correct expressions are:
example.com-> Literally matchexample.com, but notsub.example.com.example.com-> Matchsub.example.comandfoo.sub.example.com, but notexample.com.*.example.com-> Exactly like.example.com*-> Match everything
Silently ignores expressions that are not on the above form.