Struct HttpConnectProxyConnector
pub struct HttpConnectProxyConnector<S, B = ProxyRequestBody<Body>> { /* private fields */ }dns and http-backend and http and std and tcp only.Expand description
A connector which establishes a tunnel over an HTTP proxy with CONNECT.
A proxy is required: a request without a proxied ProxyRoute fails. Pair it with
MaybeProxiedConnector to connect directly instead when no proxy is requested.
The inner service dials the HTTP connection to the proxy, such as a ProxyDialer
over the connector towards proxies, and CONNECT is exchanged over it. The version
spoken is the one on the ProxyAddress, or the one negotiated when it names none,
and TLS to the proxy is the connector towards proxies’ business.
B is the body type of the connections towards the proxy: the CONNECT request carries
its empty Default value.
Implementations§
§impl<S, B> HttpConnectProxyConnector<ProxyDialer<S>, B>
impl<S, B> HttpConnectProxyConnector<ProxyDialer<S>, B>
pub fn new(inner: S) -> HttpConnectProxyConnector<ProxyDialer<S>, B>
pub fn new(inner: S) -> HttpConnectProxyConnector<ProxyDialer<S>, B>
Creates a new HttpConnectProxyConnector over the given connector towards the proxy.
§impl<S, B> HttpConnectProxyConnector<S, B>
impl<S, B> HttpConnectProxyConnector<S, B>
pub fn from_dialer(dialer: S) -> HttpConnectProxyConnector<S, B>
pub fn from_dialer(dialer: S) -> HttpConnectProxyConnector<S, B>
Creates a new HttpConnectProxyConnector over the connections to the proxy that
dialer dials, see ProxyDialer.
pub fn with_custom_header(
self,
name: impl IntoHeaderName,
value: HeaderValue,
) -> HttpConnectProxyConnector<S, B>
pub fn with_custom_header( self, name: impl IntoHeaderName, value: HeaderValue, ) -> HttpConnectProxyConnector<S, B>
Set a header on every CONNECT request this connector sends.
A name set more than once keeps the last value.
pub fn set_custom_header(
&mut self,
name: impl IntoHeaderName,
value: HeaderValue,
) -> &mut HttpConnectProxyConnector<S, B>
pub fn set_custom_header( &mut self, name: impl IntoHeaderName, value: HeaderValue, ) -> &mut HttpConnectProxyConnector<S, B>
Set a header on every CONNECT request this connector sends.
A name set more than once keeps the last value.
pub fn with_extensions_transfer(
self,
transfer: impl ExtensionsTransfer,
) -> HttpConnectProxyConnector<S, B>
pub fn with_extensions_transfer( self, transfer: impl ExtensionsTransfer, ) -> HttpConnectProxyConnector<S, B>
Set what a CONNECT tunnel keeps from the proxy connection it is nested on.
Defaults to DefaultExtensionsTransfer. Chain transfers with
ExtensionsTransfer::and to also carry your own connection-scoped
extension types across the tunnel.
pub fn set_extensions_transfer(
&mut self,
transfer: impl ExtensionsTransfer,
) -> &mut HttpConnectProxyConnector<S, B>
pub fn set_extensions_transfer( &mut self, transfer: impl ExtensionsTransfer, ) -> &mut HttpConnectProxyConnector<S, B>
Set what a CONNECT tunnel keeps from the proxy connection it is nested on.
Defaults to DefaultExtensionsTransfer. Chain transfers with
ExtensionsTransfer::and to also carry your own connection-scoped
extension types across the tunnel.
pub fn into_inner(self) -> S
pub fn into_inner(self) -> S
Consumes self, returning the underlying service.
Trait Implementations§
§impl<S, B> Clone for HttpConnectProxyConnector<S, B>where
S: Clone,
impl<S, B> Clone for HttpConnectProxyConnector<S, B>where
S: Clone,
§fn clone(&self) -> HttpConnectProxyConnector<S, B>
fn clone(&self) -> HttpConnectProxyConnector<S, B>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl<S, B> Debug for HttpConnectProxyConnector<S, B>where
S: Debug,
impl<S, B> Debug for HttpConnectProxyConnector<S, B>where
S: Debug,
§impl<S, B> ExtensionsRef for HttpConnectProxyConnector<S, B>where
S: ExtensionsRef,
impl<S, B> ExtensionsRef for HttpConnectProxyConnector<S, B>where
S: ExtensionsRef,
§fn extensions(&self) -> &Extensions
fn extensions(&self) -> &Extensions
Extensions store§impl<S, B, Input> Service<Input> for HttpConnectProxyConnector<S, B>where
S: ConnectorService<ProxyDialRequest>,
<S as ConnectorService<ProxyDialRequest>>::Connection: Service<Request<B>, Output = Response> + 'static,
<<S as ConnectorService<ProxyDialRequest>>::Connection as Service<Request<B>>>::Error: Into<Box<dyn Error + Send + Sync>>,
B: Default + Send + 'static,
Input: ConnectorTargetInputExt + ProtocolInputExt + HttpVersionInputExt + TargetHttpVersionInputExt + Send + 'static,
impl<S, B, Input> Service<Input> for HttpConnectProxyConnector<S, B>where
S: ConnectorService<ProxyDialRequest>,
<S as ConnectorService<ProxyDialRequest>>::Connection: Service<Request<B>, Output = Response> + 'static,
<<S as ConnectorService<ProxyDialRequest>>::Connection as Service<Request<B>>>::Error: Into<Box<dyn Error + Send + Sync>>,
B: Default + Send + 'static,
Input: ConnectorTargetInputExt + ProtocolInputExt + HttpVersionInputExt + TargetHttpVersionInputExt + Send + 'static,
§type Output = EstablishedClientConnection<Upgraded, Input>
type Output = EstablishedClientConnection<Upgraded, Input>
§type Error = ConnectionError
type Error = ConnectionError
§async fn serve(
&self,
input: Input,
) -> Result<<HttpConnectProxyConnector<S, B> as Service<Input>>::Output, <HttpConnectProxyConnector<S, B> as Service<Input>>::Error>
async fn serve( &self, input: Input, ) -> Result<<HttpConnectProxyConnector<S, B> as Service<Input>>::Output, <HttpConnectProxyConnector<S, B> as Service<Input>>::Error>
§fn boxed(self) -> BoxService<Input, Self::Output, Self::Error>
fn boxed(self) -> BoxService<Input, Self::Output, Self::Error>
Auto Trait Implementations§
impl<S, B = ProxyRequestBody<Body>> !RefUnwindSafe for HttpConnectProxyConnector<S, B>
impl<S, B = ProxyRequestBody<Body>> !UnwindSafe for HttpConnectProxyConnector<S, B>
impl<S, B> Forget for HttpConnectProxyConnector<S, B>
impl<S, B> Freeze for HttpConnectProxyConnector<S, B>
impl<S, B> Move for HttpConnectProxyConnector<S, B>
impl<S, B> Send for HttpConnectProxyConnector<S, B>
impl<S, B> Sync for HttpConnectProxyConnector<S, B>
impl<S, B> Unpin for HttpConnectProxyConnector<S, B>
impl<S, B> UnsafeUnpin for HttpConnectProxyConnector<S, B>
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<S, Input, Connection> ConnectorService<Input> for Swhere
S: Service<Input, Output = EstablishedClientConnection<Connection, Input>>,
<S as Service<Input>>::Error: Into<ConnectionError>,
Connection: Send + ExtensionsRef,
impl<S, Input, Connection> ConnectorService<Input> for Swhere
S: Service<Input, Output = EstablishedClientConnection<Connection, Input>>,
<S as Service<Input>>::Error: Into<ConnectionError>,
Connection: Send + ExtensionsRef,
§type Connection = Connection
type Connection = Connection
ConnectorService§fn connect(
&self,
input: Input,
) -> impl Future<Output = Result<EstablishedClientConnection<<S as ConnectorService<Input>>::Connection, Input>, ConnectionError>> + Send
fn connect( &self, input: Input, ) -> impl Future<Output = Result<EstablishedClientConnection<<S as ConnectorService<Input>>::Connection, Input>, ConnectionError>> + Send
§impl<T> ForwardedClientExt for Twhere
T: ExtensionsRef + ?Sized,
impl<T> ForwardedClientExt for Twhere
T: ExtensionsRef + ?Sized,
§fn trusted_forwarded(&self) -> Option<&Forwarded>
fn trusted_forwarded(&self) -> Option<&Forwarded>
§fn forwarded_client(&self) -> Option<&ForwardedElement>
fn forwarded_client(&self) -> Option<&ForwardedElement>
§fn forwarded_client_ip(&self) -> Option<IpAddr>
fn forwarded_client_ip(&self) -> Option<IpAddr>
for node.§fn forwarded_client_socket_addr(&self) -> Option<SocketAddress>
fn forwarded_client_socket_addr(&self) -> Option<SocketAddress>
for node.§fn forwarded_client_host(&self) -> Option<&ForwardedAuthority>
fn forwarded_client_host(&self) -> Option<&ForwardedAuthority>
§fn forwarded_client_proto(&self) -> Option<ForwardedProtocol>
fn forwarded_client_proto(&self) -> Option<ForwardedProtocol>
§fn forwarded_client_version(&self) -> Option<ForwardedVersion>
fn forwarded_client_version(&self) -> Option<ForwardedVersion>
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<S> IntoEndpointService<(S,)> for S
impl<S> IntoEndpointService<(S,)> for S
type Service = S
§fn into_endpoint_service(self) -> <S as IntoEndpointService<(S,)>>::Service
fn into_endpoint_service(self) -> <S as IntoEndpointService<(S,)>>::Service
rama_core::Service.§impl<S, State> IntoEndpointServiceWithState<(S,), State> for S
impl<S, State> IntoEndpointServiceWithState<(S,), State> for S
type Service = S
§fn into_endpoint_service_with_state(
self,
_state: State,
) -> <S as IntoEndpointServiceWithState<(S,), State>>::Service
fn into_endpoint_service_with_state( self, _state: State, ) -> <S as IntoEndpointServiceWithState<(S,), State>>::Service
rama_core::Service with state.§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a rama_grpc::Request§impl<Io, S> MakeMockServer<Io, ServerClone> for S
impl<Io, S> MakeMockServer<Io, ServerClone> for S
type Server = S
fn make_server(&self, _: &ConnectRequest) -> S
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Policy that returns Action::Follow only if self and other return
Action::Follow. Read more