Struct Intercept

pub struct Intercept { /* private fields */ }

A matched proxy,

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

Implementations

impl Intercept

fn uri(&self) -> &Uri

Get the http::Uri for the target proxy.

fn basic_auth(&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) -> 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"));

Trait Implementations

impl Clone for Intercept

fn clone(&self) -> Intercept

impl Debug for Intercept

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

Auto Trait Implementations

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

Blanket Implementations

impl<T> Any for Intercept where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for Intercept where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for Intercept where T: ?Sized,

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

impl<T> CloneToUninit for Intercept where T: Clone,

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

impl<T> From<T> for Intercept

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> Instrument for Intercept

impl<T> ToOwned for Intercept where T: Clone,

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

impl<T> WithSubscriber for Intercept

impl<T, U> Into<U> for Intercept where U: From<T>,

fn into(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<U> for Intercept where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for Intercept where U: TryFrom<T>,

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