pub struct Proxy { /* private fields */ }Expand description
Proxy server settings
Implementations§
Source§impl Proxy
impl Proxy
Sourcepub fn new(proxy: &str) -> Result<Self, Error>
pub fn new(proxy: &str) -> Result<Self, Error>
Create a proxy from a uri.
§Arguments:
proxy- a str of format<protocol>://<user>:<password>@<host>:port. All parts except host are optional.
§Protocols
http: HTTP CONNECT proxyhttps: HTTPS CONNECT proxy (requires a TLS provider)socks4: SOCKS4 (requires socks-proxy feature)socks4a: SOCKS4A (requires socks-proxy feature)socks5andsocks: SOCKS5 (requires socks-proxy feature)
§Examples proxy formats
http://127.0.0.1:8080socks5://john:smith@socks.google.comjohn:smith@socks.google.com:8000localhost
Sourcepub fn try_from_env() -> Option<Self>
pub fn try_from_env() -> Option<Self>
Read proxy settings from environment variables.
The environment variable is expected to contain a proxy URI. The following environment variables are attempted:
ALL_PROXYHTTPS_PROXYHTTP_PROXY
Returns None if no environment variable is set or the URI is invalid.
Sourcepub fn is_from_env(&self) -> bool
pub fn is_from_env(&self) -> bool
Whether this proxy setting was created manually or from environment variables.
Trait Implementations§
impl Eq for Proxy
impl StructuralPartialEq for Proxy
Auto Trait Implementations§
impl Freeze for Proxy
impl RefUnwindSafe for Proxy
impl Send for Proxy
impl Sync for Proxy
impl Unpin for Proxy
impl UnwindSafe for Proxy
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.