pub struct ConnectorBuilder<Tls = TlsUnset> { /* private fields */ }Expand description
Builder for Connector.
Implementations§
Source§impl ConnectorBuilder<TlsUnset>
impl ConnectorBuilder<TlsUnset>
Sourcepub fn tls_provider(
self,
provider: Provider,
) -> ConnectorBuilder<TlsProviderSelected>
pub fn tls_provider( self, provider: Provider, ) -> ConnectorBuilder<TlsProviderSelected>
Set the TLS implementation to use for this connector
Source§impl<Any> ConnectorBuilder<Any>
impl<Any> ConnectorBuilder<Any>
Sourcepub fn sleep_impl(self, sleep_impl: impl AsyncSleep + 'static) -> Self
pub fn sleep_impl(self, sleep_impl: impl AsyncSleep + 'static) -> Self
Set the async sleep implementation used for timeouts
Calling this is only necessary for testing or to use something other than
default_async_sleep.
Sourcepub fn set_sleep_impl(
&mut self,
sleep_impl: Option<SharedAsyncSleep>,
) -> &mut Self
pub fn set_sleep_impl( &mut self, sleep_impl: Option<SharedAsyncSleep>, ) -> &mut Self
Set the async sleep implementation used for timeouts
Calling this is only necessary for testing or to use something other than
default_async_sleep.
Sourcepub fn connector_settings(
self,
connector_settings: HttpConnectorSettings,
) -> Self
pub fn connector_settings( self, connector_settings: HttpConnectorSettings, ) -> Self
Configure the HTTP settings for the HyperAdapter
Sourcepub fn set_connector_settings(
&mut self,
connector_settings: Option<HttpConnectorSettings>,
) -> &mut Self
pub fn set_connector_settings( &mut self, connector_settings: Option<HttpConnectorSettings>, ) -> &mut Self
Configure the HTTP settings for the HyperAdapter
Sourcepub fn enable_tcp_nodelay(self, nodelay: bool) -> Self
pub fn enable_tcp_nodelay(self, nodelay: bool) -> Self
Configure SO_NODELAY for all sockets to the supplied value nodelay
Sourcepub fn set_enable_tcp_nodelay(&mut self, nodelay: bool) -> &mut Self
pub fn set_enable_tcp_nodelay(&mut self, nodelay: bool) -> &mut Self
Configure SO_NODELAY for all sockets to the supplied value nodelay
Sourcepub fn set_interface<S: Into<String>>(&mut self, interface: S) -> &mut Self
pub fn set_interface<S: Into<String>>(&mut self, interface: S) -> &mut Self
Sets the value for the SO_BINDTODEVICE option on this socket.
If a socket is bound to an interface, only packets received from that particular
interface are processed by the socket. Note that this only works for some socket
types (e.g. AF_INET sockets).
On Linux it can be used to specify a VRF, but the binary needs to either have
CAP_NET_RAW capability set or be run as root.
This function is only available on Android, Fuchsia, and Linux.
Sourcepub fn proxy_config(self, config: ProxyConfig) -> Self
pub fn proxy_config(self, config: ProxyConfig) -> Self
Configure proxy settings for this connector
This method allows you to set explicit proxy configuration for the HTTP client. The proxy configuration will be used to determine whether requests should be routed through a proxy server or connect directly.
§Examples
use aws_smithy_http_client::{Connector, proxy::ProxyConfig, tls};
let proxy_config = ProxyConfig::http("http://proxy.example.com:8080")?;
let connector = Connector::builder()
.proxy_config(proxy_config)
.tls_provider(tls::Provider::Rustls(tls::rustls_provider::CryptoMode::AwsLc))
.build();Sourcepub fn set_proxy_config(&mut self, config: Option<ProxyConfig>) -> &mut Self
pub fn set_proxy_config(&mut self, config: Option<ProxyConfig>) -> &mut Self
Configure proxy settings for this connector
This is the mutable version of proxy_config.
Sourcepub fn pool_idle_timeout<D>(self, val: D) -> Self
pub fn pool_idle_timeout<D>(self, val: D) -> Self
Set an optional timeout for idle sockets being kept-alive.
Pass None to disable timeout.
Defaults to Hyper’s default timeout, which is currently 90 seconds - see
hyper_util::client::legacy::Builder::pool_idle_timeout,
but unlike that function, there is no need to call pool_timer yourself.
§Examples
use aws_smithy_http_client::{Connector, tls};
use std::time::Duration;
let connector = Connector::builder()
.pool_idle_timeout(Duration::from_secs(30))
.tls_provider(tls::Provider::Rustls(tls::rustls_provider::CryptoMode::AwsLc))
.build();Sourcepub fn set_pool_idle_timeout(
&mut self,
val: Option<Option<Duration>>,
) -> &mut Self
pub fn set_pool_idle_timeout( &mut self, val: Option<Option<Duration>>, ) -> &mut Self
Set an optional timeout for idle sockets being kept-alive.
Pass None to use Hyper’s default timeout, Some(None) to disable timeouts.
This is the mutable version of pool_idle_timeout.
§Examples
use aws_smithy_http_client::{Connector, tls};
use std::time::Duration;
let mut connector = Connector::builder();
connector
.set_pool_idle_timeout(Some(Some(Duration::from_secs(30))));
connector
.tls_provider(tls::Provider::Rustls(tls::rustls_provider::CryptoMode::AwsLc))
.build();Sourcepub fn pool_max_idle_per_host(self, val: usize) -> Self
pub fn pool_max_idle_per_host(self, val: usize) -> Self
Sets the maximum number of idle pooled connections allowed per host.
Default is determined by the underlying hyper client, which is currently no limit
(usize::MAX) - see hyper_util::client::legacy::Builder::pool_max_idle_per_host.
§Examples
use aws_smithy_http_client::{Connector, tls};
let connector = Connector::builder()
.pool_max_idle_per_host(70)
.tls_provider(tls::Provider::Rustls(tls::rustls_provider::CryptoMode::AwsLc))
.build();Sourcepub fn set_pool_max_idle_per_host(&mut self, val: Option<usize>) -> &mut Self
pub fn set_pool_max_idle_per_host(&mut self, val: Option<usize>) -> &mut Self
Sets the maximum number of idle pooled connections allowed per host.
Pass None to use the hyper default (currently no limit, usize::MAX) - see
hyper_util::client::legacy::Builder::pool_max_idle_per_host.
This is the mutable version of pool_max_idle_per_host.
Source§impl ConnectorBuilder<TlsProviderSelected>
impl ConnectorBuilder<TlsProviderSelected>
Sourcepub fn build(self) -> Connector
pub fn build(self) -> Connector
Build a Connector that will use the default DNS resolver implementation.
Sourcepub fn tls_context(self, ctx: TlsContext) -> Self
pub fn tls_context(self, ctx: TlsContext) -> Self
Configure the TLS context
Sourcepub fn set_tls_context(&mut self, ctx: TlsContext) -> &mut Self
pub fn set_tls_context(&mut self, ctx: TlsContext) -> &mut Self
Configure the TLS context
Sourcepub fn build_with_resolver<R: ResolveDns + Clone + 'static>(
self,
resolver: R,
) -> Connector
pub fn build_with_resolver<R: ResolveDns + Clone + 'static>( self, resolver: R, ) -> Connector
Build a Connector that will use the given DNS resolver implementation.
Trait Implementations§
Source§impl<Tls: Clone> Clone for ConnectorBuilder<Tls>
impl<Tls: Clone> Clone for ConnectorBuilder<Tls>
Source§fn clone(&self) -> ConnectorBuilder<Tls>
fn clone(&self) -> ConnectorBuilder<Tls>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<Tls: Debug> Debug for ConnectorBuilder<Tls>
impl<Tls: Debug> Debug for ConnectorBuilder<Tls>
Auto Trait Implementations§
impl<Tls = TlsUnset> !Freeze for ConnectorBuilder<Tls>
impl<Tls = TlsUnset> !RefUnwindSafe for ConnectorBuilder<Tls>
impl<Tls = TlsUnset> !UnwindSafe for ConnectorBuilder<Tls>
impl<Tls> Send for ConnectorBuilder<Tls>where
Tls: Send,
impl<Tls> Sync for ConnectorBuilder<Tls>where
Tls: Sync,
impl<Tls> Unpin for ConnectorBuilder<Tls>where
Tls: Unpin,
impl<Tls> UnsafeUnpin for ConnectorBuilder<Tls>where
Tls: UnsafeUnpin,
Blanket Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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