Skip to main content

ProxyMethodBuilder

Struct ProxyMethodBuilder 

Source
pub struct ProxyMethodBuilder<T, C, B = Body, Socks = ProxyMethodNotEnabled<T>, Connect = ProxyMethodNotEnabled<C>, ConnectUdp = ProxyConnectUdpNotEnabled<C, B>, Forward = ProxyMethodNotEnabled<C>> { /* private fields */ }
Available on crate features 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>

Source

pub fn configure_http_service( self, configure: impl FnOnce(&mut HttpServiceConnector<C>), ) -> Self

Configure HTTP service selection towards proxies, including attempt timeouts and budgets.

Source

pub fn without_https_discovery(self) -> Self

Available on crate feature quic only.

Disable HTTPS discovery of proxies while retaining independently configured Alt-Svc.

Source

pub fn with_https_resolver<R: DnsResolver>(self, resolver: R) -> Self

Available on crate feature quic only.

Enable HTTPS discovery of proxies with this resolver for HTTPS and A/AAAA records.

Source

pub fn configure_https_discovery( self, configure: impl FnOnce(&mut HttpsServiceLayer<BoxDnsResolver>), ) -> Self

Available on crate feature quic only.

Configure the HTTPS discovery layer towards proxies.

Source

pub fn without_alt_svc(self) -> Self

Disable advertised alternatives and response learning towards proxies.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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>

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn with_all_proxy_protocols( self, ) -> ProxyMethodBuilder<T, C, B, ProxySocksMethod<T>, HttpConnectProxyConnector<ProxyDialer<C>, ProxyRequestBody<B>>, ProxyConnectUdpMethod<C, B>, HttpForwardProxyConnector<ProxyDialer<C>>>
where T: Clone, C: Clone,

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>

Source

pub fn with_socks5( self, ) -> ProxyMethodBuilder<T, C, B, Socks5ConnectProxyConnector<ProxyDialer<T>>, Connect, ConnectUdp, Forward>
where T: Clone,

Available on crate feature socks5 only.

Reach the origin of a socks5:// or socks5h:// route over a stream its proxy opens for it.

Source

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.

Source

pub 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.

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.

Source

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.

Source

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>

Trait Implementations§

Source§

impl<T: Debug, C: Debug, B: Debug, Socks: Debug, Connect: Debug, ConnectUdp: Debug, Forward: Debug> Debug for ProxyMethodBuilder<T, C, B, Socks, Connect, ConnectUdp, Forward>

Source§

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

Formats the value using the given formatter. Read more

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>
where Forward: Send, ConnectUdp: Send, Connect: Send, Socks: Send, C: Send, T: Send, Arc<Node>: Send, Arc<Composite>: Send, Arc<dyn ExtensionsTransfer>: Send,

§

impl<T, C, B, Socks, Connect, ConnectUdp, Forward> Sync for ProxyMethodBuilder<T, C, B, Socks, Connect, ConnectUdp, Forward>
where Forward: Sync, ConnectUdp: Sync, Connect: Sync, Socks: Sync, C: Sync, T: Sync, Arc<Node>: Sync, Arc<Composite>: Sync, Arc<dyn ExtensionsTransfer>: Sync,

§

impl<T, C, B, Socks, Connect, ConnectUdp, Forward> Unpin for ProxyMethodBuilder<T, C, B, Socks, Connect, ConnectUdp, Forward>
where Forward: Unpin, ConnectUdp: Unpin, Connect: Unpin, Socks: Unpin, C: Unpin, T: Unpin, Arc<Node>: Unpin, Arc<Composite>: Unpin, Arc<dyn ExtensionsTransfer>: Unpin,

§

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§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FutureExt for T

§

fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
§

fn with_current_context(self) -> WithContext<Self> ⓘ

Attaches the current Context to this type, returning a WithContext wrapper. Read more
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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

§

fn into_request(self) -> Request<T>

Wrap the input message T in a rama_grpc::Request
§

impl<L> LayerExt<L> for L

§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
§

impl<T, U> RamaFrom<T> for U
where U: From<T>,

§

fn rama_from(value: T) -> U

§

impl<T, U, CrateMarker> RamaInto<U, CrateMarker> for T
where U: RamaFrom<T, CrateMarker>,

§

fn rama_into(self) -> U

§

impl<T, U> RamaTryFrom<T> for U
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

§

fn rama_try_from(value: T) -> Result<U, <U as RamaTryFrom<T>>::Error>

§

impl<T, U, CrateMarker> RamaTryInto<U, CrateMarker> for T
where U: RamaTryFrom<T, CrateMarker>,

§

type Error = <U as RamaTryFrom<T, CrateMarker>>::Error

§

fn rama_try_into(self) -> Result<U, <U as RamaTryFrom<T, CrateMarker>>::Error>

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<V, F> ValueFormatter<&V> for F
where F: ValueFormatter<V> + ?Sized, V: ?Sized,

§

const SHAPE: FieldShape<'static>

Available on non-metrique_require_explicit_impls only.
The shape of values produced by this formatter. Read more
§

fn format_value(writer: impl ValueWriter, value: &&V)

Write value to writer
§

impl<V, F> ValueFormatter<Arc<V>> for F
where F: ValueFormatter<V> + ?Sized, V: ?Sized,

§

const SHAPE: FieldShape<'static>

Available on non-metrique_require_explicit_impls only.
The shape of values produced by this formatter. Read more
§

fn format_value(writer: impl ValueWriter, value: &Arc<V>)

Write value to writer
§

impl<V, F> ValueFormatter<Box<V>> for F
where F: ValueFormatter<V> + ?Sized, V: ?Sized,

§

const SHAPE: FieldShape<'static>

Available on non-metrique_require_explicit_impls only.
The shape of values produced by this formatter. Read more
§

fn format_value(writer: impl ValueWriter, value: &Box<V>)

Write value to writer
§

impl<V, F> ValueFormatter<Cow<'_, V>> for F
where V: ToOwned + ?Sized, F: ValueFormatter<V> + ?Sized,

§

const SHAPE: FieldShape<'static>

Available on non-metrique_require_explicit_impls only.
The shape of values produced by this formatter. Read more
§

fn format_value(writer: impl ValueWriter, value: &Cow<'_, V>)

Write value to writer
§

impl<V, F> ValueFormatter<Option<V>> for F
where F: ValueFormatter<V> + ?Sized,

§

const SHAPE: FieldShape<'static>

Available on non-metrique_require_explicit_impls only.
The shape of values produced by this formatter. Read more
§

fn format_value(writer: impl ValueWriter, value: &Option<V>)

Write value to writer
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more