EasyHttpConnectorBuilder

Struct EasyHttpConnectorBuilder 

Source
pub struct EasyHttpConnectorBuilder<C = (), S = ()> { /* private fields */ }
Available on crate features http and http-full only.
Expand description

Builder that is designed to easily create a connoector for super::EasyHttpWebClient from most basic use cases

Implementations§

Source§

impl EasyHttpConnectorBuilder

Source

pub fn new() -> Self

Source

pub fn with_default_transport_connector( self, ) -> EasyHttpConnectorBuilder<TcpConnector, TransportStage>

Source

pub fn with_custom_transport_connector<C>( self, connector: C, ) -> EasyHttpConnectorBuilder<C, TransportStage>

Add a custom transport connector that will be used by this client for the transport layer

Source§

impl<T, Stage> EasyHttpConnectorBuilder<T, Stage>

Source

pub fn with_custom_connector<L>( self, connector_layer: L, ) -> EasyHttpConnectorBuilder<L::Service, Stage>
where L: Layer<T>,

Add a custom connector to this Stage.

Adding a custom connector to a stage will not change the state so this can be used to modify behaviour at a specific stage.

Source§

impl EasyHttpConnectorBuilder<TcpConnector, TransportStage>

Source

pub fn with_dns_resolver<T: DnsResolver + Clone>( self, resolver: T, ) -> EasyHttpConnectorBuilder<TcpConnector<T>, TransportStage>

Add a custom DnsResolver that will be used by this client

Source§

impl<T> EasyHttpConnectorBuilder<T, TransportStage>

Source

pub fn with_custom_tls_proxy_connector<L>( self, connector_layer: L, ) -> EasyHttpConnectorBuilder<L::Service, ProxyTunnelStage>
where L: Layer<T>,

Available on crate features rustls or boring only.

Add a custom proxy tls connector that will be used to setup a tls connection to the proxy

Source

pub fn with_tls_proxy_support_using_boringssl( self, ) -> EasyHttpConnectorBuilder<TlsConnector<T, ConnectorKindTunnel>, ProxyTunnelStage>

Available on crate feature boring only.

Support a tls tunnel to the proxy itself using boringssl

Note that a tls proxy is not needed to make a https connection to the final target. It only has an influence on the initial connection to the proxy itself

Source

pub fn with_tls_proxy_support_using_boringssl_config( self, config: Arc<TlsConnectorDataBuilder>, ) -> EasyHttpConnectorBuilder<TlsConnector<T, ConnectorKindTunnel>, ProxyTunnelStage>

Available on crate feature boring only.

Support a tls tunnel to the proxy itself using boringssl and the provided config

Note that a tls proxy is not needed to make a https connection to the final target. It only has an influence on the initial connection to the proxy itself

Source

pub fn with_tls_proxy_support_using_rustls( self, ) -> EasyHttpConnectorBuilder<TlsConnector<T, ConnectorKindTunnel>, ProxyTunnelStage>

Available on crate feature rustls only.

Support a tls tunnel to the proxy itself using rustls

Note that a tls proxy is not needed to make a https connection to the final target. It only has an influence on the initial connection to the proxy itself

Source

pub fn with_tls_proxy_support_using_rustls_config( self, config: TlsConnectorData, ) -> EasyHttpConnectorBuilder<TlsConnector<T, ConnectorKindTunnel>, ProxyTunnelStage>

Available on crate feature rustls only.

Support a tls tunnel to the proxy itself using rustls and the provided config

Note that a tls proxy is not needed to make a https connection to the final target. It only has an influence on the initial connection to the proxy itself

Source

pub fn without_tls_proxy_support( self, ) -> EasyHttpConnectorBuilder<T, ProxyTunnelStage>

Don’t support a tls tunnel to the proxy itself

Note that a tls proxy is not needed to make a https connection to the final target. It only has an influence on the initial connection to the proxy itself

Source§

impl<T> EasyHttpConnectorBuilder<T, ProxyTunnelStage>

Source

pub fn with_custom_proxy_connector<L>( self, connector_layer: L, ) -> EasyHttpConnectorBuilder<L::Service, ProxyStage>
where L: Layer<T>,

Add a custom proxy connector that will be used by this client

Source

pub fn with_proxy_support( self, ) -> EasyHttpConnectorBuilder<ProxyConnector<Arc<T>>, ProxyStage>

Available on crate feature socks5 only.

Add support for usage of a http(s) and socks5(h) ProxyAddress to this client

Note that a tls proxy is not needed to make a https connection to the final target. It only has an influence on the initial connection to the proxy itself

Source

pub fn with_http_proxy_support( self, ) -> EasyHttpConnectorBuilder<HttpProxyConnector<T>, ProxyStage>

Add support for usage of a http(s) ProxyAddress to this client

Note that a tls proxy is not needed to make a https connection to the final target. It only has an influence on the initial connection to the proxy itself

Source

pub fn with_socks5_proxy_support( self, ) -> EasyHttpConnectorBuilder<Socks5ProxyConnector<T>, ProxyStage>

Available on crate feature socks5 only.

Add support for usage of a socks5(h) ProxyAddress to this client

Source

pub fn without_proxy_support(self) -> EasyHttpConnectorBuilder<T, ProxyStage>

Make a client without proxy support

Source§

impl<T> EasyHttpConnectorBuilder<T, ProxyStage>

Source

pub fn with_custom_tls_connector<L>( self, connector_layer: L, ) -> EasyHttpConnectorBuilder<L::Service, TlsStage>
where L: Layer<T>,

Available on crate features rustls or boring only.

Add a custom tls connector that will be used by the client

Note: when using a tls_connector you probably want to also add a RequestVersionAdapter which applies the negotiated http version from tls alpn. This can be achieved by using Self::with_custom_connector just after adding the tls connector.

Source

pub fn with_tls_support_using_boringssl( self, config: Option<Arc<TlsConnectorDataBuilder>>, ) -> EasyHttpConnectorBuilder<RequestVersionAdapter<TlsConnector<T>>, TlsStage>

Available on crate feature boring only.

Support https connections by using boringssl for tls

Note: this also adds a RequestVersionAdapter to automatically change the request version to the one configured with tls alpn. If this is not wanted, use Self::with_custom_tls_connector instead.

Source

pub fn with_tls_support_using_boringssl_and_default_http_version( self, config: Option<Arc<TlsConnectorDataBuilder>>, default_http_version: Version, ) -> EasyHttpConnectorBuilder<RequestVersionAdapter<TlsConnector<T>>, TlsStage>

Available on crate feature boring only.

Same as Self::with_tls_support_using_boringssl but also setting the default TargetHttpVersion in case no ALPN is negotiated.

This is a fairly important detail for proxy purposes given otherwise you might come in situations where the ingress traffic is negotiated to h2, but the egress traffic has no negotiation which would without a default http version remain on h2… In such a case you can get failed requests if the egress server does not handle multiple http versions.

Source

pub fn with_tls_support_using_rustls( self, config: Option<TlsConnectorData>, ) -> EasyHttpConnectorBuilder<RequestVersionAdapter<TlsConnector<T>>, TlsStage>

Available on crate feature rustls only.

Support https connections by using ruslts for tls

Note: this also adds a RequestVersionAdapter to automatically change the request version to the one configured with tls alpn. If this is not wanted, use Self::with_custom_tls_connector instead.

Source

pub fn with_tls_support_using_rustls_and_default_http_version( self, config: Option<TlsConnectorData>, default_http_version: Version, ) -> EasyHttpConnectorBuilder<RequestVersionAdapter<TlsConnector<T>>, TlsStage>

Available on crate feature rustls only.

Same as Self::with_tls_support_using_rustls but also setting the default TargetHttpVersion in case no ALPN is negotiated.

This is a fairly important detail for proxy purposes given otherwise you might come in situations where the ingress traffic is negotiated to h2, but the egress traffic has no negotiation which would without a default http version remain on h2… In such a case you can get failed requests if the egress server does not handle multiple http versions.

Source

pub fn without_tls_support(self) -> EasyHttpConnectorBuilder<T, TlsStage>

Dont support https on this connector

Source§

impl<T> EasyHttpConnectorBuilder<T, TlsStage>

Source

pub fn with_default_http_connector<Body>( self, ) -> EasyHttpConnectorBuilder<HttpConnector<T, Body>, HttpStage>

Add http support to this connector

Source

pub fn with_custom_http_connector<L>( self, connector_layer: L, ) -> EasyHttpConnectorBuilder<L::Service, HttpStage>
where L: Layer<T>,

Add a custom http connector that will be run just after tls

Source§

impl<T> EasyHttpConnectorBuilder<T, HttpStage>

Source

pub fn try_with_connection_pool<C>( self, config: HttpPooledConnectorConfig, ) -> Result<EasyHttpConnectorBuilder<RequestVersionAdapter<PooledConnector<T, LruDropPool<C, BasicHttpConId>, BasicHttpConnIdentifier>>, PoolStage>, OpaqueError>

Use the default connection pool for this super::EasyHttpWebClient

This will create a LruDropPool using the provided limits and will use BasicHttpConnIdentifier to group connection on protocol and authority, which should cover most common use cases

Use wait_for_pool_timeout to limit how long we wait for the pool to give us a connection

If you need a different pool or custom way to group connection you can use EasyHttpConnectorBuilder::with_custom_connection_pool() to provide you own.

This also applies a RequestVersionAdapter layer to make sure that request versions are adapted when pooled connections are used, which you almost always need, but in case that is unwanted, you can use Self::with_custom_connection_pool instead.

Source

pub fn try_with_default_connection_pool<C>( self, ) -> Result<EasyHttpConnectorBuilder<RequestVersionAdapter<PooledConnector<T, LruDropPool<C, BasicHttpConId>, BasicHttpConnIdentifier>>, PoolStage>, OpaqueError>

Source

pub fn with_custom_connection_pool<P, R>( self, pool: P, req_to_conn_id: R, wait_for_pool_timeout: Option<Duration>, ) -> EasyHttpConnectorBuilder<PooledConnector<T, P, R>, PoolStage>

Configure this client to use the provided Pool and ReqToConnId

Use wait_for_pool_timeout to limit how long we wait for the pool to give us a connection

Warning: this does not apply a RequestVersionAdapter layer to make sure that request versions are adapted when pooled connections are used, which you almost always. This should be manually added by using Self::with_custom_connector after configuring this pool and providing a RequestVersionAdapter there.

Source§

impl<T, S> EasyHttpConnectorBuilder<T, S>

Source

pub fn build_client<Body, ModifiedBody, ConnResponse>( self, ) -> EasyHttpWebClient<Body, T::Output, ()>
where Body: StreamingBody<Data: Send + 'static, Error: Into<BoxError>> + Unpin + Send + 'static, ModifiedBody: StreamingBody<Data: Send + 'static, Error: Into<BoxError>> + Unpin + Send + 'static, T: Service<Request<Body>, Output = EstablishedClientConnection<ConnResponse, Request<ModifiedBody>>, Error = BoxError>, ConnResponse: ExtensionsMut,

Build a super::EasyHttpWebClient using the currently configured connector

Source

pub fn build_connector(self) -> T

Build a connector from the currently configured setup

Trait Implementations§

Source§

impl<C: Default, S: Default> Default for EasyHttpConnectorBuilder<C, S>

Source§

fn default() -> EasyHttpConnectorBuilder<C, S>

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<C, S> Freeze for EasyHttpConnectorBuilder<C, S>
where C: Freeze,

§

impl<C, S> RefUnwindSafe for EasyHttpConnectorBuilder<C, S>

§

impl<C, S> Send for EasyHttpConnectorBuilder<C, S>
where C: Send, S: Send,

§

impl<C, S> Sync for EasyHttpConnectorBuilder<C, S>
where C: Sync, S: Sync,

§

impl<C, S> Unpin for EasyHttpConnectorBuilder<C, S>
where C: Unpin, S: Unpin,

§

impl<C, S> UnwindSafe for EasyHttpConnectorBuilder<C, S>
where C: UnwindSafe, S: UnwindSafe,

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
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> 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: 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: 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>

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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