Struct TlsAcceptor
pub struct TlsAcceptor {
inner: Arc<ServerConfig>,
}Expand description
A wrapper around a rustls::ServerConfig, providing an async accept method.
Fields§
§inner: Arc<ServerConfig>Implementations§
§impl TlsAcceptor
impl TlsAcceptor
pub fn accept<IO>(&self, stream: IO) -> Accept<IO> ⓘwhere
IO: AsyncRead + AsyncWrite + Unpin,
pub fn accept<IO>(&self, stream: IO) -> Accept<IO> ⓘwhere
IO: AsyncRead + AsyncWrite + Unpin,
Returns a future for completing a TLS handshake for a client using stream.
You likely want to wrap this in a timeout (for example with tokio::time::timeout)
to bound the handshake time.
pub fn accept_with<IO, F>(&self, stream: IO, f: F) -> Accept<IO> ⓘ
pub fn accept_with<IO, F>(&self, stream: IO, f: F) -> Accept<IO> ⓘ
Similar to Self::accept(), but calls f before performing the handshake.
As with Self::accept() you likely want to wrap this in a timeout to
bound the handshake time.
The f handler is given a mutable reference to a ServerConnection that can be used
to configure the connection before the handshake, for example, adjusting the buffer limit.
Because no data has been read from stream yet when f is called ClientHello
dependent state (like early data) is not yet available.
Trait Implementations§
§impl Clone for TlsAcceptor
impl Clone for TlsAcceptor
§fn clone(&self) -> TlsAcceptor
fn clone(&self) -> TlsAcceptor
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read more§impl From<Arc<ServerConfig>> for TlsAcceptor
impl From<Arc<ServerConfig>> for TlsAcceptor
§fn from(inner: Arc<ServerConfig>) -> TlsAcceptor
fn from(inner: Arc<ServerConfig>) -> TlsAcceptor
Converts to this type from the input type.
Auto Trait Implementations§
impl !RefUnwindSafe for TlsAcceptor
impl !UnwindSafe for TlsAcceptor
impl Freeze for TlsAcceptor
impl Send for TlsAcceptor
impl Sync for TlsAcceptor
impl Unpin for TlsAcceptor
impl UnsafeUnpin for TlsAcceptor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more