upgrade trust-dns-native-tls to Tokio 0.3
This commit is contained in:
parent
4e322683dd
commit
a9a831fc1a
14
Cargo.lock
generated
14
Cargo.lock
generated
@ -1615,6 +1615,16 @@ dependencies = [
|
||||
"tokio 0.2.22",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-native-tls"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "501c8252b73bd01379aaae1521523c2629ff1bc6ea46c29e0baff515cee60f1b"
|
||||
dependencies = [
|
||||
"native-tls",
|
||||
"tokio 0.3.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-openssl"
|
||||
version = "0.4.0"
|
||||
@ -1844,7 +1854,7 @@ dependencies = [
|
||||
"futures-util",
|
||||
"native-tls",
|
||||
"tokio 0.3.3",
|
||||
"tokio-native-tls",
|
||||
"tokio-native-tls 0.2.0",
|
||||
"trust-dns-proto",
|
||||
]
|
||||
|
||||
@ -1910,7 +1920,7 @@ dependencies = [
|
||||
"smallvec",
|
||||
"thiserror",
|
||||
"tokio 0.3.3",
|
||||
"tokio-native-tls",
|
||||
"tokio-native-tls 0.1.0",
|
||||
"tokio-openssl 0.4.0",
|
||||
"tokio-rustls 0.14.1",
|
||||
"trust-dns-https",
|
||||
|
@ -51,7 +51,7 @@ futures-channel = { version = "0.3.5", default-features = false, features = ["st
|
||||
futures-util = { version = "0.3.5", default-features = false, features = ["std"] }
|
||||
native-tls = "0.2"
|
||||
tokio = "0.3.0"
|
||||
tokio-native-tls = "0.1"
|
||||
tokio-native-tls = "0.2.0"
|
||||
# disables default features, i.e. openssl...
|
||||
trust-dns-proto = { version = "0.20.0-alpha.3", path = "../proto", features = ["tokio-runtime"], default-features = false }
|
||||
|
||||
|
@ -87,7 +87,8 @@ fn tls_client_stream_test(server_addr: IpAddr, mtls: bool) {
|
||||
}
|
||||
}
|
||||
|
||||
panic!("timeout");
|
||||
println!("Thread Killer has been awoken, killing process");
|
||||
std::process::exit(-1);
|
||||
})
|
||||
.unwrap();
|
||||
|
||||
|
@ -19,7 +19,7 @@ use tokio::net::TcpStream as TokioTcpStream;
|
||||
use tokio_native_tls::TlsStream as TokioTlsStream;
|
||||
|
||||
use trust_dns_proto::error::ProtoError;
|
||||
use trust_dns_proto::iocompat::AsyncIo02As03;
|
||||
use trust_dns_proto::iocompat::AsyncIoTokioAsStd;
|
||||
use trust_dns_proto::tcp::TcpClientStream;
|
||||
use trust_dns_proto::xfer::BufDnsStreamHandle;
|
||||
|
||||
@ -28,7 +28,7 @@ use crate::TlsStreamBuilder;
|
||||
/// TlsClientStream secure DNS over TCP stream
|
||||
///
|
||||
/// See TlsClientStreamBuilder::new()
|
||||
pub type TlsClientStream = TcpClientStream<AsyncIo02As03<TokioTlsStream<TokioTcpStream>>>;
|
||||
pub type TlsClientStream = TcpClientStream<AsyncIoTokioAsStd<TokioTlsStream<TokioTcpStream>>>;
|
||||
|
||||
/// Builder for TlsClientStream
|
||||
pub struct TlsClientStreamBuilder(TlsStreamBuilder);
|
||||
|
@ -18,12 +18,12 @@ use native_tls::{Certificate, Identity, TlsConnector};
|
||||
use tokio::net::TcpStream as TokioTcpStream;
|
||||
use tokio_native_tls::{TlsConnector as TokioTlsConnector, TlsStream as TokioTlsStream};
|
||||
|
||||
use trust_dns_proto::iocompat::AsyncIo02As03;
|
||||
use trust_dns_proto::iocompat::AsyncIoTokioAsStd;
|
||||
use trust_dns_proto::tcp::{self, TcpStream};
|
||||
use trust_dns_proto::xfer::{BufStreamHandle, StreamReceiver};
|
||||
|
||||
/// A TlsStream counterpart to the TcpStream which embeds a secure TlsStream
|
||||
pub type TlsStream = TcpStream<AsyncIo02As03<TokioTlsStream<TokioTcpStream>>>;
|
||||
pub type TlsStream = TcpStream<AsyncIoTokioAsStd<TokioTlsStream<TokioTcpStream>>>;
|
||||
|
||||
fn tls_new(certs: Vec<Certificate>, pkcs12: Option<Identity>) -> io::Result<TlsConnector> {
|
||||
let mut builder = TlsConnector::builder();
|
||||
@ -53,8 +53,11 @@ pub fn tls_from_stream(
|
||||
) -> (TlsStream, BufStreamHandle) {
|
||||
let (message_sender, outbound_messages) = BufStreamHandle::create();
|
||||
|
||||
let stream =
|
||||
TcpStream::from_stream_with_receiver(AsyncIo02As03(stream), peer_addr, outbound_messages);
|
||||
let stream = TcpStream::from_stream_with_receiver(
|
||||
AsyncIoTokioAsStd(stream),
|
||||
peer_addr,
|
||||
outbound_messages,
|
||||
);
|
||||
|
||||
(stream, message_sender)
|
||||
}
|
||||
@ -170,7 +173,7 @@ impl TlsStreamBuilder {
|
||||
.await?;
|
||||
|
||||
Ok(TcpStream::from_stream_with_receiver(
|
||||
AsyncIo02As03(tls_connected),
|
||||
AsyncIoTokioAsStd(tls_connected),
|
||||
name_server,
|
||||
outbound_messages,
|
||||
))
|
||||
|
Loading…
Reference in New Issue
Block a user