diff --git a/Cargo.toml b/Cargo.toml index b4dcaa9..860613b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,6 +24,7 @@ quic = ["rustls/quic"] [dependencies] futures-lite = "1.10.1" webpki = "0.21" +async-tls-acceptor = "0.1.0" [dependencies.rustls] version = "0.19" diff --git a/src/lib.rs b/src/lib.rs index 525a082..2cd202d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -110,6 +110,18 @@ impl TlsAcceptor { } } +#[async_tls_acceptor::async_trait] +impl async_tls_acceptor::Acceptor for TlsAcceptor +where + Input: AsyncRead + AsyncWrite + Send + Sync + Unpin + 'static, +{ + type Output = server::TlsStream; + type Error = std::io::Error; + async fn accept(&self, input: Input) -> Result { + TlsAcceptor::accept(&self, input).await + } +} + /// Future returned from `TlsConnector::connect` which will resolve /// once the connection handshake has finished. pub struct Connect(MidHandshake>);