Struct Proxy
struct Proxy { ... }
Configuration of a proxy that a Client should pass requests to.
A Proxy has a couple pieces to it:
- a URL of how to talk to the proxy
- rules on what
Clientrequests should be directed to the proxy
For instance, let's look at Proxy::http:
#
This proxy will intercept all HTTP requests, and make use of the proxy
at https://secure.example. A request to http://hyper.rs will talk
to your proxy. A request to https://hyper.rs will not.
Multiple Proxy rules can be configured for a Client. The Client will
check each Proxy in the order it was added. This could mean that a
Proxy added first with eager intercept rules, such as Proxy::all,
would prevent a Proxy later in the list from ever working, so take care.
By enabling the "socks" feature it is possible to use a socks proxy:
#
Implementations
impl Proxy
fn http<U: IntoProxy>(proxy_scheme: U) -> Result<Proxy>Proxy all HTTP traffic to the passed URL.
Example
# extern crate reqwest; # #fn https<U: IntoProxy>(proxy_scheme: U) -> Result<Proxy>Proxy all HTTPS traffic to the passed URL.
Example
# extern crate reqwest; # #fn all<U: IntoProxy>(proxy_scheme: U) -> Result<Proxy>Proxy all traffic to the passed URL.
"All" refers to
httpsandhttpURLs. Other schemes are not recognized by reqwest.Example
# extern crate reqwest; # #fn custom<F, U: IntoProxy>(fun: F) -> Proxy where F: Fn(&Url) -> Option<U> + Send + Sync + 'staticProvide a custom function to determine what traffic to proxy to where.
Example
# extern crate reqwest; # #fn basic_auth(self: Self, username: &str, password: &str) -> ProxySet the
Proxy-Authorizationheader using Basic auth.Example
# extern crate reqwest; # #fn custom_http_auth(self: Self, header_value: HeaderValue) -> ProxySet the
Proxy-Authorizationheader to a specified value.Example
# extern crate reqwest; # use *; # #fn headers(self: Self, headers: HeaderMap) -> ProxyAdds a Custom Headers to Proxy Adds custom headers to this Proxy
Example
# extern crate reqwest; # use *; # #fn no_proxy(self: Self, no_proxy: Option<NoProxy>) -> ProxyAdds a
No Proxyexclusion list to this ProxyExample
# extern crate reqwest; # #
impl Clone for Proxy
fn clone(self: &Self) -> Proxy
impl Debug for Proxy
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl Freeze for Proxy
impl RefUnwindSafe for Proxy
impl Send for Proxy
impl Sync for Proxy
impl Unpin for Proxy
impl UnsafeUnpin for Proxy
impl UnwindSafe for Proxy
impl<T> Any for Proxy
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for Proxy
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for Proxy
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for Proxy
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> ErasedDestructor for Proxy
impl<T> From for Proxy
fn from(t: T) -> TReturns the argument unchanged.
impl<T> Instrument for Proxy
impl<T> PolicyExt for Proxy
fn and<P, B, E>(self: Self, other: P) -> And<T, P> where T: Policy<B, E>, P: Policy<B, E>fn or<P, B, E>(self: Self, other: P) -> Or<T, P> where T: Policy<B, E>, P: Policy<B, E>
impl<T> ToOwned for Proxy
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T> WithSubscriber for Proxy
impl<T, U> Into for Proxy
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for Proxy
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for Proxy
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>