pub struct ProxyMethodBuilder<T, C, B = Body, Socks = ProxyMethodNotEnabled<T>, Connect = ProxyMethodNotEnabled<C>, ConnectUdp = ProxyConnectUdpNotEnabled<C, B>, Forward = ProxyMethodNotEnabled<C>> { /* private fields */ }dns and http-backend and http and std and tcp only.Expand description
The proxy methods of a ProxyConnector, over the connections towards proxies an
ProxyConnectorBuilder built: T dials a stream to a proxy, C speaks HTTP to
one in the body type B.
A method which is not enabled refuses the routes asking for it.
Implementations§
Source§impl<T, C, B> ProxyMethodBuilder<T, ProxyServiceConnector<C>, B>
impl<T, C, B> ProxyMethodBuilder<T, ProxyServiceConnector<C>, B>
Sourcepub fn configure_http_service(
self,
configure: impl FnOnce(&mut HttpServiceConnector<C>),
) -> Self
pub fn configure_http_service( self, configure: impl FnOnce(&mut HttpServiceConnector<C>), ) -> Self
Configure HTTP service selection towards proxies, including attempt timeouts and budgets.
Sourcepub fn without_https_discovery(self) -> Self
Available on crate feature quic only.
pub fn without_https_discovery(self) -> Self
quic only.Disable HTTPS discovery of proxies while retaining independently configured Alt-Svc.
Sourcepub fn with_https_resolver<R: DnsResolver>(self, resolver: R) -> Self
Available on crate feature quic only.
pub fn with_https_resolver<R: DnsResolver>(self, resolver: R) -> Self
quic only.Enable HTTPS discovery of proxies with this resolver for HTTPS and A/AAAA records.
Sourcepub fn configure_https_discovery(
self,
configure: impl FnOnce(&mut HttpsServiceLayer<BoxDnsResolver>),
) -> Self
Available on crate feature quic only.
pub fn configure_https_discovery( self, configure: impl FnOnce(&mut HttpsServiceLayer<BoxDnsResolver>), ) -> Self
quic only.Configure the HTTPS discovery layer towards proxies.
Sourcepub fn without_alt_svc(self) -> Self
pub fn without_alt_svc(self) -> Self
Disable advertised alternatives and response learning towards proxies.
Sourcepub fn maybe_with_alt_svc_cache(self, cache: Option<AltSvcCache>) -> Self
pub fn maybe_with_alt_svc_cache(self, cache: Option<AltSvcCache>) -> Self
The Alt-Svc cache of the connections towards proxies; None disables Alt-Svc
only. HTTPS-record discovery is configured separately.
Sourcepub fn maybe_set_alt_svc_cache(
&mut self,
cache: Option<AltSvcCache>,
) -> &mut Self
pub fn maybe_set_alt_svc_cache( &mut self, cache: Option<AltSvcCache>, ) -> &mut Self
The Alt-Svc cache of the connections towards proxies; None disables Alt-Svc
only. HTTPS-record discovery is configured separately.
Sourcepub fn with_alt_svc_cache(self, cache: AltSvcCache) -> Self
pub fn with_alt_svc_cache(self, cache: AltSvcCache) -> Self
The Alt-Svc cache of the connections towards proxies; None disables Alt-Svc
only. HTTPS-record discovery is configured separately.
Sourcepub fn set_alt_svc_cache(&mut self, cache: AltSvcCache) -> &mut Self
pub fn set_alt_svc_cache(&mut self, cache: AltSvcCache) -> &mut Self
The Alt-Svc cache of the connections towards proxies; None disables Alt-Svc
only. HTTPS-record discovery is configured separately.
Sourcepub fn without_alt_svc_cache(self) -> Self
pub fn without_alt_svc_cache(self) -> Self
The Alt-Svc cache of the connections towards proxies; None disables Alt-Svc
only. HTTPS-record discovery is configured separately.
Sourcepub fn unset_alt_svc_cache(&mut self) -> &mut Self
pub fn unset_alt_svc_cache(&mut self) -> &mut Self
The Alt-Svc cache of the connections towards proxies; None disables Alt-Svc
only. HTTPS-record discovery is configured separately.
Source§impl<T, C, B> ProxyMethodBuilder<T, C, B>
impl<T, C, B> ProxyMethodBuilder<T, C, B>
Sourcepub fn with_custom_connector<L: Layer<C>>(
self,
connector_layer: L,
) -> ProxyMethodBuilder<T, L::Service, B>
pub fn with_custom_connector<L: Layer<C>>( self, connector_layer: L, ) -> ProxyMethodBuilder<T, L::Service, B>
Add a custom connector around the HTTP connector towards proxies that the HTTP proxy methods added next share: above the pool when there is one.
It runs for every dial, so a layer that sets a
ConnectorTarget, such as a load balancer,
decides which pooled connection a dial gets: the pool keys on it. Such a target is an
explicit endpoint, so HTTPS discovery and Alt-Svc are skipped for it.
Configure HTTP service selection, HTTPS discovery and Alt-Svc
(configure_http_service, without_https_discovery, alt_svc_cache and the like)
before this call: they are not available after it.
Sourcepub fn map_connector<C2>(
self,
map_fn: impl FnOnce(C) -> C2,
) -> ProxyMethodBuilder<T, C2, B>
pub fn map_connector<C2>( self, map_fn: impl FnOnce(C) -> C2, ) -> ProxyMethodBuilder<T, C2, B>
Map the HTTP connector towards proxies; see Self::with_custom_connector.
Sourcepub fn with_extensions_transfer(self, transfer: impl ExtensionsTransfer) -> Self
pub fn with_extensions_transfer(self, transfer: impl ExtensionsTransfer) -> Self
Set what a tunnel opened by any of the methods added next 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 every tunnel.
Sourcepub fn set_extensions_transfer(
&mut self,
transfer: impl ExtensionsTransfer,
) -> &mut Self
pub fn set_extensions_transfer( &mut self, transfer: impl ExtensionsTransfer, ) -> &mut Self
Set what a tunnel opened by any of the methods added next 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 every tunnel.
Sourcepub fn with_all_proxy_protocols(
self,
) -> ProxyMethodBuilder<T, C, B, ProxySocksMethod<T>, HttpConnectProxyConnector<ProxyDialer<C>, ProxyRequestBody<B>>, ProxyConnectUdpMethod<C, B>, HttpForwardProxyConnector<ProxyDialer<C>>>
pub fn with_all_proxy_protocols( self, ) -> ProxyMethodBuilder<T, C, B, ProxySocksMethod<T>, HttpConnectProxyConnector<ProxyDialer<C>, ProxyRequestBody<B>>, ProxyConnectUdpMethod<C, B>, HttpForwardProxyConnector<ProxyDialer<C>>>
Support every proxy protocol this build of rama has, with its defaults: SOCKS5
(socks5 feature), HTTP CONNECT and forwarding, and CONNECT-UDP (masque and
quic features). Pick a subset with with_socks5, with_http_connect,
with_http_forward and with_http_connect_udp.
Source§impl<T, C, B, Socks, Connect, ConnectUdp, Forward> ProxyMethodBuilder<T, C, B, Socks, Connect, ConnectUdp, Forward>
impl<T, C, B, Socks, Connect, ConnectUdp, Forward> ProxyMethodBuilder<T, C, B, Socks, Connect, ConnectUdp, Forward>
Sourcepub fn with_socks5(
self,
) -> ProxyMethodBuilder<T, C, B, Socks5ConnectProxyConnector<ProxyDialer<T>>, Connect, ConnectUdp, Forward>where
T: Clone,
Available on crate feature socks5 only.
pub fn with_socks5(
self,
) -> ProxyMethodBuilder<T, C, B, Socks5ConnectProxyConnector<ProxyDialer<T>>, Connect, ConnectUdp, Forward>where
T: Clone,
socks5 only.Reach the origin of a socks5:// or socks5h:// route over a stream its proxy
opens for it.
Sourcepub fn with_http_connect(
self,
) -> ProxyMethodBuilder<T, C, B, Socks, HttpConnectProxyConnector<ProxyDialer<C>, ProxyRequestBody<B>>, ConnectUdp, Forward>where
C: Clone,
pub fn with_http_connect(
self,
) -> ProxyMethodBuilder<T, C, B, Socks, HttpConnectProxyConnector<ProxyDialer<C>, ProxyRequestBody<B>>, ConnectUdp, Forward>where
C: Clone,
Open a tunnel to the origin over an HTTP proxy with CONNECT.
Sourcepub fn with_http_connect_udp(
self,
) -> ProxyMethodBuilder<T, C, B, Socks, Connect, ProxyConnectUdpMethod<C, B>, Forward>where
C: Clone,
Available on crate features masque and quic only.
pub fn with_http_connect_udp(
self,
) -> ProxyMethodBuilder<T, C, B, Socks, Connect, ProxyConnectUdpMethod<C, B>, Forward>where
C: Clone,
masque and quic only.Open a datagram tunnel to the origin over an HTTP proxy with CONNECT-UDP (RFC 9298), for the QUIC endpoint of an HTTP/3 origin reached through one. Every other datagram request takes a UDP socket of its own.
Sourcepub fn with_http_forward(
self,
) -> ProxyMethodBuilder<T, C, B, Socks, Connect, ConnectUdp, HttpForwardProxyConnector<ProxyDialer<C>>>where
C: Clone,
pub fn with_http_forward(
self,
) -> ProxyMethodBuilder<T, C, B, Socks, Connect, ConnectUdp, HttpForwardProxyConnector<ProxyDialer<C>>>where
C: Clone,
Have an HTTP proxy forward a plaintext request to its origin, over the HTTP connection to that proxy.
Sourcepub fn build(self) -> ProxyConnector<Socks, Connect, ConnectUdp, Forward>
pub fn build(self) -> ProxyConnector<Socks, Connect, ConnectUdp, Forward>
The ProxyConnector of the methods enabled so far.
Source§impl<T, C, B, Socks, ConnectUdp, Forward> ProxyMethodBuilder<T, C, B, Socks, HttpConnectProxyConnector<ProxyDialer<C>, ProxyRequestBody<B>>, ConnectUdp, Forward>
impl<T, C, B, Socks, ConnectUdp, Forward> ProxyMethodBuilder<T, C, B, Socks, HttpConnectProxyConnector<ProxyDialer<C>, ProxyRequestBody<B>>, ConnectUdp, Forward>
Sourcepub fn with_connect_custom_header(
self,
name: impl IntoHeaderName,
value: HeaderValue,
) -> Self
pub fn with_connect_custom_header( self, name: impl IntoHeaderName, value: HeaderValue, ) -> Self
Trait Implementations§
Auto Trait Implementations§
impl<T, C, B = Body, Socks = ProxyMethodNotEnabled<T>, Connect = ProxyMethodNotEnabled<C>, ConnectUdp = MaybeProxiedConnector<UdpConnector, HttpConnectUdpProxyConnector<ProxyDialer<ProxyMethodNotEnabled<C>>, ProxyRequestBody<B>>, ProxiedRoute>, Forward = ProxyMethodNotEnabled<C>> !RefUnwindSafe for ProxyMethodBuilder<T, C, B, Socks, Connect, ConnectUdp, Forward>
impl<T, C, B = Body, Socks = ProxyMethodNotEnabled<T>, Connect = ProxyMethodNotEnabled<C>, ConnectUdp = MaybeProxiedConnector<UdpConnector, HttpConnectUdpProxyConnector<ProxyDialer<ProxyMethodNotEnabled<C>>, ProxyRequestBody<B>>, ProxiedRoute>, Forward = ProxyMethodNotEnabled<C>> !UnwindSafe for ProxyMethodBuilder<T, C, B, Socks, Connect, ConnectUdp, Forward>
impl<T, C, B, Socks, Connect, ConnectUdp, Forward> Forget for ProxyMethodBuilder<T, C, B, Socks, Connect, ConnectUdp, Forward>
impl<T, C, B, Socks, Connect, ConnectUdp, Forward> Freeze for ProxyMethodBuilder<T, C, B, Socks, Connect, ConnectUdp, Forward>where
T: Freeze,
C: Freeze,
*const ArcInner<Node> is !null: Freeze,
PhantomData<ArcInner<Node>>: Freeze,
*const ArcInner<Composite> is !null: Freeze,
PhantomData<ArcInner<Composite>>: Freeze,
Socks: Freeze,
Connect: Freeze,
ConnectUdp: Freeze,
Forward: Freeze,
*const ArcInner<dyn ExtensionsTransfer> is !null: Freeze,
PhantomData<ArcInner<dyn ExtensionsTransfer>>: Freeze,
PhantomData<fn() -> B>: Freeze,
impl<T, C, B, Socks, Connect, ConnectUdp, Forward> Move for ProxyMethodBuilder<T, C, B, Socks, Connect, ConnectUdp, Forward>
impl<T, C, B, Socks, Connect, ConnectUdp, Forward> Send for ProxyMethodBuilder<T, C, B, Socks, Connect, ConnectUdp, Forward>
impl<T, C, B, Socks, Connect, ConnectUdp, Forward> Sync for ProxyMethodBuilder<T, C, B, Socks, Connect, ConnectUdp, Forward>
impl<T, C, B, Socks, Connect, ConnectUdp, Forward> Unpin for ProxyMethodBuilder<T, C, B, Socks, Connect, ConnectUdp, Forward>
impl<T, C, B, Socks, Connect, ConnectUdp, Forward> UnsafeUnpin for ProxyMethodBuilder<T, C, B, Socks, Connect, ConnectUdp, Forward>where
T: UnsafeUnpin,
C: UnsafeUnpin,
*const ArcInner<Node> is !null: UnsafeUnpin,
PhantomData<ArcInner<Node>>: UnsafeUnpin,
*const ArcInner<Composite> is !null: UnsafeUnpin,
PhantomData<ArcInner<Composite>>: UnsafeUnpin,
Socks: UnsafeUnpin,
Connect: UnsafeUnpin,
ConnectUdp: UnsafeUnpin,
Forward: UnsafeUnpin,
*const ArcInner<dyn ExtensionsTransfer> is !null: UnsafeUnpin,
PhantomData<ArcInner<dyn ExtensionsTransfer>>: UnsafeUnpin,
PhantomData<fn() -> B>: UnsafeUnpin,
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
§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<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<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