Hello Rust Community!
I am new to async Rust and have moderate experience of writing sync code in Rust. I am writing a TCP server with TLS support for learning purpose. I want to choose certificates based on the hostname specified in ClientHello. Certificates will be fetched from other key store making it perfect usecase for async. I have read several options, but none provides a concrete example on how to do it.
cert_resolver
in rustls::server::ServerConfig
. But from my understanding it is not async, and as mentioned in rustls documentation:For applications that use async I/O and need to do I/O to choose a certificate (for instance, fetching a certificate from a data store), the
Acceptor
interface is more suitable.
Ok, good.But if I go to Acceptor
documentaion, I go blank on how to use it with async runtime like tokio? I could not get clear idea of how to use this struct when working with tokio as tokio_rustls::TlsAcceptor
does not have similar methods like read_tls
in rustls
.
tokio_native_tls
. But again same issue, not a single example available or I could not find it.What is recommended way of achieving this functionality when using tokio? An minimal example is very much appreciated.
Thank you!
1 post - 1 participant