-
-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for different runtimes and TLS libraries #169
Comments
We have ...
TLS backends are mostly implemented using traits from the runtime, e.g., This means that we probably want to write sans I/O adapters that use a runtimes read/write traits (to support most tls backends). More questions:
|
I wanted to share a bit what I've been attempted so far with pimalaya/core/start-tls:
Basically, the right // .prepare() for blocking environment (std)
let tcp_stream = std::net::TcpStream::connect(…)
let spec = ImapStartTls::new(&mut tcp_stream);
StartTls::new(spec).prepare().unwrap();
// .prepare().await for async runtime (futures)
let tcp_stream = async_std::net::TcpStream::connect(…)
let spec = SmtpStartTls::new(&mut tcp_stream);
StartTls::new(spec).prepare().await.unwrap(); Examples can be found here: $ RUST_LOG=debug HOST=posteo.de PORT=25 cargo run --example smtp-std
$ RUST_LOG=debug HOST=posteo.de PORT=143 cargo run --example imap-futures Keep in mind that this is just an experiment, I would appreciate any feedback on it. |
I ran into several issues with the previous implementation. After digging a lot, I unfortunately came to the conclusion that separated structs/traits for sync and async is the actual way to go. There is no happy path ATM. The actual proposition is the following:
|
With the introduction of sans I/O (see #158) we are now able to support different runtimes (
std
,tokio
,async-std
) and TLS libraries (native TLS,rustls
) easily. Currently we only supporttokio
andrustls
by providing the typestream::Stream
. In the future we might add more similar implementations. But this raises couple of questions:imap-flow
crate and gated via feature flags? Should the feature flags be additive?See this discussion.
The text was updated successfully, but these errors were encountered: