pub struct EasyHttpConnectorBuilder<C = (), S = ()> { /* private fields */ }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
impl EasyHttpConnectorBuilder
pub fn new() -> Self
pub fn with_default_transport_connector( self, ) -> EasyHttpConnectorBuilder<TcpConnector, TransportStage>
Sourcepub fn with_custom_transport_connector<C>(
self,
connector: C,
) -> EasyHttpConnectorBuilder<C, TransportStage>
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>
impl<T, Stage> EasyHttpConnectorBuilder<T, Stage>
Sourcepub fn with_custom_connector<L>(
self,
connector_layer: L,
) -> EasyHttpConnectorBuilder<L::Service, Stage>where
L: Layer<T>,
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>
impl EasyHttpConnectorBuilder<TcpConnector, TransportStage>
Sourcepub fn with_dns_resolver<T: DnsResolver + Clone>(
self,
resolver: T,
) -> EasyHttpConnectorBuilder<TcpConnector<T>, TransportStage>
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>
impl<T> EasyHttpConnectorBuilder<T, TransportStage>
Sourcepub 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.
pub fn with_custom_tls_proxy_connector<L>(
self,
connector_layer: L,
) -> EasyHttpConnectorBuilder<L::Service, ProxyTunnelStage>where
L: Layer<T>,
rustls or boring only.Add a custom proxy tls connector that will be used to setup a tls connection to the proxy
Sourcepub fn with_tls_proxy_support_using_boringssl(
self,
) -> EasyHttpConnectorBuilder<TlsConnector<T, ConnectorKindTunnel>, ProxyTunnelStage>
Available on crate feature boring only.
pub fn with_tls_proxy_support_using_boringssl( self, ) -> EasyHttpConnectorBuilder<TlsConnector<T, ConnectorKindTunnel>, ProxyTunnelStage>
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
Sourcepub fn with_tls_proxy_support_using_boringssl_config(
self,
config: Arc<TlsConnectorDataBuilder>,
) -> EasyHttpConnectorBuilder<TlsConnector<T, ConnectorKindTunnel>, ProxyTunnelStage>
Available on crate feature boring only.
pub fn with_tls_proxy_support_using_boringssl_config( self, config: Arc<TlsConnectorDataBuilder>, ) -> EasyHttpConnectorBuilder<TlsConnector<T, ConnectorKindTunnel>, ProxyTunnelStage>
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
Sourcepub fn with_tls_proxy_support_using_rustls(
self,
) -> EasyHttpConnectorBuilder<TlsConnector<T, ConnectorKindTunnel>, ProxyTunnelStage>
Available on crate feature rustls only.
pub fn with_tls_proxy_support_using_rustls( self, ) -> EasyHttpConnectorBuilder<TlsConnector<T, ConnectorKindTunnel>, ProxyTunnelStage>
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
Sourcepub fn with_tls_proxy_support_using_rustls_config(
self,
config: TlsConnectorData,
) -> EasyHttpConnectorBuilder<TlsConnector<T, ConnectorKindTunnel>, ProxyTunnelStage>
Available on crate feature rustls only.
pub fn with_tls_proxy_support_using_rustls_config( self, config: TlsConnectorData, ) -> EasyHttpConnectorBuilder<TlsConnector<T, ConnectorKindTunnel>, ProxyTunnelStage>
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
Sourcepub fn without_tls_proxy_support(
self,
) -> EasyHttpConnectorBuilder<T, ProxyTunnelStage>
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>
impl<T> EasyHttpConnectorBuilder<T, ProxyTunnelStage>
Sourcepub fn with_custom_proxy_connector<L>(
self,
connector_layer: L,
) -> EasyHttpConnectorBuilder<L::Service, ProxyStage>where
L: Layer<T>,
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
Sourcepub fn with_proxy_support(
self,
) -> EasyHttpConnectorBuilder<ProxyConnector<Arc<T>>, ProxyStage>
Available on crate feature socks5 only.
pub fn with_proxy_support( self, ) -> EasyHttpConnectorBuilder<ProxyConnector<Arc<T>>, ProxyStage>
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
Sourcepub fn with_http_proxy_support(
self,
) -> EasyHttpConnectorBuilder<HttpProxyConnector<T>, ProxyStage>
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
Sourcepub fn with_socks5_proxy_support(
self,
) -> EasyHttpConnectorBuilder<Socks5ProxyConnector<T>, ProxyStage>
Available on crate feature socks5 only.
pub fn with_socks5_proxy_support( self, ) -> EasyHttpConnectorBuilder<Socks5ProxyConnector<T>, ProxyStage>
socks5 only.Add support for usage of a socks5(h) ProxyAddress to this client
Sourcepub fn without_proxy_support(self) -> EasyHttpConnectorBuilder<T, ProxyStage>
pub fn without_proxy_support(self) -> EasyHttpConnectorBuilder<T, ProxyStage>
Make a client without proxy support
Source§impl<T> EasyHttpConnectorBuilder<T, ProxyStage>
impl<T> EasyHttpConnectorBuilder<T, ProxyStage>
Sourcepub 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.
pub fn with_custom_tls_connector<L>(
self,
connector_layer: L,
) -> EasyHttpConnectorBuilder<L::Service, TlsStage>where
L: Layer<T>,
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.
Sourcepub fn with_tls_support_using_boringssl(
self,
config: Option<Arc<TlsConnectorDataBuilder>>,
) -> EasyHttpConnectorBuilder<RequestVersionAdapter<TlsConnector<T>>, TlsStage>
Available on crate feature boring only.
pub fn with_tls_support_using_boringssl( self, config: Option<Arc<TlsConnectorDataBuilder>>, ) -> EasyHttpConnectorBuilder<RequestVersionAdapter<TlsConnector<T>>, TlsStage>
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.
Sourcepub 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.
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>
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.
Sourcepub fn with_tls_support_using_rustls(
self,
config: Option<TlsConnectorData>,
) -> EasyHttpConnectorBuilder<RequestVersionAdapter<TlsConnector<T>>, TlsStage>
Available on crate feature rustls only.
pub fn with_tls_support_using_rustls( self, config: Option<TlsConnectorData>, ) -> EasyHttpConnectorBuilder<RequestVersionAdapter<TlsConnector<T>>, TlsStage>
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.
Sourcepub 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.
pub fn with_tls_support_using_rustls_and_default_http_version( self, config: Option<TlsConnectorData>, default_http_version: Version, ) -> EasyHttpConnectorBuilder<RequestVersionAdapter<TlsConnector<T>>, TlsStage>
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.
Sourcepub fn without_tls_support(self) -> EasyHttpConnectorBuilder<T, TlsStage>
pub fn without_tls_support(self) -> EasyHttpConnectorBuilder<T, TlsStage>
Dont support https on this connector
Source§impl<T> EasyHttpConnectorBuilder<T, TlsStage>
impl<T> EasyHttpConnectorBuilder<T, TlsStage>
Sourcepub fn with_default_http_connector<Body>(
self,
) -> EasyHttpConnectorBuilder<HttpConnector<T, Body>, HttpStage>
pub fn with_default_http_connector<Body>( self, ) -> EasyHttpConnectorBuilder<HttpConnector<T, Body>, HttpStage>
Add http support to this connector
Sourcepub fn with_custom_http_connector<L>(
self,
connector_layer: L,
) -> EasyHttpConnectorBuilder<L::Service, HttpStage>where
L: Layer<T>,
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>
impl<T> EasyHttpConnectorBuilder<T, HttpStage>
Sourcepub fn try_with_connection_pool<C>(
self,
config: HttpPooledConnectorConfig,
) -> Result<EasyHttpConnectorBuilder<RequestVersionAdapter<PooledConnector<T, LruDropPool<C, BasicHttpConId>, BasicHttpConnIdentifier>>, PoolStage>, OpaqueError>
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.
Sourcepub fn try_with_default_connection_pool<C>(
self,
) -> Result<EasyHttpConnectorBuilder<RequestVersionAdapter<PooledConnector<T, LruDropPool<C, BasicHttpConId>, BasicHttpConnIdentifier>>, PoolStage>, OpaqueError>
pub fn try_with_default_connection_pool<C>( self, ) -> Result<EasyHttpConnectorBuilder<RequestVersionAdapter<PooledConnector<T, LruDropPool<C, BasicHttpConId>, BasicHttpConnIdentifier>>, PoolStage>, OpaqueError>
Same as Self::try_with_connection_pool but using the default HttpPooledConnectorConfig.
Sourcepub 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>
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>
impl<T, S> EasyHttpConnectorBuilder<T, S>
Sourcepub 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,
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
Sourcepub fn build_connector(self) -> T
pub fn build_connector(self) -> T
Build a connector from the currently configured setup
Trait Implementations§
Auto Trait Implementations§
impl<C, S> Freeze for EasyHttpConnectorBuilder<C, S>where
C: Freeze,
impl<C, S> RefUnwindSafe for EasyHttpConnectorBuilder<C, S>where
C: RefUnwindSafe,
S: RefUnwindSafe,
impl<C, S> Send for EasyHttpConnectorBuilder<C, S>
impl<C, S> Sync for EasyHttpConnectorBuilder<C, S>
impl<C, S> Unpin for EasyHttpConnectorBuilder<C, S>
impl<C, S> UnwindSafe for EasyHttpConnectorBuilder<C, S>where
C: UnwindSafe,
S: UnwindSafe,
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<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> 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