Trait tls_api::TlsAcceptor
source · [−]pub trait TlsAcceptor: Sized + Sync + Send + 'static {
type Builder: TlsAcceptorBuilder<Acceptor = Self>;
type Underlying;
type TlsStream: TlsStreamDyn;
const IMPLEMENTED: bool;
const SUPPORTS_ALPN: bool;
const SUPPORTS_DER_KEYS: bool;
const SUPPORTS_PKCS12_KEYS: bool;
const TYPE_DYN: &'static dyn TlsAcceptorType = &TlsAcceptorTypeImpl::(marker::PhantomData);
fn underlying_mut(&mut self) -> &mut Self::Underlying;
fn info() -> ImplInfo;
fn accept_with_socket<'a, S>(
&'a self,
stream: S
) -> BoxFuture<'a, Result<TlsStreamWithSocket<S>>>ⓘNotable traits for BoxFuture<'a, R>impl<'a, R> Future for BoxFuture<'a, R> type Output = R;
where
S: AsyncSocket + Debug + Unpin;
fn accept_impl_tls_stream<'a, S>(
&'a self,
stream: S
) -> BoxFuture<'a, Result<Self::TlsStream>>ⓘNotable traits for BoxFuture<'a, R>impl<'a, R> Future for BoxFuture<'a, R> type Output = R;
where
S: AsyncSocket;
fn into_dyn(self) -> TlsAcceptorBox { ... }
fn builder_from_der_key(cert: &[u8], key: &[u8]) -> Result<Self::Builder> { ... }
fn builder_from_pkcs12(
pkcs12: &[u8],
passphrase: &str
) -> Result<Self::Builder> { ... }
fn accept<'a, S>(&'a self, stream: S) -> BoxFuture<'a, Result<TlsStream>>ⓘNotable traits for BoxFuture<'a, R>impl<'a, R> Future for BoxFuture<'a, R> type Output = R;
where
S: AsyncSocket + Debug + Unpin,
{ ... }
}
Expand description
A builder for server-side TLS connections.
Required Associated Types
type Builder: TlsAcceptorBuilder<Acceptor = Self>
type Builder: TlsAcceptorBuilder<Acceptor = Self>
Type of the builder for this acceptor.
type Underlying
type Underlying
Type of the underlying acceptor.
type TlsStream: TlsStreamDyn
type TlsStream: TlsStreamDyn
crate::TlsStream<tls_api::AsyncSocketBox>
.
In the world of HKT this would be:
type TlsStream<S: TlsStreamDyn> : TlsStreamWithSocketDyn<S>;
Note each implementation has accept_impl
function
which returns more specific type, providing both access to implementation details
and the underlying socket.
Required Associated Constants
const IMPLEMENTED: bool
const IMPLEMENTED: bool
Whether this acceptor type is implemented.
For example, tls-api-security-framework
is available on Linux,
but all operations result in error, so IMPLEMENTED = false
for that implementation.
const SUPPORTS_ALPN: bool
const SUPPORTS_ALPN: bool
Whether this implementation supports ALPN negotiation.
const SUPPORTS_DER_KEYS: bool
const SUPPORTS_DER_KEYS: bool
Whether this implementation supports construction of acceptor using a pair of a DER certificate and file pair.
const SUPPORTS_PKCS12_KEYS: bool
const SUPPORTS_PKCS12_KEYS: bool
Whether this implementation supports construction of acceptor using PKCS #12 file.
Provided Associated Constants
const TYPE_DYN: &'static dyn TlsAcceptorType = &TlsAcceptorTypeImpl::(marker::PhantomData)
const TYPE_DYN: &'static dyn TlsAcceptorType = &TlsAcceptorTypeImpl::(marker::PhantomData)
Dynamic (without type parameter) version of the acceptor.
This function returns an acceptor type, which can be used to constructor acceptors.
Required Methods
fn underlying_mut(&mut self) -> &mut Self::Underlying
fn underlying_mut(&mut self) -> &mut Self::Underlying
Get the underlying acceptor.
API intentionally exposes the underlying acceptor builder to allow fine acceptor not possible in common API.
fn accept_with_socket<'a, S>(
&'a self,
stream: S
) -> BoxFuture<'a, Result<TlsStreamWithSocket<S>>>ⓘNotable traits for BoxFuture<'a, R>impl<'a, R> Future for BoxFuture<'a, R> type Output = R;
where
S: AsyncSocket + Debug + Unpin,
fn accept_with_socket<'a, S>(
&'a self,
stream: S
) -> BoxFuture<'a, Result<TlsStreamWithSocket<S>>>ⓘNotable traits for BoxFuture<'a, R>impl<'a, R> Future for BoxFuture<'a, R> type Output = R;
where
S: AsyncSocket + Debug + Unpin,
Accept a connection.
This operation returns a future which is resolved when the negotiation is complete, and the stream is ready to send and receive.
This version of accept
returns a stream parameterized by the underlying socket type.
fn accept_impl_tls_stream<'a, S>(
&'a self,
stream: S
) -> BoxFuture<'a, Result<Self::TlsStream>>ⓘNotable traits for BoxFuture<'a, R>impl<'a, R> Future for BoxFuture<'a, R> type Output = R;
where
S: AsyncSocket,
fn accept_impl_tls_stream<'a, S>(
&'a self,
stream: S
) -> BoxFuture<'a, Result<Self::TlsStream>>ⓘNotable traits for BoxFuture<'a, R>impl<'a, R> Future for BoxFuture<'a, R> type Output = R;
where
S: AsyncSocket,
Accept a connection.
This operation returns a future which is resolved when the negotiation is complete, and the stream is ready to send and receive.
This version of accept
returns a stream parameterized by the underlying socket type.
Practically, accept
is usually enough.
Provided Methods
fn into_dyn(self) -> TlsAcceptorBox
fn into_dyn(self) -> TlsAcceptorBox
Dynamic (without type parameter) version of the connector.
New builder from given server key.
Parameters are DER-encoded (binary) X509 cert and corresponding private key.
Note if this implementation does not support DER keys directly,
openssl
command is used to convert the certificate.
New builder from given server key.
Note if this implementation does not support PKCS #12 keys directly,
openssl
command is used to convert the certificate.
Accept a connection.
This operation returns a future which is resolved when the negotiation is complete, and the stream is ready to send and receive.
This version return a stream of the underlying implementation, which might be useful to obtain some TLS implementation-specific data.
Practically, accept
is usually enough.