Struct warp::TlsServer

source ·
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>
where F: Filter + Clone + Send + Sync + 'static, <F::Future as TryFuture>::Ok: Reply, <F::Future as TryFuture>::Error: IsReject,

source

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.

source

pub fn cert_path(self, path: impl AsRef<Path>) -> Self

Specify the file path to read the certificate.

This function requires the "tls" feature.

source

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.

source

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.

source

pub fn key(self, key: impl AsRef<[u8]>) -> Self

Specify the in-memory contents of the private key.

This function requires the "tls" feature.

source

pub fn cert(self, cert: impl AsRef<[u8]>) -> Self

Specify the in-memory contents of the certificate.

This function requires the "tls" feature.

source

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.

source

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.

source

pub fn ocsp_resp(self, resp: impl AsRef<[u8]>) -> Self

Specify the DER-encoded OCSP response.

This function requires the "tls" feature.

source

pub async fn run(self, addr: impl Into<SocketAddr>)

Run this TlsServer forever on the current thread.

This function requires the "tls" feature.

source

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.

source

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.

source

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.

source

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.

Trait Implementations§

source§

impl<F> Debug for TlsServer<F>
where F: Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<F> Freeze for TlsServer<F>
where F: Freeze,

§

impl<F> !RefUnwindSafe for TlsServer<F>

§

impl<F> Send for TlsServer<F>
where F: Send,

§

impl<F> Sync for TlsServer<F>
where F: Sync,

§

impl<F> Unpin for TlsServer<F>
where F: Unpin,

§

impl<F> !UnwindSafe for TlsServer<F>

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

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

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> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

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

§

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.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

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

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more