replace ConnProvider with RuntimeProvider

This commit is contained in:
XOR-op
2023-01-16 00:15:40 +08:00
committed by Benjamin Fry
parent 3c3f14ddc5
commit 74bdef0d9a
18 changed files with 305 additions and 295 deletions

View File

@@ -16,7 +16,6 @@ use proto::rr::domain::usage::ONION;
use proto::rr::domain::TryParseIp;
use proto::rr::{IntoName, Name, Record, RecordType};
use proto::xfer::{DnsRequestOptions, RetryDnsHandle};
use proto::DnsHandle;
use tracing::{debug, trace};
use crate::caching_client::CachingClient;
@@ -25,9 +24,8 @@ use crate::dns_lru::{self, DnsLru};
use crate::error::*;
use crate::lookup::{self, Lookup, LookupEither, LookupFuture};
use crate::lookup_ip::{LookupIp, LookupIpFuture};
use crate::name_server::{GenericConnection, NameServerPool, RuntimeProvider};
#[cfg(feature = "tokio-runtime")]
use crate::name_server::{TokioConnection, TokioConnectionProvider, TokioHandle};
use crate::name_server::{NameServerPool, RuntimeProvider, TokioRuntimeProvider};
use crate::Hosts;
@@ -58,17 +56,17 @@ use crate::Hosts;
/// linked to it. When all of its [`AsyncResolver`]s have been dropped, the
/// background future will finish.
#[derive(Clone)]
pub struct AsyncResolver<C: DnsHandle<Error = ResolveError>, P: ConnectionProvider<Conn = C>> {
pub struct AsyncResolver<P: RuntimeProvider> {
config: ResolverConfig,
options: ResolverOpts,
client_cache: CachingClient<LookupEither<C, P>, ResolveError>,
client_cache: CachingClient<LookupEither<P>, ResolveError>,
hosts: Option<Arc<Hosts>>,
}
/// An AsyncResolver used with Tokio
#[cfg(feature = "tokio-runtime")]
#[cfg_attr(docsrs, doc(cfg(feature = "tokio-runtime")))]
pub type TokioAsyncResolver = AsyncResolver<TokioConnection, TokioConnectionProvider>;
pub type TokioAsyncResolver = AsyncResolver<TokioRuntimeProvider>;
macro_rules! lookup_fn {
($p:ident, $l:ty, $r:path) => {
@@ -120,7 +118,7 @@ impl TokioAsyncResolver {
/// documentation for `AsyncResolver` for more information on how to use
/// the background future.
pub fn tokio(config: ResolverConfig, options: ResolverOpts) -> Result<Self, ResolveError> {
Self::new(config, options, TokioHandle::default())
Self::new(config, options, TokioRuntimeProvider::new())
}
/// Constructs a new Tokio based Resolver with the system configuration.
@@ -133,11 +131,11 @@ impl TokioAsyncResolver {
doc(cfg(all(feature = "system-config", any(unix, target_os = "windows"))))
)]
pub fn tokio_from_system_conf() -> Result<Self, ResolveError> {
Self::from_system_conf(TokioHandle::default())
Self::from_system_conf(TokioRuntimeProvider::new())
}
}
impl<R: RuntimeProvider> AsyncResolver<GenericConnection, GenericConnectionProvider<R>> {
impl<R: RuntimeProvider> AsyncResolver<R> {
/// Construct a new generic `AsyncResolver` with the provided configuration.
///
/// see [TokioAsyncResolver::tokio(..)] instead.
@@ -156,13 +154,9 @@ impl<R: RuntimeProvider> AsyncResolver<GenericConnection, GenericConnectionProvi
pub fn new(
config: ResolverConfig,
options: ResolverOpts,
runtime: R::Handle,
provider: R,
) -> Result<Self, ResolveError> {
Self::new_with_conn(
config,
options,
GenericConnectionProvider::<R>::new(runtime),
)
Self::new_with_conn(config, options, provider)
}
/// Constructs a new Resolver with the system configuration.
@@ -176,8 +170,8 @@ impl<R: RuntimeProvider> AsyncResolver<GenericConnection, GenericConnectionProvi
docsrs,
doc(cfg(all(feature = "system-config", any(unix, target_os = "windows"))))
)]
pub fn from_system_conf(runtime: R::Handle) -> Result<Self, ResolveError> {
Self::from_system_conf_with_provider(GenericConnectionProvider::<R>::new(runtime))
pub fn from_system_conf(runtime: R) -> Result<Self, ResolveError> {
Self::from_system_conf_with_provider(runtime)
}
/// Flushes/Removes all entries from the cache
@@ -186,7 +180,7 @@ impl<R: RuntimeProvider> AsyncResolver<GenericConnection, GenericConnectionProvi
}
}
impl<C: DnsHandle<Error = ResolveError>, P: ConnectionProvider<Conn = C>> AsyncResolver<C, P> {
impl<P: RuntimeProvider> AsyncResolver<P> {
/// Construct a new `AsyncResolver` with the provided configuration.
///
/// # Arguments
@@ -455,9 +449,7 @@ impl<C: DnsHandle<Error = ResolveError>, P: ConnectionProvider<Conn = C>> AsyncR
lookup_fn!(txt_lookup, lookup::TxtLookup, RecordType::TXT);
}
impl<C: DnsHandle<Error = ResolveError>, P: ConnectionProvider<Conn = C>> fmt::Debug
for AsyncResolver<C, P>
{
impl<P: RuntimeProvider> fmt::Debug for AsyncResolver<P> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("AsyncResolver")
.field("request_tx", &"...")
@@ -473,7 +465,7 @@ pub mod testing {
use std::{net::*, str::FromStr};
use crate::config::{LookupIpStrategy, NameServerConfig, ResolverConfig, ResolverOpts};
use crate::name_server::{GenericConnection, RuntimeProvider};
use crate::name_server::RuntimeProvider;
use crate::AsyncResolver;
use proto::{rr::Name, Executor};
@@ -481,14 +473,10 @@ pub mod testing {
pub fn lookup_test<E: Executor, R: RuntimeProvider>(
config: ResolverConfig,
mut exec: E,
handle: R::Handle,
handle: R,
) {
let resolver = AsyncResolver::<GenericConnection, GenericConnectionProvider<R>>::new(
config,
ResolverOpts::default(),
handle,
)
.expect("failed to create resolver");
let resolver = AsyncResolver::<R>::new(config, ResolverOpts::default(), handle)
.expect("failed to create resolver");
let response = exec
.block_on(resolver.lookup_ip("www.example.com."))
@@ -510,13 +498,10 @@ pub mod testing {
}
/// Test IP lookup from IP literals.
pub fn ip_lookup_test<E: Executor, R: RuntimeProvider>(mut exec: E, handle: R::Handle) {
let resolver = AsyncResolver::<GenericConnection, GenericConnectionProvider<R>>::new(
ResolverConfig::default(),
ResolverOpts::default(),
handle,
)
.expect("failed to create resolver");
pub fn ip_lookup_test<E: Executor, R: RuntimeProvider>(mut exec: E, handle: R) {
let resolver =
AsyncResolver::<R>::new(ResolverConfig::default(), ResolverOpts::default(), handle)
.expect("failed to create resolver");
let response = exec
.block_on(resolver.lookup_ip("10.1.0.2"))
@@ -541,23 +526,20 @@ pub mod testing {
/// Test IP lookup from IP literals across threads.
pub fn ip_lookup_across_threads_test<E: Executor + Send + 'static, R: RuntimeProvider>(
handle: R::Handle,
handle: R,
) {
// Test ensuring that running the background task on a separate
// executor in a separate thread from the futures returned by the
// AsyncResolver works correctly.
use std::thread;
let resolver = AsyncResolver::<GenericConnection, GenericConnectionProvider<R>>::new(
ResolverConfig::default(),
ResolverOpts::default(),
handle,
)
.expect("failed to create resolver");
let resolver =
AsyncResolver::<R>::new(ResolverConfig::default(), ResolverOpts::default(), handle)
.expect("failed to create resolver");
let resolver_one = resolver.clone();
let resolver_two = resolver;
let test_fn = |resolver: AsyncResolver<GenericConnection, GenericConnectionProvider<R>>| {
let test_fn = |resolver: AsyncResolver<R>| {
let mut exec = E::new();
let response = exec
@@ -598,7 +580,7 @@ pub mod testing {
#[cfg_attr(docsrs, doc(cfg(feature = "dnssec")))]
pub fn sec_lookup_test<E: Executor + Send + 'static, R: RuntimeProvider>(
mut exec: E,
handle: R::Handle,
handle: R,
) {
//env_logger::try_init().ok();
@@ -639,7 +621,7 @@ pub mod testing {
#[cfg_attr(docsrs, doc(cfg(feature = "dnssec")))]
pub fn sec_lookup_fails_test<E: Executor + Send + 'static, R: RuntimeProvider>(
mut exec: E,
handle: R::Handle,
handle: R,
) {
use crate::error::*;
use proto::rr::RecordType;
@@ -683,13 +665,10 @@ pub mod testing {
#[cfg_attr(docsrs, doc(cfg(feature = "system-config")))]
pub fn system_lookup_test<E: Executor + Send + 'static, R: RuntimeProvider>(
mut exec: E,
handle: R::Handle,
handle: R,
) {
let resolver =
AsyncResolver::<GenericConnection, GenericConnectionProvider<R>>::from_system_conf(
handle,
)
.expect("failed to create resolver");
AsyncResolver::<R>::from_system_conf(handle).expect("failed to create resolver");
let response = exec
.block_on(resolver.lookup_ip("www.example.com."))
@@ -715,13 +694,10 @@ pub mod testing {
#[cfg_attr(docsrs, doc(cfg(feature = "system-config")))]
pub fn hosts_lookup_test<E: Executor + Send + 'static, R: RuntimeProvider>(
mut exec: E,
handle: R::Handle,
handle: R,
) {
let resolver =
AsyncResolver::<GenericConnection, GenericConnectionProvider<R>>::from_system_conf(
handle,
)
.expect("failed to create resolver");
AsyncResolver::<R>::from_system_conf(handle).expect("failed to create resolver");
let response = exec
.block_on(resolver.lookup_ip("a.com"))
@@ -738,10 +714,7 @@ pub mod testing {
}
/// Test fqdn.
pub fn fqdn_test<E: Executor + Send + 'static, R: RuntimeProvider>(
mut exec: E,
handle: R::Handle,
) {
pub fn fqdn_test<E: Executor + Send + 'static, R: RuntimeProvider>(mut exec: E, handle: R) {
let domain = Name::from_str("incorrect.example.com.").unwrap();
let search = vec![
Name::from_str("bad.example.com.").unwrap(),
@@ -750,7 +723,7 @@ pub mod testing {
let name_servers: Vec<NameServerConfig> =
ResolverConfig::default().name_servers().to_owned();
let resolver = AsyncResolver::<GenericConnection, GenericConnectionProvider<R>>::new(
let resolver = AsyncResolver::<R>::new(
ResolverConfig::from_parts(Some(domain), search, name_servers),
ResolverOpts {
ip_strategy: LookupIpStrategy::Ipv4Only,
@@ -775,10 +748,7 @@ pub mod testing {
}
/// Test ndots with non-fqdn.
pub fn ndots_test<E: Executor + Send + 'static, R: RuntimeProvider>(
mut exec: E,
handle: R::Handle,
) {
pub fn ndots_test<E: Executor + Send + 'static, R: RuntimeProvider>(mut exec: E, handle: R) {
let domain = Name::from_str("incorrect.example.com.").unwrap();
let search = vec![
Name::from_str("bad.example.com.").unwrap(),
@@ -787,7 +757,7 @@ pub mod testing {
let name_servers: Vec<NameServerConfig> =
ResolverConfig::default().name_servers().to_owned();
let resolver = AsyncResolver::<GenericConnection, GenericConnectionProvider<R>>::new(
let resolver = AsyncResolver::<R>::new(
ResolverConfig::from_parts(Some(domain), search, name_servers),
ResolverOpts {
// our name does have 2, the default should be fine, let's just narrow the test criteria a bit.
@@ -817,7 +787,7 @@ pub mod testing {
/// Test large ndots with non-fqdn.
pub fn large_ndots_test<E: Executor + Send + 'static, R: RuntimeProvider>(
mut exec: E,
handle: R::Handle,
handle: R,
) {
let domain = Name::from_str("incorrect.example.com.").unwrap();
let search = vec![
@@ -827,7 +797,7 @@ pub mod testing {
let name_servers: Vec<NameServerConfig> =
ResolverConfig::default().name_servers().to_owned();
let resolver = AsyncResolver::<GenericConnection, GenericConnectionProvider<R>>::new(
let resolver = AsyncResolver::<R>::new(
ResolverConfig::from_parts(Some(domain), search, name_servers),
ResolverOpts {
// matches kubernetes default
@@ -857,7 +827,7 @@ pub mod testing {
/// Test domain search.
pub fn domain_search_test<E: Executor + Send + 'static, R: RuntimeProvider>(
mut exec: E,
handle: R::Handle,
handle: R,
) {
//env_logger::try_init().ok();
@@ -870,7 +840,7 @@ pub mod testing {
let name_servers: Vec<NameServerConfig> =
ResolverConfig::default().name_servers().to_owned();
let resolver = AsyncResolver::<GenericConnection, GenericConnectionProvider<R>>::new(
let resolver = AsyncResolver::<R>::new(
ResolverConfig::from_parts(Some(domain), search, name_servers),
ResolverOpts {
ip_strategy: LookupIpStrategy::Ipv4Only,
@@ -898,7 +868,7 @@ pub mod testing {
/// Test search lists.
pub fn search_list_test<E: Executor + Send + 'static, R: RuntimeProvider>(
mut exec: E,
handle: R::Handle,
handle: R,
) {
let domain = Name::from_str("incorrect.example.com.").unwrap();
let search = vec![
@@ -910,7 +880,7 @@ pub mod testing {
let name_servers: Vec<NameServerConfig> =
ResolverConfig::default().name_servers().to_owned();
let resolver = AsyncResolver::<GenericConnection, GenericConnectionProvider<R>>::new(
let resolver = AsyncResolver::<R>::new(
ResolverConfig::from_parts(Some(domain), search, name_servers),
ResolverOpts {
ip_strategy: LookupIpStrategy::Ipv4Only,
@@ -936,16 +906,10 @@ pub mod testing {
}
/// Test idna.
pub fn idna_test<E: Executor + Send + 'static, R: RuntimeProvider>(
mut exec: E,
handle: R::Handle,
) {
let resolver = AsyncResolver::<GenericConnection, GenericConnectionProvider<R>>::new(
ResolverConfig::default(),
ResolverOpts::default(),
handle,
)
.expect("failed to create resolver");
pub fn idna_test<E: Executor + Send + 'static, R: RuntimeProvider>(mut exec: E, handle: R) {
let resolver =
AsyncResolver::<R>::new(ResolverConfig::default(), ResolverOpts::default(), handle)
.expect("failed to create resolver");
let response = exec
.block_on(resolver.lookup_ip("中国.icom.museum."))
@@ -959,9 +923,9 @@ pub mod testing {
/// Test ipv4 localhost.
pub fn localhost_ipv4_test<E: Executor + Send + 'static, R: RuntimeProvider>(
mut exec: E,
handle: R::Handle,
handle: R,
) {
let resolver = AsyncResolver::<GenericConnection, GenericConnectionProvider<R>>::new(
let resolver = AsyncResolver::<R>::new(
ResolverConfig::default(),
ResolverOpts {
ip_strategy: LookupIpStrategy::Ipv4thenIpv6,
@@ -985,9 +949,9 @@ pub mod testing {
/// Test ipv6 localhost.
pub fn localhost_ipv6_test<E: Executor + Send + 'static, R: RuntimeProvider>(
mut exec: E,
handle: R::Handle,
handle: R,
) {
let resolver = AsyncResolver::<GenericConnection, GenericConnectionProvider<R>>::new(
let resolver = AsyncResolver::<R>::new(
ResolverConfig::default(),
ResolverOpts {
ip_strategy: LookupIpStrategy::Ipv6thenIpv4,
@@ -1011,12 +975,12 @@ pub mod testing {
/// Test ipv4 search with large ndots.
pub fn search_ipv4_large_ndots_test<E: Executor + Send + 'static, R: RuntimeProvider>(
mut exec: E,
handle: R::Handle,
handle: R,
) {
let mut config = ResolverConfig::default();
config.add_search(Name::from_str("example.com").unwrap());
let resolver = AsyncResolver::<GenericConnection, GenericConnectionProvider<R>>::new(
let resolver = AsyncResolver::<R>::new(
config,
ResolverOpts {
ip_strategy: LookupIpStrategy::Ipv4Only,
@@ -1041,12 +1005,12 @@ pub mod testing {
/// Test ipv6 search with large ndots.
pub fn search_ipv6_large_ndots_test<E: Executor + Send + 'static, R: RuntimeProvider>(
mut exec: E,
handle: R::Handle,
handle: R,
) {
let mut config = ResolverConfig::default();
config.add_search(Name::from_str("example.com").unwrap());
let resolver = AsyncResolver::<GenericConnection, GenericConnectionProvider<R>>::new(
let resolver = AsyncResolver::<R>::new(
config,
ResolverOpts {
ip_strategy: LookupIpStrategy::Ipv4Only,
@@ -1071,12 +1035,12 @@ pub mod testing {
/// Test ipv6 name parse fails.
pub fn search_ipv6_name_parse_fails_test<E: Executor + Send + 'static, R: RuntimeProvider>(
mut exec: E,
handle: R::Handle,
handle: R,
) {
let mut config = ResolverConfig::default();
config.add_search(Name::from_str("example.com").unwrap());
let resolver = AsyncResolver::<GenericConnection, GenericConnectionProvider<R>>::new(
let resolver = AsyncResolver::<R>::new(
config,
ResolverOpts {
ip_strategy: LookupIpStrategy::Ipv4Only,
@@ -1105,7 +1069,7 @@ mod tests {
use tokio::runtime::Runtime;
use crate::config::{ResolverConfig, ResolverOpts};
use crate::name_server::{TokioConnection, TokioConnectionProvider, TokioRuntime};
use crate::name_server::{TokioConnection, TokioConnectionProvider, TokioRuntimeProvider};
use super::*;
@@ -1141,7 +1105,7 @@ mod tests {
use super::testing::lookup_test;
let io_loop = Runtime::new().expect("failed to create tokio runtime");
let handle = TokioHandle::default();
lookup_test::<Runtime, TokioRuntime>(ResolverConfig::google(), io_loop, handle)
lookup_test::<Runtime, TokioRuntimeProvider>(ResolverConfig::google(), io_loop, handle)
}
#[test]
@@ -1149,7 +1113,7 @@ mod tests {
use super::testing::lookup_test;
let io_loop = Runtime::new().expect("failed to create tokio runtime");
let handle = TokioHandle::default();
lookup_test::<Runtime, TokioRuntime>(ResolverConfig::cloudflare(), io_loop, handle)
lookup_test::<Runtime, TokioRuntimeProvider>(ResolverConfig::cloudflare(), io_loop, handle)
}
#[test]
@@ -1157,7 +1121,7 @@ mod tests {
use super::testing::lookup_test;
let io_loop = Runtime::new().expect("failed to create tokio runtime");
let handle = TokioHandle::default();
lookup_test::<Runtime, TokioRuntime>(ResolverConfig::quad9(), io_loop, handle)
lookup_test::<Runtime, TokioRuntimeProvider>(ResolverConfig::quad9(), io_loop, handle)
}
#[test]
@@ -1165,7 +1129,7 @@ mod tests {
use super::testing::ip_lookup_test;
let io_loop = Runtime::new().expect("failed to create tokio runtime");
let handle = TokioHandle::default();
ip_lookup_test::<Runtime, TokioRuntime>(io_loop, handle)
ip_lookup_test::<Runtime, TokioRuntimeProvider>(io_loop, handle)
}
#[test]
@@ -1173,7 +1137,7 @@ mod tests {
use super::testing::ip_lookup_across_threads_test;
let _io_loop = Runtime::new().expect("failed to create tokio runtime io_loop");
let handle = TokioHandle::default();
ip_lookup_across_threads_test::<Runtime, TokioRuntime>(handle)
ip_lookup_across_threads_test::<Runtime, TokioRuntimeProvider>(handle)
}
#[test]
@@ -1182,7 +1146,7 @@ mod tests {
use super::testing::sec_lookup_test;
let io_loop = Runtime::new().expect("failed to create tokio runtime io_loop");
let handle = TokioHandle::default();
sec_lookup_test::<Runtime, TokioRuntime>(io_loop, handle);
sec_lookup_test::<Runtime, TokioRuntimeProvider>(io_loop, handle);
}
#[test]
@@ -1191,7 +1155,7 @@ mod tests {
use super::testing::sec_lookup_fails_test;
let io_loop = Runtime::new().expect("failed to create tokio runtime io_loop");
let handle = TokioHandle::default();
sec_lookup_fails_test::<Runtime, TokioRuntime>(io_loop, handle);
sec_lookup_fails_test::<Runtime, TokioRuntimeProvider>(io_loop, handle);
}
#[test]
@@ -1202,7 +1166,7 @@ mod tests {
use super::testing::system_lookup_test;
let io_loop = Runtime::new().expect("failed to create tokio runtime io_loop");
let handle = TokioHandle::default();
system_lookup_test::<Runtime, TokioRuntime>(io_loop, handle);
system_lookup_test::<Runtime, TokioRuntimeProvider>(io_loop, handle);
}
#[test]
@@ -1213,7 +1177,7 @@ mod tests {
use super::testing::hosts_lookup_test;
let io_loop = Runtime::new().expect("failed to create tokio runtime io_loop");
let handle = TokioHandle::default();
hosts_lookup_test::<Runtime, TokioRuntime>(io_loop, handle);
hosts_lookup_test::<Runtime, TokioRuntimeProvider>(io_loop, handle);
}
#[test]
@@ -1221,7 +1185,7 @@ mod tests {
use super::testing::fqdn_test;
let io_loop = Runtime::new().expect("failed to create tokio runtime io_loop");
let handle = TokioHandle::default();
fqdn_test::<Runtime, TokioRuntime>(io_loop, handle);
fqdn_test::<Runtime, TokioRuntimeProvider>(io_loop, handle);
}
#[test]
@@ -1229,7 +1193,7 @@ mod tests {
use super::testing::ndots_test;
let io_loop = Runtime::new().expect("failed to create tokio runtime io_loop");
let handle = TokioHandle::default();
ndots_test::<Runtime, TokioRuntime>(io_loop, handle);
ndots_test::<Runtime, TokioRuntimeProvider>(io_loop, handle);
}
#[test]
@@ -1237,7 +1201,7 @@ mod tests {
use super::testing::large_ndots_test;
let io_loop = Runtime::new().expect("failed to create tokio runtime io_loop");
let handle = TokioHandle::default();
large_ndots_test::<Runtime, TokioRuntime>(io_loop, handle);
large_ndots_test::<Runtime, TokioRuntimeProvider>(io_loop, handle);
}
#[test]
@@ -1245,7 +1209,7 @@ mod tests {
use super::testing::domain_search_test;
let io_loop = Runtime::new().expect("failed to create tokio runtime io_loop");
let handle = TokioHandle::default();
domain_search_test::<Runtime, TokioRuntime>(io_loop, handle);
domain_search_test::<Runtime, TokioRuntimeProvider>(io_loop, handle);
}
#[test]
@@ -1253,7 +1217,7 @@ mod tests {
use super::testing::search_list_test;
let io_loop = Runtime::new().expect("failed to create tokio runtime io_loop");
let handle = TokioHandle::default();
search_list_test::<Runtime, TokioRuntime>(io_loop, handle);
search_list_test::<Runtime, TokioRuntimeProvider>(io_loop, handle);
}
#[test]
@@ -1261,7 +1225,7 @@ mod tests {
use super::testing::idna_test;
let io_loop = Runtime::new().expect("failed to create tokio runtime io_loop");
let handle = TokioHandle::default();
idna_test::<Runtime, TokioRuntime>(io_loop, handle);
idna_test::<Runtime, TokioRuntimeProvider>(io_loop, handle);
}
#[test]
@@ -1269,7 +1233,7 @@ mod tests {
use super::testing::localhost_ipv4_test;
let io_loop = Runtime::new().expect("failed to create tokio runtime io_loop");
let handle = TokioHandle::default();
localhost_ipv4_test::<Runtime, TokioRuntime>(io_loop, handle);
localhost_ipv4_test::<Runtime, TokioRuntimeProvider>(io_loop, handle);
}
#[test]
@@ -1277,7 +1241,7 @@ mod tests {
use super::testing::localhost_ipv6_test;
let io_loop = Runtime::new().expect("failed to create tokio runtime io_loop");
let handle = TokioHandle::default();
localhost_ipv6_test::<Runtime, TokioRuntime>(io_loop, handle);
localhost_ipv6_test::<Runtime, TokioRuntimeProvider>(io_loop, handle);
}
#[test]
@@ -1285,7 +1249,7 @@ mod tests {
use super::testing::search_ipv4_large_ndots_test;
let io_loop = Runtime::new().expect("failed to create tokio runtime io_loop");
let handle = TokioHandle::default();
search_ipv4_large_ndots_test::<Runtime, TokioRuntime>(io_loop, handle);
search_ipv4_large_ndots_test::<Runtime, TokioRuntimeProvider>(io_loop, handle);
}
#[test]
@@ -1293,7 +1257,7 @@ mod tests {
use super::testing::search_ipv6_large_ndots_test;
let io_loop = Runtime::new().expect("failed to create tokio runtime io_loop");
let handle = TokioHandle::default();
search_ipv6_large_ndots_test::<Runtime, TokioRuntime>(io_loop, handle);
search_ipv6_large_ndots_test::<Runtime, TokioRuntimeProvider>(io_loop, handle);
}
#[test]
@@ -1301,7 +1265,7 @@ mod tests {
use super::testing::search_ipv6_name_parse_fails_test;
let io_loop = Runtime::new().expect("failed to create tokio runtime io_loop");
let handle = TokioHandle::default();
search_ipv6_name_parse_fails_test::<Runtime, TokioRuntime>(io_loop, handle);
search_ipv6_name_parse_fails_test::<Runtime, TokioRuntimeProvider>(io_loop, handle);
}
#[test]
@@ -1309,13 +1273,11 @@ mod tests {
let handle = TokioHandle::default();
let mut config = ResolverConfig::default();
config.add_search(Name::from_ascii("example.com.").unwrap());
let resolver =
AsyncResolver::<GenericConnection, GenericConnectionProvider<TokioRuntime>>::new(
config,
ResolverOpts::default(),
handle,
)
.expect("failed to create resolver");
let resolver = AsyncResolver::<
GenericConnection,
GenericConnectionProvider<TokioRuntimeProvider>,
>::new(config, ResolverOpts::default(), handle)
.expect("failed to create resolver");
let tor_address = [
Name::from_ascii("2gzyxa5ihm7nsggfxnu52rck2vv4rvmdlkiu3zzui5du4xyclen53wid.onion")
.unwrap(),