Struct Tunnel

pub struct Tunnel<C> { /* private fields */ }

Tunnel Proxy via HTTP CONNECT

This is a connector that can be used by the legacy::Client. It wraps another connector, and after getting an underlying connection, it creates an HTTP CONNECT tunnel over it.

Implementations

impl<C> Tunnel<C>

fn new(proxy_dst: Uri, connector: C) -> Self

Create a new Tunnel service.

This wraps an underlying connector, and stores the address of a tunneling proxy server.

A Tunnel can then be called with any destination. The dst passed to call will not be used to create the underlying connection, but will be used in an HTTP CONNECT request sent to the proxy destination.

fn with_auth(self, auth: HeaderValue) -> Self

Add proxy-authorization header value to the CONNECT request.

fn with_headers(self, headers: HeaderMap) -> Self

Add extra headers to be sent with the CONNECT request.

If existing headers have been set, these will be merged.

Trait Implementations

impl<C> Service<Uri> for Tunnel<C> where C: Service<Uri>, C::Future: Send + 'static, C::Response: Read + Write + Unpin + Send + 'static, C::Error: Into<Box<dyn StdError + Send + Sync>>,

type Response = <C as Service<Uri>>::Response;
type Error = TunnelError;
type Future = Tunneling<<C as Service<Uri>>::Future, <C as Service<Uri>>::Response>;
fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>>
fn call(&mut self, dst: Uri) -> Self::Future

impl<C: Clone> Clone for Tunnel<C>

fn clone(&self) -> Self

impl<C: Debug> Debug for Tunnel<C>

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

Auto Trait Implementations

impl<C> !Freeze for Tunnel<C>

impl<C> RefUnwindSafe for Tunnel<C> where C: RefUnwindSafe,

impl<C> Send for Tunnel<C> where C: Send,

impl<C> Sync for Tunnel<C> where C: Sync,

impl<C> Unpin for Tunnel<C> where C: Unpin,

impl<C> UnsafeUnpin for Tunnel<C> where C: UnsafeUnpin,

impl<C> UnwindSafe for Tunnel<C> where C: UnwindSafe,

Blanket Implementations

impl<S, T> Connect for Tunnel<C> where S: Service<Uri, Response = T> + Send + 'static, <S as Service<Uri>>::Error: Into<Box<dyn Error + Sync + Send>>, <S as Service<Uri>>::Future: Unpin + Send, T: Read + Write + Connection + Unpin + Send + 'static,

type _Svc = S;
fn connect(self, Internal, dst: Uri) -> Oneshot<S, Uri>

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

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for Tunnel<C> where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for Tunnel<C> where T: ?Sized,

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

impl<T> CloneToUninit for Tunnel<C> where T: Clone,

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

impl<T> From<T> for Tunnel<C>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> Instrument for Tunnel<C>

impl<T> ToOwned for Tunnel<C> where T: Clone,

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

impl<T> WithSubscriber for Tunnel<C>

impl<T, U> Into<U> for Tunnel<C> 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 Tunnel<C> where U: Into<T>,

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

impl<T, U> TryInto<U> for Tunnel<C> where U: TryFrom<T>,

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