pub struct TlsListener {
inner: TcpListener,
layer: TlsLayer,
handshake_timeout: Duration,
}Expand description
TLS listener. Wraps a TCP listener with TLS acceptance.
Fields§
§inner: TcpListener§layer: TlsLayer§handshake_timeout: DurationMax time accept waits for a handshake.
Implementations§
Source§impl TlsListener
impl TlsListener
Sourcepub fn new(inner: TcpListener, config: ServerTlsConfig) -> Self
pub fn new(inner: TcpListener, config: ServerTlsConfig) -> Self
Create a TLS listener from a TCP listener and TLS config.
Sourcepub fn with_handshake_timeout(self, timeout: Duration) -> Self
pub fn with_handshake_timeout(self, timeout: Duration) -> Self
Set the max time accept waits for a handshake. Defaults to 10s.
Sourcepub async fn accept(&self) -> Result<Box<dyn ByteStream>>
pub async fn accept(&self) -> Result<Box<dyn ByteStream>>
Accept a new TLS connection. The handshake runs inline and fails
after the handshake timeout (10s by default), so a slow client
stalls a plain accept loop for up to that long. Servers should accept on a TcpListener and run
TlsLayer::handshake in a separate task instead.
Sourcepub fn local_endpoint(&self) -> Result<Endpoint>
pub fn local_endpoint(&self) -> Result<Endpoint>
Local endpoint this listener is bound to.
Auto Trait Implementations§
impl !Freeze for TlsListener
impl !RefUnwindSafe for TlsListener
impl !UnwindSafe for TlsListener
impl Send for TlsListener
impl Sync for TlsListener
impl Unpin for TlsListener
impl UnsafeUnpin for TlsListener
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