From 492ac1c808e51ffab0b8be0ff86d2e7a5b9de0ec Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Fri, 25 Oct 2024 10:06:12 +0200 Subject: [PATCH] Add support for rustls with aws-lc-rs --- Cargo.toml | 8 +++++--- src/client.rs | 8 ++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index eb57707..91ab659 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,8 +8,10 @@ description = "EPP client library for async Rust" repository = "https://github.com/instant-labs/instant-epp" [features] -default = ["rustls"] -rustls = ["tokio-rustls", "rustls-native-certs"] +default = ["rustls-aws-lc-rs"] +rustls-aws-lc-rs = ["dep:tokio-rustls", "tokio-rustls/aws-lc-rs", "dep:rustls-native-certs"] +rustls-ring = ["dep:tokio-rustls", "tokio-rustls/ring", "dep:rustls-native-certs"] +__rustls = [] [dependencies] async-trait = "0.1.52" @@ -19,7 +21,7 @@ instant-xml = { version = "0.5", features = ["chrono"] } rustls-native-certs = { version = "0.8", optional = true } serde = { version = "1.0", features = ["derive"] } tokio = { version = "1.0", features = ["io-util", "net", "time"] } -tokio-rustls = { version = "0.26", optional = true, default-features = false, features = ["logging", "ring", "tls12"] } +tokio-rustls = { version = "0.26", optional = true, default-features = false, features = ["logging", "tls12"] } tracing = "0.1.29" [dev-dependencies] diff --git a/src/client.rs b/src/client.rs index 733899e..14ee530 100644 --- a/src/client.rs +++ b/src/client.rs @@ -1,6 +1,6 @@ use std::time::Duration; -#[cfg(feature = "rustls")] +#[cfg(feature = "__rustls")] use tokio_rustls::rustls::pki_types::{CertificateDer, PrivateKeyDer}; use tracing::{debug, error}; @@ -68,7 +68,7 @@ pub struct EppClient { connection: EppConnection, } -#[cfg(feature = "rustls")] +#[cfg(feature = "__rustls")] impl EppClient { /// Connect to the specified `addr` and `hostname` over TLS /// @@ -205,10 +205,10 @@ impl Clone for RequestData<'_, '_, C, E> { // Manual impl because this does not depend on whether `C` and `E` are `Copy` impl Copy for RequestData<'_, '_, C, E> {} -#[cfg(feature = "rustls")] +#[cfg(feature = "__rustls")] pub use rustls_connector::RustlsConnector; -#[cfg(feature = "rustls")] +#[cfg(feature = "__rustls")] mod rustls_connector { use std::io; use std::sync::Arc;