pub struct Tunnel<C> { /* private fields */ }
Expand description
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§
Source§impl<C> Tunnel<C>
impl<C> Tunnel<C>
Sourcepub fn new(proxy_dst: Uri, connector: C) -> Self
pub 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.
Sourcepub fn with_auth(self, auth: HeaderValue) -> Self
pub fn with_auth(self, auth: HeaderValue) -> Self
Add proxy-authorization
header value to the CONNECT request.
Sourcepub fn with_headers(self, headers: HeaderMap) -> Self
pub 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§
Source§impl<C> Service<Uri> for Tunnel<C>
impl<C> Service<Uri> for Tunnel<C>
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> UnwindSafe for Tunnel<C>where
C: UnwindSafe,
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