chatmail / chatmail/async-native-tls
Proposal: A shared trait for tls acceptors that are implemented by both async-tls and async-native-tls
- Dominant language
- Rust
- Stars
- 74
- Forks
- 25
- PR merge metrics
- No merged PRs in 30d
Description
I have some code that implements this using wrapper types, but would really love for a trait like this to exist:
A proposed async-tls-acceptor crate that publishes this trait:
```rust
#[async_trait]
pub trait Acceptor: Clone + Send + Sync + 'static
where
Input: AsyncRead + AsyncWrite + Send + Sync + Unpin + 'static,
{
type Output: AsyncRead + AsyncWrite + Send + Sync + Unpin + 'static;
type Error: std::fmt::Debug + Send + Sync;
async fn accept(&self, input: Input) -> Result;
}
```
The implementation for async-native-tls would be:
```rust
#[async_trait]
impl Acceptor for async_native_tls::TlsAcceptor
where
Input: AsyncRead + AsyncWrite + Send + Sync + Unpin + 'static,
{
type Output = async_native_tls::TlsStream;
type Error = async_native_tls::Error;
async fn accept(&self, input: Input) -> Result {
async_native_tls::TlsAcceptor::accept(&self, input).await
}
}
```
Would this be welcomed?
refs: https://github.com/async-rs/async-tls/issues/43
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reviewing the proposed Acceptor trait and the async-tls issue referenced in the body, then compare the async-native-tls TlsAcceptor implementation with async-tls. Determine whether a shared crate and trait fit the project's direction; done would require an accepted design and corresponding implementations, but no project files or tests are named.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- networking, security
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100