Skip to content

Commit

Permalink
chore: fix warnings around unused TLS code (#858)
Browse files Browse the repository at this point in the history
  • Loading branch information
djc committed Dec 7, 2021
1 parent 101f2f7 commit 5a88e11
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
5 changes: 4 additions & 1 deletion tonic/src/transport/mod.rs
Expand Up @@ -100,7 +100,7 @@ pub use self::error::Error;
pub use self::server::{NamedService, Server};
#[doc(inline)]
pub use self::service::TimeoutExpired;
pub use self::tls::{Certificate, Identity};
pub use self::tls::Certificate;
pub use hyper::{Body, Uri};

#[cfg(feature = "tls")]
Expand All @@ -109,6 +109,9 @@ pub use self::channel::ClientTlsConfig;
#[cfg(feature = "tls")]
#[cfg_attr(docsrs, doc(cfg(feature = "tls")))]
pub use self::server::ServerTlsConfig;
#[cfg(feature = "tls")]
#[cfg_attr(docsrs, doc(cfg(feature = "tls")))]
pub use self::tls::Identity;

type BoxFuture<T, E> =
std::pin::Pin<Box<dyn std::future::Future<Output = Result<T, E>> + Send + 'static>>;
7 changes: 0 additions & 7 deletions tonic/src/transport/service/tls.rs
Expand Up @@ -18,13 +18,6 @@ use tokio_rustls::{
#[cfg(feature = "tls")]
const ALPN_H2: &str = "h2";

#[derive(Debug, Clone)]
pub(crate) struct Cert {
pub(crate) ca: Vec<u8>,
pub(crate) key: Option<Vec<u8>>,
pub(crate) domain: String,
}

#[derive(Debug)]
enum TlsError {
#[allow(dead_code)]
Expand Down
3 changes: 3 additions & 0 deletions tonic/src/transport/tls.rs
Expand Up @@ -5,6 +5,8 @@ pub struct Certificate {
}

/// Represents a private key and X509 certificate.
#[cfg(feature = "tls")]
#[cfg_attr(docsrs, doc(cfg(feature = "tls")))]
#[derive(Debug, Clone)]
pub struct Identity {
pub(crate) cert: Certificate,
Expand Down Expand Up @@ -42,6 +44,7 @@ impl AsRef<[u8]> for Certificate {
}
}

#[cfg(feature = "tls")]
impl Identity {
/// Parse a PEM encoded certificate and private key.
///
Expand Down

0 comments on commit 5a88e11

Please sign in to comment.