Skip to content
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

Track the latest changes from upstream rustls #21

Merged
merged 14 commits into from
Sep 23, 2023
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ rustls = { version = "=0.22.0-alpha.2", default-features = false }

[features]
default = ["logging", "tls12"]
dangerous_configuration = ["rustls/dangerous_configuration"]
early-data = []
logging = ["rustls/logging"]
secret_extraction = ["rustls/secret_extraction"]
Expand All @@ -28,7 +27,10 @@ tls12 = ["rustls/tls12"]
argh = "0.1"
tokio = { version = "1.0", features = ["full"] }
futures-util = "0.3.1"
lazy_static = "1"
lazy_static = "1.1"
stevefan1999-personal marked this conversation as resolved.
Show resolved Hide resolved
webpki-roots = "=0.26.0-alpha.1"
rustls-pemfile = "=2.0.0-alpha.1"
webpki = { package = "rustls-webpki", version = "=0.102.0-alpha.2", features = ["alloc", "std"] }
webpki = { package = "rustls-webpki", version = "=0.102.0-alpha.3", features = ["alloc", "std"] }
stevefan1999-personal marked this conversation as resolved.
Show resolved Hide resolved

[patch.crates-io]
rustls = { git = 'https://github.com/rustls/rustls' }
stevefan1999-personal marked this conversation as resolved.
Show resolved Hide resolved
19 changes: 9 additions & 10 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ use std::sync::Arc;
use std::task::{Context, Poll};

pub use rustls;
use rustls::crypto::ring::Ring;
use rustls::{ClientConfig, ClientConnection, CommonState, ServerConfig, ServerConnection};
use tokio::io::{AsyncRead, AsyncWrite, ReadBuf};

Expand All @@ -68,19 +67,19 @@ pub mod server;
/// A wrapper around a `rustls::ClientConfig`, providing an async `connect` method.
#[derive(Clone)]
pub struct TlsConnector {
inner: Arc<ClientConfig<Ring>>,
inner: Arc<ClientConfig>,
#[cfg(feature = "early-data")]
early_data: bool,
}

/// A wrapper around a `rustls::ServerConfig`, providing an async `accept` method.
#[derive(Clone)]
pub struct TlsAcceptor {
inner: Arc<ServerConfig<Ring>>,
inner: Arc<ServerConfig>,
}

impl From<Arc<ClientConfig<Ring>>> for TlsConnector {
fn from(inner: Arc<ClientConfig<Ring>>) -> TlsConnector {
impl From<Arc<ClientConfig>> for TlsConnector {
fn from(inner: Arc<ClientConfig>) -> TlsConnector {
TlsConnector {
inner,
#[cfg(feature = "early-data")]
Expand All @@ -89,8 +88,8 @@ impl From<Arc<ClientConfig<Ring>>> for TlsConnector {
}
}

impl From<Arc<ServerConfig<Ring>>> for TlsAcceptor {
fn from(inner: Arc<ServerConfig<Ring>>) -> TlsAcceptor {
impl From<Arc<ServerConfig>> for TlsAcceptor {
fn from(inner: Arc<ServerConfig>) -> TlsAcceptor {
TlsAcceptor { inner }
}
}
Expand Down Expand Up @@ -214,7 +213,7 @@ where
/// # use rustls::crypto::ring::Ring;
/// # fn choose_server_config(
/// # _: rustls::server::ClientHello,
/// # ) -> std::sync::Arc<rustls::ServerConfig<Ring>> {
/// # ) -> std::sync::Arc<rustls::ServerConfig> {
/// # unimplemented!();
/// # }
/// # #[allow(unused_variables)]
Expand Down Expand Up @@ -306,11 +305,11 @@ where
self.accepted.client_hello()
}

pub fn into_stream(self, config: Arc<ServerConfig<Ring>>) -> Accept<IO> {
pub fn into_stream(self, config: Arc<ServerConfig>) -> Accept<IO> {
self.into_stream_with(config, |_| ())
}

pub fn into_stream_with<F>(self, config: Arc<ServerConfig<Ring>>, f: F) -> Accept<IO>
pub fn into_stream_with<F>(self, config: Arc<ServerConfig>, f: F) -> Accept<IO>
where
F: FnOnce(&mut ServerConnection),
{
Expand Down
Loading