You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
s2n-tls-hyper provides hyper 1.x client compatibility. Hyper 1.x servers can use s2n-tls-tokio directly, and as such, no support is provided in s2n-tls-hyper.
However, hyper 0.x servers do require a compatibility layer in order to work with s2n-tls. We should provide support for this in s2n-tls-hyper, for applications that haven't yet migrated to hyper 1.x.
Solution:
@jmayclin implemented the following tls-listener adapter for s2n-tls, which allows s2n-tls to be used with the hyper 0.x server.
tls-listener adapter
// this struct is a new-type wrapper to allow a foreign trait to be implemented
// on the TlsAcceptor struct
#[derive(Clone)]
pub struct MyS2NAcceptor(s2n_tls_tokio::TlsAcceptor);
impl MyS2NAcceptor {
/// create an S2NAcceptor from an S2N Config.
pub fn new(config: s2n_tls::config::Config) -> Self {
let acceptor = s2n_tls_tokio::TlsAcceptor::new(config);
MyS2NAcceptor(acceptor)
}
}
// implement the tls_listener::AsyncTls trait over a connection type C, for MyS2NTokioAcceptor
impl tls_listener::AsyncTls for MyS2NAcceptor {
type Stream = s2n_tls_tokio::TlsStream;
type Error = s2n_tls::error::Error;
type AcceptFuture = Pin> + Send>>;
fn accept(&self, stream: C) -> Self::AcceptFuture {
let tls = self.clone();
Box::pin(async move { s2n_tls_tokio::TlsAcceptor::accept(&tls.0, stream).await })
}
}
We should add this tls-listener adapter to s2n-tls-hyper behind a feature flag.
Problem:
s2n-tls-hyper provides hyper 1.x client compatibility. Hyper 1.x servers can use s2n-tls-tokio directly, and as such, no support is provided in s2n-tls-hyper.
However, hyper 0.x servers do require a compatibility layer in order to work with s2n-tls. We should provide support for this in s2n-tls-hyper, for applications that haven't yet migrated to hyper 1.x.
Solution:
@jmayclin implemented the following tls-listener adapter for s2n-tls, which allows s2n-tls to be used with the hyper 0.x server.
tls-listener adapter
We should add this tls-listener adapter to s2n-tls-hyper behind a feature flag.
Requirements / Acceptance Criteria:
In addition to this adapter, we should add a self-talk test that echos bytes to a client, similar to the existing hyper 1.x client self-talk tests.
The text was updated successfully, but these errors were encountered: