diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 7d1ca32db..d7ce9c95c 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -62,10 +62,13 @@ jobs: - uses: taiki-e/install-action@cargo-udeps - uses: taiki-e/install-action@protoc - uses: Swatinem/rust-cache@v2 - - run: cargo hack udeps --workspace --exclude-features tls --each-feature - - run: cargo udeps --package tonic --features tls,transport - - run: cargo udeps --package tonic --features tls,server - - run: cargo udeps --package tonic --features tls,channel + - run: cargo hack udeps --workspace --exclude-features=_tls-any,tls,tls-aws-lc,tls-ring --each-feature + - run: cargo udeps --package tonic --features tls-ring,transport + - run: cargo udeps --package tonic --features tls-ring,server + - run: cargo udeps --package tonic --features tls-ring,channel + - run: cargo udeps --package tonic --features tls-aws-lc,transport + - run: cargo udeps --package tonic --features tls-aws-lc,server + - run: cargo udeps --package tonic --features tls-aws-lc,channel check: runs-on: ${{ matrix.os }} diff --git a/tests/integration_tests/Cargo.toml b/tests/integration_tests/Cargo.toml index 8993723a9..04899ab7a 100644 --- a/tests/integration_tests/Cargo.toml +++ b/tests/integration_tests/Cargo.toml @@ -20,6 +20,7 @@ async-stream = "0.3" http = "1" http-body = "1" hyper-util = "0.1" +rustls = {version = "0.23", features = ["ring"]} tokio-stream = {version = "0.1.5", features = ["net"]} tower = "0.5" tower-http = { version = "0.6", features = ["set-header", "trace"] } diff --git a/tests/integration_tests/tests/connection.rs b/tests/integration_tests/tests/connection.rs index 841600bcf..3cf15ebe0 100644 --- a/tests/integration_tests/tests/connection.rs +++ b/tests/integration_tests/tests/connection.rs @@ -28,6 +28,9 @@ async fn connect_returns_err() { #[tokio::test] async fn connect_handles_tls() { + rustls::crypto::ring::default_provider() + .install_default() + .unwrap(); TestClient::connect("https://example.com").await.unwrap(); } diff --git a/tonic/Cargo.toml b/tonic/Cargo.toml index 186d3c03d..395670f8f 100644 --- a/tonic/Cargo.toml +++ b/tonic/Cargo.toml @@ -28,10 +28,13 @@ gzip = ["dep:flate2"] zstd = ["dep:zstd"] default = ["transport", "codegen", "prost"] prost = ["dep:prost"] -tls = ["dep:rustls-pemfile", "dep:tokio-rustls", "dep:tokio", "tokio?/rt", "tokio?/macros"] +_tls-any = ["dep:rustls-pemfile", "dep:tokio-rustls", "dep:tokio", "tokio?/rt", "tokio?/macros"] # Internal. Please choose one of `tls-ring` or `tls-aws-lc` +tls = ["tls-ring"] # Deprecated. Please use `tls-ring` or `tls-aws-lc` instead. +tls-ring = ["_tls-any", "tokio-rustls/ring"] +tls-aws-lc = ["_tls-any", "tokio-rustls/aws-lc-rs"] tls-roots = ["tls-native-roots"] # Deprecated. Please use `tls-native-roots` instead. -tls-native-roots = ["tls", "channel", "dep:rustls-native-certs"] -tls-webpki-roots = ["tls", "channel", "dep:webpki-roots"] +tls-native-roots = ["_tls-any", "channel", "dep:rustls-native-certs"] +tls-webpki-roots = ["_tls-any","channel", "dep:webpki-roots"] router = ["dep:axum", "dep:tower", "tower?/util"] server = [ "router", @@ -90,7 +93,7 @@ axum = {version = "0.7", default-features = false, optional = true} # rustls rustls-pemfile = { version = "2.0", optional = true } rustls-native-certs = { version = "0.8", optional = true } -tokio-rustls = { version = "0.26", default-features = false, features = ["logging", "tls12", "ring"], optional = true } +tokio-rustls = { version = "0.26", default-features = false, features = ["logging", "tls12"], optional = true } webpki-roots = { version = "0.26", optional = true } # compression diff --git a/tonic/src/lib.rs b/tonic/src/lib.rs index 3e818102e..cfa841aef 100644 --- a/tonic/src/lib.rs +++ b/tonic/src/lib.rs @@ -24,8 +24,11 @@ //! - `router`: Enables the [`axum`] based service router. Enabled by default. //! - `codegen`: Enables all the required exports and optional dependencies required //! for [`tonic-build`]. Enabled by default. -//! - `tls`: Enables the [`rustls`] based TLS options for the `transport` feature. Not -//! enabled by default. +//! - `tls`: Deprecated. An alias to `tls-ring` +//! - `tls-ring`: Enables the [`rustls`] based TLS options for the `transport` feature using +//! the [`ring`]` libcrypto provider. Not enabled by default. +//! - `tls-aws-lc`: Enables the [`rustls`] based TLS options for the `transport` feature using +//! the [`aws-lc-rs`] libcrypto provider. Not enabled by default. //! - `tls-roots`: Deprecated. An alias to `tls-native-roots` feature. //! - `tls-native-roots`: Adds system trust roots to [`rustls`]-based gRPC clients using the //! [`rustls-native-certs`] crate. Not enabled by default. @@ -71,6 +74,7 @@ //! [`hyper`]: https://docs.rs/hyper //! [`tower`]: https://docs.rs/tower //! [`tonic-build`]: https://docs.rs/tonic-build +//! [`ring`]: https://docs.rs/ring //! [`tonic-examples`]: https://github.com/hyperium/tonic/tree/master/examples //! [`Codec`]: codec/trait.Codec.html //! [`Channel`]: transport/struct.Channel.html diff --git a/tonic/src/request.rs b/tonic/src/request.rs index 592d71576..531f42653 100644 --- a/tonic/src/request.rs +++ b/tonic/src/request.rs @@ -1,15 +1,15 @@ use crate::metadata::{MetadataMap, MetadataValue}; #[cfg(feature = "server")] use crate::transport::server::TcpConnectInfo; -#[cfg(all(feature = "server", feature = "tls"))] +#[cfg(all(feature = "server", feature = "_tls-any"))] use crate::transport::server::TlsConnectInfo; use http::Extensions; #[cfg(feature = "server")] use std::net::SocketAddr; -#[cfg(all(feature = "server", feature = "tls"))] +#[cfg(all(feature = "server", feature = "_tls-any"))] use std::sync::Arc; use std::time::Duration; -#[cfg(all(feature = "server", feature = "tls"))] +#[cfg(all(feature = "server", feature = "_tls-any"))] use tokio_rustls::rustls::pki_types::CertificateDer; use tokio_stream::Stream; @@ -218,7 +218,7 @@ impl Request { .get::() .and_then(|i| i.local_addr()); - #[cfg(feature = "tls")] + #[cfg(feature = "_tls-any")] let addr = addr.or_else(|| { self.extensions() .get::>() @@ -240,7 +240,7 @@ impl Request { .get::() .and_then(|i| i.remote_addr()); - #[cfg(feature = "tls")] + #[cfg(feature = "_tls-any")] let addr = addr.or_else(|| { self.extensions() .get::>() @@ -256,7 +256,7 @@ impl Request { /// and is mostly used for mTLS. This currently only returns /// `Some` on the server side of the `transport` server with /// TLS enabled connections. - #[cfg(all(feature = "server", feature = "tls"))] + #[cfg(all(feature = "server", feature = "_tls-any"))] pub fn peer_certs(&self) -> Option>>> { self.extensions() .get::>() diff --git a/tonic/src/transport/channel/endpoint.rs b/tonic/src/transport/channel/endpoint.rs index 4da6cdabf..5b97ebeda 100644 --- a/tonic/src/transport/channel/endpoint.rs +++ b/tonic/src/transport/channel/endpoint.rs @@ -1,8 +1,8 @@ -#[cfg(feature = "tls")] +#[cfg(feature = "_tls-any")] use super::service::TlsConnector; use super::service::{self, Executor, SharedExec}; use super::Channel; -#[cfg(feature = "tls")] +#[cfg(feature = "_tls-any")] use super::ClientTlsConfig; use crate::transport::Error; use bytes::Bytes; @@ -23,7 +23,7 @@ pub struct Endpoint { pub(crate) timeout: Option, pub(crate) concurrency_limit: Option, pub(crate) rate_limit: Option<(u64, Duration)>, - #[cfg(feature = "tls")] + #[cfg(feature = "_tls-any")] pub(crate) tls: Option, pub(crate) buffer_size: Option, pub(crate) init_stream_window_size: Option, @@ -49,7 +49,7 @@ impl Endpoint { D::Error: Into, { let me = dst.try_into().map_err(|e| Error::from_source(e.into()))?; - #[cfg(feature = "tls")] + #[cfg(feature = "_tls-any")] if me.uri.scheme() == Some(&http::uri::Scheme::HTTPS) { return me.tls_config(ClientTlsConfig::new().with_enabled_roots()); } @@ -244,7 +244,7 @@ impl Endpoint { } /// Configures TLS for the endpoint. - #[cfg(feature = "tls")] + #[cfg(feature = "_tls-any")] pub fn tls_config(self, tls_config: ClientTlsConfig) -> Result { Ok(Endpoint { tls: Some( @@ -320,7 +320,7 @@ impl Endpoint { pub(crate) fn connector(&self, c: C) -> service::Connector { service::Connector::new( c, - #[cfg(feature = "tls")] + #[cfg(feature = "_tls-any")] self.tls.clone(), ) } @@ -445,7 +445,7 @@ impl From for Endpoint { concurrency_limit: None, rate_limit: None, timeout: None, - #[cfg(feature = "tls")] + #[cfg(feature = "_tls-any")] tls: None, buffer_size: None, init_stream_window_size: None, diff --git a/tonic/src/transport/channel/mod.rs b/tonic/src/transport/channel/mod.rs index c1bee0140..0da5cea1d 100644 --- a/tonic/src/transport/channel/mod.rs +++ b/tonic/src/transport/channel/mod.rs @@ -2,11 +2,11 @@ mod endpoint; pub(crate) mod service; -#[cfg(feature = "tls")] +#[cfg(feature = "_tls-any")] mod tls; pub use endpoint::Endpoint; -#[cfg(feature = "tls")] +#[cfg(feature = "_tls-any")] pub use tls::ClientTlsConfig; use self::service::{Connection, DynamicServiceStream, Executor, SharedExec}; diff --git a/tonic/src/transport/channel/service/connector.rs b/tonic/src/transport/channel/service/connector.rs index 4a6010a82..627630edd 100644 --- a/tonic/src/transport/channel/service/connector.rs +++ b/tonic/src/transport/channel/service/connector.rs @@ -1,30 +1,30 @@ use super::BoxedIo; -#[cfg(feature = "tls")] +#[cfg(feature = "_tls-any")] use super::TlsConnector; use crate::transport::channel::BoxFuture; use crate::ConnectError; use http::Uri; -#[cfg(feature = "tls")] +#[cfg(feature = "_tls-any")] use std::fmt; use std::task::{Context, Poll}; use hyper::rt; -#[cfg(feature = "tls")] +#[cfg(feature = "_tls-any")] use hyper_util::rt::TokioIo; use tower_service::Service; pub(crate) struct Connector { inner: C, - #[cfg(feature = "tls")] + #[cfg(feature = "_tls-any")] tls: Option, } impl Connector { - pub(crate) fn new(inner: C, #[cfg(feature = "tls")] tls: Option) -> Self { + pub(crate) fn new(inner: C, #[cfg(feature = "_tls-any")] tls: Option) -> Self { Self { inner, - #[cfg(feature = "tls")] + #[cfg(feature = "_tls-any")] tls, } } @@ -48,10 +48,10 @@ where } fn call(&mut self, uri: Uri) -> Self::Future { - #[cfg(feature = "tls")] + #[cfg(feature = "_tls-any")] let tls = self.tls.clone(); - #[cfg(feature = "tls")] + #[cfg(feature = "_tls-any")] let is_https = uri.scheme_str() == Some("https"); let connect = self.inner.call(uri); @@ -59,7 +59,7 @@ where async { let io = connect.await?; - #[cfg(feature = "tls")] + #[cfg(feature = "_tls-any")] if is_https { return if let Some(tls) = tls { let io = tls.connect(TokioIo::new(io)).await?; @@ -78,11 +78,11 @@ where } /// Error returned when trying to connect to an HTTPS endpoint without TLS enabled. -#[cfg(feature = "tls")] +#[cfg(feature = "_tls-any")] #[derive(Debug)] pub(crate) struct HttpsUriWithoutTlsSupport(()); -#[cfg(feature = "tls")] +#[cfg(feature = "_tls-any")] impl fmt::Display for HttpsUriWithoutTlsSupport { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "Connecting to HTTPS without TLS enabled") @@ -90,5 +90,5 @@ impl fmt::Display for HttpsUriWithoutTlsSupport { } // std::error::Error only requires a type to impl Debug and Display -#[cfg(feature = "tls")] +#[cfg(feature = "_tls-any")] impl std::error::Error for HttpsUriWithoutTlsSupport {} diff --git a/tonic/src/transport/channel/service/mod.rs b/tonic/src/transport/channel/service/mod.rs index cd481e9a4..c94104f4f 100644 --- a/tonic/src/transport/channel/service/mod.rs +++ b/tonic/src/transport/channel/service/mod.rs @@ -22,7 +22,7 @@ pub(crate) use self::connector::Connector; mod executor; pub(super) use self::executor::{Executor, SharedExec}; -#[cfg(feature = "tls")] +#[cfg(feature = "_tls-any")] mod tls; -#[cfg(feature = "tls")] +#[cfg(feature = "_tls-any")] pub(super) use self::tls::TlsConnector; diff --git a/tonic/src/transport/mod.rs b/tonic/src/transport/mod.rs index c81208d0e..a75ce9d49 100644 --- a/tonic/src/transport/mod.rs +++ b/tonic/src/transport/mod.rs @@ -96,7 +96,7 @@ pub mod server; mod error; mod service; -#[cfg(feature = "tls")] +#[cfg(feature = "_tls-any")] mod tls; #[doc(inline)] @@ -109,15 +109,15 @@ pub use self::server::Server; /// Deprecated. Please use [`crate::status::TimeoutExpired`] instead. pub use crate::status::TimeoutExpired; -#[cfg(feature = "tls")] +#[cfg(feature = "_tls-any")] pub use self::tls::Certificate; pub use hyper::{body::Body, Uri}; -#[cfg(feature = "tls")] +#[cfg(feature = "_tls-any")] pub use tokio_rustls::rustls::pki_types::CertificateDer; -#[cfg(all(feature = "channel", feature = "tls"))] +#[cfg(all(feature = "channel", feature = "_tls-any"))] pub use self::channel::ClientTlsConfig; -#[cfg(all(feature = "server", feature = "tls"))] +#[cfg(all(feature = "server", feature = "_tls-any"))] pub use self::server::ServerTlsConfig; -#[cfg(feature = "tls")] +#[cfg(feature = "_tls-any")] pub use self::tls::Identity; diff --git a/tonic/src/transport/server/conn.rs b/tonic/src/transport/server/conn.rs index f0fee4fc3..c626af9ce 100644 --- a/tonic/src/transport/server/conn.rs +++ b/tonic/src/transport/server/conn.rs @@ -1,11 +1,11 @@ use std::net::SocketAddr; use tokio::net::TcpStream; -#[cfg(feature = "tls")] +#[cfg(feature = "_tls-any")] use std::sync::Arc; -#[cfg(feature = "tls")] +#[cfg(feature = "_tls-any")] use tokio_rustls::rustls::pki_types::CertificateDer; -#[cfg(feature = "tls")] +#[cfg(feature = "_tls-any")] use tokio_rustls::server::TlsStream; /// Trait that connected IO resources implement and use to produce info about the connection. @@ -102,7 +102,7 @@ impl Connected for tokio::io::DuplexStream { fn connect_info(&self) -> Self::ConnectInfo {} } -#[cfg(feature = "tls")] +#[cfg(feature = "_tls-any")] impl Connected for TlsStream where T: Connected, @@ -128,14 +128,14 @@ where /// See [`Connected`] for more details. /// /// [ext]: crate::Request::extensions -#[cfg(feature = "tls")] +#[cfg(feature = "_tls-any")] #[derive(Debug, Clone)] pub struct TlsConnectInfo { inner: T, certs: Option>>>, } -#[cfg(feature = "tls")] +#[cfg(feature = "_tls-any")] impl TlsConnectInfo { /// Get a reference to the underlying connection info. pub fn get_ref(&self) -> &T { diff --git a/tonic/src/transport/server/incoming.rs b/tonic/src/transport/server/incoming.rs index e0751e739..50ee5da0e 100644 --- a/tonic/src/transport/server/incoming.rs +++ b/tonic/src/transport/server/incoming.rs @@ -16,10 +16,10 @@ use tokio_stream::{Stream, StreamExt}; use tracing::warn; use super::service::ServerIo; -#[cfg(feature = "tls")] +#[cfg(feature = "_tls-any")] use super::service::TlsAcceptor; -#[cfg(not(feature = "tls"))] +#[cfg(not(feature = "_tls-any"))] pub(crate) fn tcp_incoming( incoming: impl Stream>, ) -> impl Stream, crate::BoxError>> @@ -42,7 +42,7 @@ where } } -#[cfg(feature = "tls")] +#[cfg(feature = "_tls-any")] pub(crate) fn tcp_incoming( incoming: impl Stream>, tls: Option, @@ -112,7 +112,7 @@ fn handle_tcp_accept_error(e: impl Into) -> ControlFlow( incoming: &mut (impl Stream> + Unpin), tasks: &mut tokio::task::JoinSet, crate::BoxError>>, @@ -147,7 +147,7 @@ where } } -#[cfg(feature = "tls")] +#[cfg(feature = "_tls-any")] enum SelectOutput { Incoming(A), Io(ServerIo), diff --git a/tonic/src/transport/server/mod.rs b/tonic/src/transport/server/mod.rs index 20394aa8c..77c379f23 100644 --- a/tonic/src/transport/server/mod.rs +++ b/tonic/src/transport/server/mod.rs @@ -3,7 +3,7 @@ mod conn; mod incoming; mod service; -#[cfg(feature = "tls")] +#[cfg(feature = "_tls-any")] mod tls; #[cfg(unix)] mod unix; @@ -19,13 +19,13 @@ use hyper_util::{ server::conn::auto::{Builder as ConnectionBuilder, HttpServerConnExec}, service::TowerToHyperService, }; -#[cfg(feature = "tls")] +#[cfg(feature = "_tls-any")] pub use tls::ServerTlsConfig; -#[cfg(feature = "tls")] +#[cfg(feature = "_tls-any")] pub use conn::TlsConnectInfo; -#[cfg(feature = "tls")] +#[cfg(feature = "_tls-any")] use self::service::TlsAcceptor; #[cfg(unix)] @@ -33,7 +33,7 @@ pub use unix::UdsConnectInfo; pub use incoming::TcpIncoming; -#[cfg(feature = "tls")] +#[cfg(feature = "_tls-any")] use crate::transport::Error; use self::service::{RecoverError, ServerIo}; @@ -87,7 +87,7 @@ pub struct Server { trace_interceptor: Option, concurrency_limit: Option, timeout: Option, - #[cfg(feature = "tls")] + #[cfg(feature = "_tls-any")] tls: Option, init_stream_window_size: Option, init_connection_window_size: Option, @@ -111,7 +111,7 @@ impl Default for Server { trace_interceptor: None, concurrency_limit: None, timeout: None, - #[cfg(feature = "tls")] + #[cfg(feature = "_tls-any")] tls: None, init_stream_window_size: None, init_connection_window_size: None, @@ -155,7 +155,7 @@ impl Server { impl Server { /// Configure TLS for this server. - #[cfg(feature = "tls")] + #[cfg(feature = "_tls-any")] pub fn tls_config(self, tls_config: ServerTlsConfig) -> Result { Ok(Server { tls: Some(tls_config.tls_acceptor().map_err(Error::from_source)?), @@ -510,7 +510,7 @@ impl Server { trace_interceptor: self.trace_interceptor, concurrency_limit: self.concurrency_limit, timeout: self.timeout, - #[cfg(feature = "tls")] + #[cfg(feature = "_tls-any")] tls: self.tls, init_stream_window_size: self.init_stream_window_size, init_connection_window_size: self.init_connection_window_size, @@ -570,7 +570,7 @@ impl Server { let incoming = incoming::tcp_incoming( incoming, - #[cfg(feature = "tls")] + #[cfg(feature = "_tls-any")] self.tls, ); let mut svc = MakeSvc { @@ -1032,13 +1032,13 @@ where request.extensions_mut().insert(inner.clone()); } tower::util::Either::Right(inner) => { - #[cfg(feature = "tls")] + #[cfg(feature = "_tls-any")] { request.extensions_mut().insert(inner.clone()); request.extensions_mut().insert(inner.get_ref().clone()); } - #[cfg(not(feature = "tls"))] + #[cfg(not(feature = "_tls-any"))] { // just a type check to make sure we didn't forget to // insert this into the extensions diff --git a/tonic/src/transport/server/service/io.rs b/tonic/src/transport/server/service/io.rs index bfb441e88..ed43e78a3 100644 --- a/tonic/src/transport/server/service/io.rs +++ b/tonic/src/transport/server/service/io.rs @@ -4,22 +4,22 @@ use std::io::IoSlice; use std::pin::Pin; use std::task::{Context, Poll}; use tokio::io::{AsyncRead, AsyncWrite, ReadBuf}; -#[cfg(feature = "tls")] +#[cfg(feature = "_tls-any")] use tokio_rustls::server::TlsStream; pub(crate) enum ServerIo { Io(IO), - #[cfg(feature = "tls")] + #[cfg(feature = "_tls-any")] TlsIo(Box>), } use tower::util::Either; -#[cfg(feature = "tls")] +#[cfg(feature = "_tls-any")] type ServerIoConnectInfo = Either<::ConnectInfo, as Connected>::ConnectInfo>; -#[cfg(not(feature = "tls"))] +#[cfg(not(feature = "_tls-any"))] type ServerIoConnectInfo = Either<::ConnectInfo, ()>; impl ServerIo { @@ -27,7 +27,7 @@ impl ServerIo { Self::Io(io) } - #[cfg(feature = "tls")] + #[cfg(feature = "_tls-any")] pub(in crate::transport) fn new_tls_io(io: TlsStream) -> Self { Self::TlsIo(Box::new(io)) } @@ -38,7 +38,7 @@ impl ServerIo { { match self { Self::Io(io) => Either::Left(io.connect_info()), - #[cfg(feature = "tls")] + #[cfg(feature = "_tls-any")] Self::TlsIo(io) => Either::Right(io.connect_info()), } } @@ -55,7 +55,7 @@ where ) -> Poll> { match &mut *self { Self::Io(io) => Pin::new(io).poll_read(cx, buf), - #[cfg(feature = "tls")] + #[cfg(feature = "_tls-any")] Self::TlsIo(io) => Pin::new(io).poll_read(cx, buf), } } @@ -72,7 +72,7 @@ where ) -> Poll> { match &mut *self { Self::Io(io) => Pin::new(io).poll_write(cx, buf), - #[cfg(feature = "tls")] + #[cfg(feature = "_tls-any")] Self::TlsIo(io) => Pin::new(io).poll_write(cx, buf), } } @@ -80,7 +80,7 @@ where fn poll_flush(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { match &mut *self { Self::Io(io) => Pin::new(io).poll_flush(cx), - #[cfg(feature = "tls")] + #[cfg(feature = "_tls-any")] Self::TlsIo(io) => Pin::new(io).poll_flush(cx), } } @@ -88,7 +88,7 @@ where fn poll_shutdown(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { match &mut *self { Self::Io(io) => Pin::new(io).poll_shutdown(cx), - #[cfg(feature = "tls")] + #[cfg(feature = "_tls-any")] Self::TlsIo(io) => Pin::new(io).poll_shutdown(cx), } } @@ -100,7 +100,7 @@ where ) -> Poll> { match &mut *self { Self::Io(io) => Pin::new(io).poll_write_vectored(cx, bufs), - #[cfg(feature = "tls")] + #[cfg(feature = "_tls-any")] Self::TlsIo(io) => Pin::new(io).poll_write_vectored(cx, bufs), } } @@ -108,7 +108,7 @@ where fn is_write_vectored(&self) -> bool { match self { Self::Io(io) => io.is_write_vectored(), - #[cfg(feature = "tls")] + #[cfg(feature = "_tls-any")] Self::TlsIo(io) => io.is_write_vectored(), } } diff --git a/tonic/src/transport/server/service/mod.rs b/tonic/src/transport/server/service/mod.rs index 5043339e4..b5fce0923 100644 --- a/tonic/src/transport/server/service/mod.rs +++ b/tonic/src/transport/server/service/mod.rs @@ -4,7 +4,7 @@ pub(crate) use self::io::ServerIo; mod recover_error; pub(crate) use self::recover_error::RecoverError; -#[cfg(feature = "tls")] +#[cfg(feature = "_tls-any")] mod tls; -#[cfg(feature = "tls")] +#[cfg(feature = "_tls-any")] pub(crate) use self::tls::TlsAcceptor; diff --git a/tonic/src/transport/service/mod.rs b/tonic/src/transport/service/mod.rs index 7f1e3fcae..b41869c7c 100644 --- a/tonic/src/transport/service/mod.rs +++ b/tonic/src/transport/service/mod.rs @@ -1,5 +1,5 @@ pub(crate) mod grpc_timeout; -#[cfg(feature = "tls")] +#[cfg(feature = "_tls-any")] pub(crate) mod tls; pub(crate) use self::grpc_timeout::GrpcTimeout;