Struct Intercept

struct Intercept { ... }

A matched proxy,

This is returned by a matcher if a proxy should be used.

Implementations

impl Intercept

fn uri(self: &Self) -> &Uri

Get the http::Uri for the target proxy.

fn basic_auth(self: &Self) -> Option<&HeaderValue>

Get any configured basic authorization.

This should usually be used with a Proxy-Authorization header, to send in Basic format.

Example

# use hyper_util::client::proxy::matcher::Matcher;
# let uri = http::Uri::from_static("https://hyper.rs");
let m = Matcher::builder()
    .all("https://Aladdin:opensesame@localhost:8887")
    .build();

let proxy = m.intercept(&uri).expect("example");
let auth = proxy.basic_auth().expect("example");
assert_eq!(auth, "Basic QWxhZGRpbjpvcGVuc2VzYW1l");
fn raw_auth(self: &Self) -> Option<(&str, &str)>

Get any configured raw authorization.

If not detected as another scheme, this is the username and password that should be sent with whatever protocol the proxy handshake uses.

Example

# use hyper_util::client::proxy::matcher::Matcher;
# let uri = http::Uri::from_static("https://hyper.rs");
let m = Matcher::builder()
    .all("socks5h://Aladdin:opensesame@localhost:8887")
    .build();

let proxy = m.intercept(&uri).expect("example");
let auth = proxy.raw_auth().expect("example");
assert_eq!(auth, ("Aladdin", "opensesame"));

impl Clone for Intercept

fn clone(self: &Self) -> Intercept

impl Debug for Intercept

fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result

impl Freeze for Intercept

impl RefUnwindSafe for Intercept

impl Send for Intercept

impl Sync for Intercept

impl Unpin for Intercept

impl UnsafeUnpin for Intercept

impl UnwindSafe for Intercept

impl<T> Any for Intercept

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for Intercept

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for Intercept

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> CloneToUninit for Intercept

unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)

impl<T> From for Intercept

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> Instrument for Intercept

impl<T> ToOwned for Intercept

fn to_owned(self: &Self) -> T
fn clone_into(self: &Self, target: &mut T)

impl<T> WithSubscriber for Intercept

impl<T, U> Into for Intercept

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for Intercept

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for Intercept

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>