pub struct TlsServer<F> { /* private fields */ }
Expand description
A Warp Server ready to filter requests over TLS.
This type requires the "tls"
feature.
Implementations§
source§impl<F> TlsServer<F>
impl<F> TlsServer<F>
sourcepub fn key_path(self, path: impl AsRef<Path>) -> Self
pub fn key_path(self, path: impl AsRef<Path>) -> Self
Specify the file path to read the private key.
This function requires the "tls"
feature.
sourcepub fn cert_path(self, path: impl AsRef<Path>) -> Self
pub fn cert_path(self, path: impl AsRef<Path>) -> Self
Specify the file path to read the certificate.
This function requires the "tls"
feature.
sourcepub fn client_auth_optional_path(self, path: impl AsRef<Path>) -> Self
pub fn client_auth_optional_path(self, path: impl AsRef<Path>) -> Self
Specify the file path to read the trust anchor for optional client authentication.
Anonymous and authenticated clients will be accepted. If no trust anchor is provided by any
of the client_auth_
methods, then client authentication is disabled by default.
This function requires the "tls"
feature.
sourcepub fn client_auth_required_path(self, path: impl AsRef<Path>) -> Self
pub fn client_auth_required_path(self, path: impl AsRef<Path>) -> Self
Specify the file path to read the trust anchor for required client authentication.
Only authenticated clients will be accepted. If no trust anchor is provided by any of the
client_auth_
methods, then client authentication is disabled by default.
This function requires the "tls"
feature.
sourcepub fn key(self, key: impl AsRef<[u8]>) -> Self
pub fn key(self, key: impl AsRef<[u8]>) -> Self
Specify the in-memory contents of the private key.
This function requires the "tls"
feature.
sourcepub fn cert(self, cert: impl AsRef<[u8]>) -> Self
pub fn cert(self, cert: impl AsRef<[u8]>) -> Self
Specify the in-memory contents of the certificate.
This function requires the "tls"
feature.
sourcepub fn client_auth_optional(self, trust_anchor: impl AsRef<[u8]>) -> Self
pub fn client_auth_optional(self, trust_anchor: impl AsRef<[u8]>) -> Self
Specify the in-memory contents of the trust anchor for optional client authentication.
Anonymous and authenticated clients will be accepted. If no trust anchor is provided by any
of the client_auth_
methods, then client authentication is disabled by default.
This function requires the "tls"
feature.
sourcepub fn client_auth_required(self, trust_anchor: impl AsRef<[u8]>) -> Self
pub fn client_auth_required(self, trust_anchor: impl AsRef<[u8]>) -> Self
Specify the in-memory contents of the trust anchor for required client authentication.
Only authenticated clients will be accepted. If no trust anchor is provided by any of the
client_auth_
methods, then client authentication is disabled by default.
This function requires the "tls"
feature.
sourcepub fn ocsp_resp(self, resp: impl AsRef<[u8]>) -> Self
pub fn ocsp_resp(self, resp: impl AsRef<[u8]>) -> Self
Specify the DER-encoded OCSP response.
This function requires the "tls"
feature.
sourcepub async fn run(self, addr: impl Into<SocketAddr>)
pub async fn run(self, addr: impl Into<SocketAddr>)
Run this TlsServer
forever on the current thread.
This function requires the "tls"
feature.
sourcepub async fn bind(self, addr: impl Into<SocketAddr>)
pub async fn bind(self, addr: impl Into<SocketAddr>)
Bind to a socket address, returning a Future
that can be
executed on a runtime.
This function requires the "tls"
feature.
§Panics
Panics if we are unable to bind to the provided address.
sourcepub fn bind_ephemeral(
self,
addr: impl Into<SocketAddr>
) -> (SocketAddr, impl Future<Output = ()> + 'static)
pub fn bind_ephemeral( self, addr: impl Into<SocketAddr> ) -> (SocketAddr, impl Future<Output = ()> + 'static)
Bind to a possibly ephemeral socket address.
Returns the bound address and a Future
that can be executed on
the current runtime.
This function requires the "tls"
feature.
§Panics
Panics if we are unable to bind to the provided address.
sourcepub fn bind_with_graceful_shutdown(
self,
addr: impl Into<SocketAddr> + 'static,
signal: impl Future<Output = ()> + Send + 'static
) -> (SocketAddr, impl Future<Output = ()> + 'static)
pub fn bind_with_graceful_shutdown( self, addr: impl Into<SocketAddr> + 'static, signal: impl Future<Output = ()> + Send + 'static ) -> (SocketAddr, impl Future<Output = ()> + 'static)
Create a server with graceful shutdown signal.
When the signal completes, the server will start the graceful shutdown process.
This function requires the "tls"
feature.
§Panics
Panics if we are unable to bind to the provided address.
sourcepub fn try_bind_with_graceful_shutdown(
self,
addr: impl Into<SocketAddr> + 'static,
signal: impl Future<Output = ()> + Send + 'static
) -> Result<(SocketAddr, impl Future<Output = ()> + 'static), Error>
pub fn try_bind_with_graceful_shutdown( self, addr: impl Into<SocketAddr> + 'static, signal: impl Future<Output = ()> + Send + 'static ) -> Result<(SocketAddr, impl Future<Output = ()> + 'static), Error>
Create a server with graceful shutdown signal.
When the signal completes, the server will start the graceful shutdown process.
This function requires the "tls"
feature.