Skip to content

Commit c6bc6a8

Browse files
committed
fix(tls): change from tls for native_tls for re-exports
1 parent f0dd32e commit c6bc6a8

File tree

4 files changed

+11
-12
lines changed

4 files changed

+11
-12
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ with the `tls` feature flag enabled.
145145
When using TLS, some additional information is required. You will need to make [`TlsAcceptor`] and
146146
`client::tls::Context` structs; `client::tls::Context` requires a [`TlsConnector`]. The
147147
[`TlsAcceptor`] and [`TlsConnector`] types are defined in the [native-tls]. tarpc re-exports
148-
external TLS-related types in its `tls` module (`tarpc::tls`).
148+
external TLS-related types in its `native_tls` module (`tarpc::native_tls`).
149149

150150
[TLS]: https://en.wikipedia.org/wiki/Transport_Layer_Security
151151
[`TcpStream`]: https://docs.rs/tokio-core/0.1/tokio_core/net/struct.TcpStream.html
@@ -172,7 +172,7 @@ use tarpc::{client, server};
172172
use tarpc::client::future::Connect;
173173
use tarpc::util::{FirstSocketAddr, Never};
174174
use tokio_core::reactor;
175-
use tarpc::tls::{Pkcs12, TlsAcceptor};
175+
use tarpc::native_tls::{Pkcs12, TlsAcceptor};
176176

177177
service! {
178178
rpc hello(name: String) -> String;

src/client.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ type BindClient<Req, Resp, E> = <Proto<Req, Result<Resp, WireError<E>>> as
2727
/// TLS-specific functionality
2828
#[cfg(feature = "tls")]
2929
pub mod tls {
30-
use native_tls::TlsConnector;
30+
use native_tls::{Error, TlsConnector};
3131

3232
/// TLS context for client
3333
pub struct Context {
@@ -43,7 +43,7 @@ pub mod tls {
4343
/// The provided domain will be used for both
4444
/// [SNI](https://en.wikipedia.org/wiki/Server_Name_Indication) and certificate hostname
4545
/// validation.
46-
pub fn new<S: Into<String>>(domain: S) -> Result<Self, ::tls::NativeTlsError> {
46+
pub fn new<S: Into<String>>(domain: S) -> Result<Self, Error> {
4747
Ok(Context {
4848
domain: domain.into(),
4949
tls_connector: TlsConnector::builder()?.build()?,

src/lib.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
//! use tarpc::{client, server};
7373
//! use tarpc::client::sync::Connect;
7474
//! use tarpc::util::Never;
75-
//! use tarpc::tls::{TlsAcceptor, Pkcs12};
75+
//! use tarpc::native_tls::{TlsAcceptor, Pkcs12};
7676
//!
7777
//! service! {
7878
//! rpc hello(name: String) -> String;
@@ -192,12 +192,11 @@ enum Reactor {
192192
cfg_if! {
193193
if #[cfg(feature = "tls")] {
194194
extern crate tokio_tls;
195-
extern crate native_tls;
195+
extern crate native_tls as native_tls_inner;
196196

197197
/// Re-exported TLS-related types
198-
pub mod tls {
199-
pub use native_tls::Error as NativeTlsError;
200-
pub use native_tls::{Pkcs12, TlsAcceptor, TlsConnector};
198+
pub mod native_tls {
199+
pub use native_tls_inner::{Error, Pkcs12, TlsAcceptor, TlsConnector};
201200
}
202201
} else {}
203202
}

src/macros.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ mod functional_test {
720720
const DOMAIN: &'static str = "foobar.com";
721721

722722
use client::tls::Context;
723-
use ::native_tls::{Pkcs12, TlsAcceptor, TlsConnector};
723+
use native_tls::{Pkcs12, TlsAcceptor, TlsConnector};
724724

725725
fn tls_context() -> (server::Options, client::Options) {
726726
let buf = include_bytes!("../test/identity.p12");
@@ -741,7 +741,7 @@ mod functional_test {
741741
extern crate security_framework;
742742

743743
use self::security_framework::certificate::SecCertificate;
744-
use native_tls::backend::security_framework::TlsConnectorBuilderExt;
744+
use native_tls_inner::backend::security_framework::TlsConnectorBuilderExt;
745745

746746
fn get_tls_client_options() -> client::Options {
747747
let buf = include_bytes!("../test/root-ca.der");
@@ -755,7 +755,7 @@ mod functional_test {
755755
})
756756
}
757757
} else if #[cfg(all(not(target_os = "macos"), not(windows)))] {
758-
use native_tls::backend::openssl::TlsConnectorBuilderExt;
758+
use native_tls_inner::backend::openssl::TlsConnectorBuilderExt;
759759

760760
fn get_tls_client_options() -> client::Options {
761761
let mut connector = unwrap!(TlsConnector::builder());

0 commit comments

Comments
 (0)