Skip to content

Commit

Permalink
chore(tonic): Remove duplicate tls feature gate and re-export http cr…
Browse files Browse the repository at this point in the history
…ate instead of using wildcard importing (#1281)

* chore(tonic): Remove duplicate tls feature gate

* chore(tonic): Re export http crate instead of using wildcard importing
  • Loading branch information
tottoto authored Feb 21, 2023
1 parent 9f716d8 commit 79d0e3f
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 12 deletions.
5 changes: 1 addition & 4 deletions tonic/src/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,11 @@ pub type StdError = Box<dyn std::error::Error + Send + Sync + 'static>;
pub use crate::codec::{CompressionEncoding, EnabledCompressionEncodings};
pub use crate::service::interceptor::InterceptedService;
pub use bytes::Bytes;
pub use http;
pub use http_body::Body;

pub type BoxFuture<T, E> = self::Pin<Box<dyn self::Future<Output = Result<T, E>> + Send + 'static>>;
pub type BoxStream<T> =
self::Pin<Box<dyn futures_core::Stream<Item = Result<T, crate::Status>> + Send + 'static>>;

pub mod http {
pub use http::*;
}

pub use crate::body::empty_body;
4 changes: 0 additions & 4 deletions tonic/src/transport/channel/tls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,13 @@ use http::Uri;
use std::fmt;

/// Configures TLS settings for endpoints.
#[cfg(feature = "tls")]
#[cfg_attr(docsrs, doc(cfg(feature = "tls")))]
#[derive(Clone, Default)]
pub struct ClientTlsConfig {
domain: Option<String>,
cert: Option<Certificate>,
identity: Option<Identity>,
}

#[cfg(feature = "tls")]
impl fmt::Debug for ClientTlsConfig {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("ClientTlsConfig")
Expand All @@ -27,7 +24,6 @@ impl fmt::Debug for ClientTlsConfig {
}
}

#[cfg(feature = "tls")]
impl ClientTlsConfig {
/// Creates a new `ClientTlsConfig` using Rustls.
pub fn new() -> Self {
Expand Down
4 changes: 0 additions & 4 deletions tonic/src/transport/server/tls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,19 @@ use crate::transport::{
use std::fmt;

/// Configures TLS settings for servers.
#[cfg(feature = "tls")]
#[cfg_attr(docsrs, doc(cfg(feature = "tls")))]
#[derive(Clone, Default)]
pub struct ServerTlsConfig {
identity: Option<Identity>,
client_ca_root: Option<Certificate>,
client_auth_optional: bool,
}

#[cfg(feature = "tls")]
impl fmt::Debug for ServerTlsConfig {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("ServerTlsConfig").finish()
}
}

#[cfg(feature = "tls")]
impl ServerTlsConfig {
/// Creates a new `ServerTlsConfig`.
pub fn new() -> Self {
Expand Down

0 comments on commit 79d0e3f

Please sign in to comment.