Struct tide_rustls::TlsListenerBuilder[][src]

pub struct TlsListenerBuilder<State> { /* fields omitted */ }

A builder for TlsListeners

This is created with a call to TlsListener::build. This also can be passed directly to tide::Server::listen, skipping the TlsListenerBuilder::finish call.

Examples

let listener = TlsListener::<()>::build()
    .addrs("localhost:4433")
    .cert("./tls/localhost-4433.cert")
    .key("./tls/localhost-4433.key")
    .finish();
let listener = TlsListener::<()>::build()
    .tcp(std::net::TcpListener::bind("localhost:4433").unwrap())
    .config(rustls::ServerConfig::new(rustls::NoClientAuth::new()))
    .finish();

Implementations

impl<State> TlsListenerBuilder<State>[src]

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

Provide a path to a key file, in either pkcs8 or rsa formats. This is mutually exclusive with providing a server config with TlsListenerBuilder::config, but must be used in conjunction with TlsListenerBuilder::cert

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

Provide a path to a cert file. This is mutually exclusive with providing a server config with TlsListenerBuilder::config, but must be used in conjunction with TlsListenerBuilder::key

pub fn config(self, config: ServerConfig) -> Self[src]

Provide a prebuilt rustls::ServerConfig with any options. This is mutually exclusive with both TlsListenerBuilder::key and TlsListenerBuilder::cert, but provides the opportunity for more configuration choices.

pub fn tls_acceptor(self, acceptor: Arc<dyn CustomTlsAcceptor>) -> Self[src]

Provides a custom acceptor for TLS connections. This is mutually exclusive with any of TlsListenerBuilder::key, TlsListenerBuilder::cert, and TlsListenerBuilder::config, but gives total control over accepting TLS connections, including multiplexing other streams or ALPN negotiations on the same TLS connection that tide should ignore.

pub fn tcp(self, tcp: impl Into<TcpListener>) -> Self[src]

Provides a bound tcp listener (either async-std or std) to build this tls listener on. This is mutually exclusive with TlsListenerBuilder::addrs, but one of them is mandatory.

pub fn addrs(self, addrs: impl ToSocketAddrs) -> Self[src]

Provides a std::net::ToSocketAddrs specification for this tls listener. This is mutually exclusive with TlsListenerBuilder::tcp but one of them is mandatory.

pub fn finish(self) -> Result<TlsListener<State>>[src]

finishes building a TlsListener from this TlsListenerBuilder.

Errors

this will return an error unless all of the following conditions are met:

Trait Implementations

impl<State> Debug for TlsListenerBuilder<State>[src]

impl<State> Default for TlsListenerBuilder<State>[src]

impl<State: Clone + Send + Sync + 'static> ToListener<State> for TlsListenerBuilder<State>[src]

type Listener = TlsListener<State>

What listener are we converting into?

Auto Trait Implementations

impl<State> !RefUnwindSafe for TlsListenerBuilder<State>

impl<State> Send for TlsListenerBuilder<State> where
    State: Send

impl<State> Sync for TlsListenerBuilder<State> where
    State: Sync

impl<State> Unpin for TlsListenerBuilder<State> where
    State: Unpin

impl<State> !UnwindSafe for TlsListenerBuilder<State>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

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