pub type MaybeTlsSettings = MaybeTls<(), TlsSettings>;Aliased Type§
pub enum MaybeTlsSettings {
Raw(()),
Tls(TlsSettings),
}Variants§
Raw(())
Tls(TlsSettings)
Implementations§
Source§impl MaybeTlsSettings
impl MaybeTlsSettings
pub async fn bind(&self, addr: &SocketAddr) -> Result<MaybeTlsListener>
pub async fn bind_with_allowlist( &self, addr: &SocketAddr, allow_origin: Vec<IpNet>, ) -> Result<MaybeTlsListener>
Sourcepub async fn bind_reloadable(
&self,
addr: &SocketAddr,
reloader: Option<TlsAcceptorReloader>,
) -> Result<MaybeTlsListener>
pub async fn bind_reloadable( &self, addr: &SocketAddr, reloader: Option<TlsAcceptorReloader>, ) -> Result<MaybeTlsListener>
Bind a listener, optionally sharing a TlsAcceptorReloader so its acceptor can be swapped
at runtime. When reloader is Some and TLS is enabled, connections accepted by the
returned listener use the acceptor the reloader currently holds; otherwise the acceptor is
fixed for the lifetime of the listener.
Source§impl MaybeTlsSettings
impl MaybeTlsSettings
pub async fn connect( &self, host: &str, addr: &SocketAddr, ) -> Result<MaybeTlsStream<TcpStream>>
Source§impl MaybeTlsSettings
impl MaybeTlsSettings
Sourcepub fn reloadable_acceptor(&self) -> Result<Option<TlsAcceptorReloader>>
pub fn reloadable_acceptor(&self) -> Result<Option<TlsAcceptorReloader>>
Build a reloadable acceptor handle for server use, or None when TLS is disabled.
Pass the returned handle to bind_reloadable so the bound listener
serves it, and keep a clone to call reload when the
certificate material rotates.
Source§impl MaybeTlsSettings
impl MaybeTlsSettings
pub fn enable_client() -> Result<Self>
pub fn tls_client(config: Option<&TlsConfig>) -> Result<Self>
Sourcepub fn from_config(
config: Option<&TlsEnableableConfig>,
for_server: bool,
) -> Result<Self>
pub fn from_config( config: Option<&TlsEnableableConfig>, for_server: bool, ) -> Result<Self>
Generate an optional settings struct from the given optional
configuration reference. If config is None, TLS is
disabled. The for_server parameter indicates the options
should be interpreted as being for a TLS server, which requires
an identity certificate and changes the certificate verification
default to false.