chore: rename {Abstract} back
This commit is contained in:
parent
a38f9c01c9
commit
b58a8585a6
@ -21,9 +21,9 @@ use std::fmt::Debug;
|
||||
|
||||
fn get_character_data() -> Vec<(&'static str, Vec<u8>)> {
|
||||
vec![
|
||||
("", vec![0]), // base case, only the root
|
||||
("a", vec![1, b'a']), // a single 'a' label
|
||||
("bc", vec![2, b'b', b'c']), // two labels, 'a.bc'
|
||||
("", vec![0]), // base case, only the root
|
||||
("a", vec![1, b'a']), // a single 'a' label
|
||||
("bc", vec![2, b'b', b'c']), // two labels, 'a.bc'
|
||||
("♥", vec![3, 0xE2, 0x99, 0xA5]), // two labels utf8, 'a.♥'
|
||||
]
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ use crate::{
|
||||
dns_lru::{DnsLru, TtlConfig},
|
||||
error::ResolveError,
|
||||
lookup::Lookup,
|
||||
name_server::{NameServerPool, TokioRuntimeProvider},
|
||||
name_server::{GenericNameServerPool, TokioRuntimeProvider},
|
||||
Name,
|
||||
},
|
||||
Error, ErrorKind,
|
||||
@ -55,7 +55,7 @@ impl Recursor {
|
||||
assert!(!roots.is_empty(), "roots must not be empty");
|
||||
|
||||
let opts = recursor_opts();
|
||||
let roots = NameServerPool::from_config(roots, &opts, TokioRuntimeProvider::new());
|
||||
let roots = GenericNameServerPool::from_config(roots, &opts, TokioRuntimeProvider::new());
|
||||
let roots = RecursorPool::from(Name::root(), roots);
|
||||
let name_server_cache = Mutex::new(NameServerCache::new(100)); // TODO: make this configurable
|
||||
let record_cache = DnsLru::new(100, TtlConfig::default());
|
||||
@ -435,7 +435,7 @@ impl Recursor {
|
||||
}
|
||||
|
||||
// now construct a namesever pool based off the NS and glue records
|
||||
let ns = NameServerPool::from_config(
|
||||
let ns = GenericNameServerPool::from_config(
|
||||
config_group,
|
||||
&recursor_opts(),
|
||||
TokioRuntimeProvider::new(),
|
||||
|
@ -23,7 +23,7 @@ use trust_dns_proto::{
|
||||
use trust_dns_resolver::name_server::{RuntimeProvider, TokioRuntimeProvider};
|
||||
use trust_dns_resolver::{
|
||||
error::{ResolveError, ResolveErrorKind},
|
||||
name_server::NameServerPool,
|
||||
name_server::GenericNameServerPool,
|
||||
Name,
|
||||
};
|
||||
|
||||
@ -52,12 +52,12 @@ impl Future for SharedLookup {
|
||||
#[derive(Clone)]
|
||||
pub(crate) struct RecursorPool<P: RuntimeProvider + Send + 'static> {
|
||||
zone: Name,
|
||||
ns: NameServerPool<P>,
|
||||
ns: GenericNameServerPool<P>,
|
||||
active_requests: Arc<Mutex<ActiveRequests>>,
|
||||
}
|
||||
|
||||
impl RecursorPool<TokioRuntimeProvider> {
|
||||
pub(crate) fn from(zone: Name, ns: NameServerPool<TokioRuntimeProvider>) -> Self {
|
||||
pub(crate) fn from(zone: Name, ns: GenericNameServerPool<TokioRuntimeProvider>) -> Self {
|
||||
let active_requests = Arc::new(Mutex::new(ActiveRequests::default()));
|
||||
|
||||
Self {
|
||||
|
@ -26,7 +26,7 @@ use crate::lookup::{self, Lookup, LookupEither, LookupFuture};
|
||||
use crate::lookup_ip::{LookupIp, LookupIpFuture};
|
||||
#[cfg(feature = "tokio-runtime")]
|
||||
use crate::name_server::TokioRuntimeProvider;
|
||||
use crate::name_server::{AbstractNameServerPool, RuntimeProvider};
|
||||
use crate::name_server::{NameServerPool, RuntimeProvider};
|
||||
|
||||
use crate::Hosts;
|
||||
|
||||
@ -192,8 +192,7 @@ impl<P: RuntimeProvider> AsyncResolver<P> {
|
||||
/// documentation for `AsyncResolver` for more information on how to use
|
||||
/// the background future.
|
||||
pub fn new_with_conn(config: ResolverConfig, options: ResolverOpts, conn_provider: P) -> Self {
|
||||
let pool =
|
||||
AbstractNameServerPool::from_config_with_provider(&config, &options, conn_provider);
|
||||
let pool = ServerPool::from_config_with_provider(&config, &options, conn_provider);
|
||||
let either;
|
||||
let client = RetryDnsHandle::new(pool, options.attempts);
|
||||
if options.validate {
|
||||
|
@ -28,7 +28,7 @@ use crate::{
|
||||
dns_lru::MAX_TTL,
|
||||
error::*,
|
||||
lookup_ip::LookupIpIter,
|
||||
name_server::{NameServerPool, RuntimeProvider},
|
||||
name_server::{GenericNameServerPool, RuntimeProvider},
|
||||
proto::{
|
||||
error::ProtoError,
|
||||
op::Query,
|
||||
@ -186,10 +186,10 @@ impl Iterator for LookupIntoIter {
|
||||
#[derive(Clone)]
|
||||
#[doc(hidden)]
|
||||
pub enum LookupEither<P: RuntimeProvider + Send> {
|
||||
Retry(RetryDnsHandle<NameServerPool<P>>),
|
||||
Retry(RetryDnsHandle<GenericNameServerPool<P>>),
|
||||
#[cfg(feature = "dnssec")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "dnssec")))]
|
||||
Secure(DnssecDnsHandle<RetryDnsHandle<NameServerPool<P>>>),
|
||||
Secure(DnssecDnsHandle<RetryDnsHandle<GenericNameServerPool<P>>>),
|
||||
}
|
||||
|
||||
impl<P: RuntimeProvider> DnsHandle for LookupEither<P> {
|
||||
|
@ -19,8 +19,8 @@ pub use self::connection_provider::{RuntimeProvider, Spawn};
|
||||
#[cfg(feature = "mdns")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "mdns")))]
|
||||
pub(crate) use self::name_server::mdns_nameserver;
|
||||
pub use self::name_server::{AbstractNameServer, CreateConnection, NameServer};
|
||||
pub use self::name_server_pool::{AbstractNameServerPool, NameServerPool};
|
||||
pub use self::name_server::{CreateConnection, GenericNameServer, NameServer};
|
||||
pub use self::name_server_pool::{GenericNameServerPool, NameServerPool};
|
||||
use self::name_server_state::NameServerState;
|
||||
use self::name_server_stats::NameServerStats;
|
||||
|
||||
|
@ -26,9 +26,9 @@ use crate::name_server::{GenericConnection, NameServerState, NameServerStats, Ru
|
||||
#[cfg(feature = "mdns")]
|
||||
use proto::multicast::{MdnsClientConnect, MdnsClientStream, MdnsQueryType};
|
||||
|
||||
/// This struct is needed only for testing. Specifically, `C` is needed for mocking.
|
||||
/// This struct is used to create `DnsHandle` with the help of `P`.
|
||||
#[derive(Clone)]
|
||||
pub struct AbstractNameServer<
|
||||
pub struct NameServer<
|
||||
C: DnsHandle<Error = ResolveError> + Send + Sync + 'static + CreateConnection,
|
||||
P: RuntimeProvider,
|
||||
> {
|
||||
@ -41,9 +41,9 @@ pub struct AbstractNameServer<
|
||||
}
|
||||
|
||||
/// Specifies the details of a remote NameServer used for lookups
|
||||
pub type NameServer<P> = AbstractNameServer<GenericConnection, P>;
|
||||
pub type GenericNameServer<P> = NameServer<GenericConnection, P>;
|
||||
|
||||
impl<C, P> Debug for AbstractNameServer<C, P>
|
||||
impl<C, P> Debug for NameServer<C, P>
|
||||
where
|
||||
C: DnsHandle<Error = ResolveError> + Send + Sync + 'static + CreateConnection,
|
||||
P: RuntimeProvider + Send,
|
||||
@ -53,7 +53,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<C, P> AbstractNameServer<C, P>
|
||||
impl<C, P> NameServer<C, P>
|
||||
where
|
||||
C: DnsHandle<Error = ResolveError> + Send + Sync + 'static + CreateConnection,
|
||||
P: RuntimeProvider + Send,
|
||||
@ -177,7 +177,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<C, P> DnsHandle for AbstractNameServer<C, P>
|
||||
impl<C, P> DnsHandle for NameServer<C, P>
|
||||
where
|
||||
C: DnsHandle<Error = ResolveError> + Send + Sync + 'static + CreateConnection,
|
||||
P: RuntimeProvider,
|
||||
@ -197,7 +197,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<C, P> Ord for AbstractNameServer<C, P>
|
||||
impl<C, P> Ord for NameServer<C, P>
|
||||
where
|
||||
C: DnsHandle<Error = ResolveError> + Send + Sync + 'static + CreateConnection,
|
||||
P: RuntimeProvider + Send,
|
||||
@ -213,7 +213,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<C, P> PartialOrd for AbstractNameServer<C, P>
|
||||
impl<C, P> PartialOrd for NameServer<C, P>
|
||||
where
|
||||
C: DnsHandle<Error = ResolveError> + Send + Sync + 'static + CreateConnection,
|
||||
P: RuntimeProvider + Send,
|
||||
@ -223,7 +223,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<C, P> PartialEq for AbstractNameServer<C, P>
|
||||
impl<C, P> PartialEq for NameServer<C, P>
|
||||
where
|
||||
C: DnsHandle<Error = ResolveError> + Send + Sync + 'static + CreateConnection,
|
||||
P: RuntimeProvider + Send,
|
||||
@ -234,7 +234,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<C, P> Eq for AbstractNameServer<C, P>
|
||||
impl<C, P> Eq for NameServer<C, P>
|
||||
where
|
||||
C: DnsHandle<Error = ResolveError> + Send + Sync + 'static + CreateConnection,
|
||||
P: RuntimeProvider + Send,
|
||||
@ -247,7 +247,7 @@ pub(crate) fn mdns_nameserver<P>(
|
||||
options: ResolverOpts,
|
||||
conn_provider: P,
|
||||
trust_negative_responses: bool,
|
||||
) -> NameServer<P>
|
||||
) -> GenericNameServer<P>
|
||||
where
|
||||
P: RuntimeProvider,
|
||||
{
|
||||
@ -260,7 +260,7 @@ where
|
||||
tls_config: None,
|
||||
bind_addr: None,
|
||||
};
|
||||
NameServer::new_with_provider(config, options, conn_provider)
|
||||
GenericNameServer::new_with_provider(config, options, conn_provider)
|
||||
}
|
||||
|
||||
/// Used for creating new connections.
|
||||
@ -307,7 +307,7 @@ mod tests {
|
||||
};
|
||||
let io_loop = Runtime::new().unwrap();
|
||||
let name_server = future::lazy(|_| {
|
||||
NameServer::new(config, ResolverOpts::default(), TokioRuntimeProvider::new())
|
||||
GenericNameServer::new(config, ResolverOpts::default(), TokioRuntimeProvider::new())
|
||||
});
|
||||
|
||||
let name = Name::parse("www.example.com.", None).unwrap();
|
||||
@ -341,7 +341,7 @@ mod tests {
|
||||
};
|
||||
let io_loop = Runtime::new().unwrap();
|
||||
let name_server =
|
||||
future::lazy(|_| NameServer::new(config, options, TokioRuntimeProvider::new()));
|
||||
future::lazy(|_| GenericNameServer::new(config, options, TokioRuntimeProvider::new()));
|
||||
|
||||
let name = Name::parse("www.example.com.", None).unwrap();
|
||||
assert!(io_loop
|
||||
|
@ -26,7 +26,7 @@ use crate::config::{NameServerConfigGroup, ResolverConfig, ResolverOpts, ServerO
|
||||
use crate::error::{ResolveError, ResolveErrorKind};
|
||||
#[cfg(feature = "mdns")]
|
||||
use crate::name_server;
|
||||
use crate::name_server::name_server::{AbstractNameServer, CreateConnection};
|
||||
use crate::name_server::name_server::{CreateConnection, NameServer};
|
||||
#[cfg(test)]
|
||||
#[cfg(feature = "tokio-runtime")]
|
||||
use crate::name_server::TokioRuntimeProvider;
|
||||
@ -34,13 +34,13 @@ use crate::name_server::{GenericConnection, RuntimeProvider};
|
||||
|
||||
/// Abstract interface for mocking purpose
|
||||
#[derive(Clone)]
|
||||
pub struct AbstractNameServerPool<
|
||||
pub struct NameServerPool<
|
||||
C: DnsHandle<Error = ResolveError> + Send + Sync + 'static + CreateConnection,
|
||||
P: RuntimeProvider + Send + 'static,
|
||||
> {
|
||||
// TODO: switch to FuturesMutex (Mutex will have some undesirable locking)
|
||||
datagram_conns: Arc<[AbstractNameServer<C, P>]>, /* All NameServers must be the same type */
|
||||
stream_conns: Arc<[AbstractNameServer<C, P>]>, /* All NameServers must be the same type */
|
||||
datagram_conns: Arc<[NameServer<C, P>]>, /* All NameServers must be the same type */
|
||||
stream_conns: Arc<[NameServer<C, P>]>, /* All NameServers must be the same type */
|
||||
#[cfg(feature = "mdns")]
|
||||
mdns_conns: NameServer<P>, /* All NameServers must be the same type */
|
||||
options: ResolverOpts,
|
||||
@ -49,11 +49,11 @@ pub struct AbstractNameServerPool<
|
||||
/// A pool of NameServers
|
||||
///
|
||||
/// This is not expected to be used directly, see [crate::AsyncResolver].
|
||||
pub type NameServerPool<P> = AbstractNameServerPool<GenericConnection, P>;
|
||||
pub type GenericNameServerPool<P> = NameServerPool<GenericConnection, P>;
|
||||
|
||||
#[cfg(test)]
|
||||
#[cfg(feature = "tokio-runtime")]
|
||||
impl NameServerPool<TokioRuntimeProvider> {
|
||||
impl GenericNameServerPool<TokioRuntimeProvider> {
|
||||
pub(crate) fn tokio_from_config(
|
||||
config: &ResolverConfig,
|
||||
options: &ResolverOpts,
|
||||
@ -63,7 +63,7 @@ impl NameServerPool<TokioRuntimeProvider> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<C, P> AbstractNameServerPool<C, P>
|
||||
impl<C, P> NameServerPool<C, P>
|
||||
where
|
||||
C: DnsHandle<Error = ResolveError> + Send + Sync + 'static + CreateConnection,
|
||||
P: RuntimeProvider + 'static,
|
||||
@ -73,7 +73,7 @@ where
|
||||
options: &ResolverOpts,
|
||||
conn_provider: P,
|
||||
) -> Self {
|
||||
let datagram_conns: Vec<AbstractNameServer<C, P>> = config
|
||||
let datagram_conns: Vec<NameServer<C, P>> = config
|
||||
.name_servers()
|
||||
.iter()
|
||||
.filter(|ns_config| ns_config.protocol.is_datagram())
|
||||
@ -87,11 +87,11 @@ where
|
||||
#[cfg(not(feature = "dns-over-rustls"))]
|
||||
let ns_config = { ns_config.clone() };
|
||||
|
||||
AbstractNameServer::new(ns_config, *options, conn_provider.clone())
|
||||
NameServer::new(ns_config, *options, conn_provider.clone())
|
||||
})
|
||||
.collect();
|
||||
|
||||
let stream_conns: Vec<AbstractNameServer<C, P>> = config
|
||||
let stream_conns: Vec<NameServer<C, P>> = config
|
||||
.name_servers()
|
||||
.iter()
|
||||
.filter(|ns_config| ns_config.protocol.is_stream())
|
||||
@ -105,7 +105,7 @@ where
|
||||
#[cfg(not(feature = "dns-over-rustls"))]
|
||||
let ns_config = { ns_config.clone() };
|
||||
|
||||
AbstractNameServer::new(ns_config, *options, conn_provider.clone())
|
||||
NameServer::new(ns_config, *options, conn_provider.clone())
|
||||
})
|
||||
.collect();
|
||||
|
||||
@ -125,7 +125,7 @@ where
|
||||
conn_provider: P,
|
||||
) -> Self {
|
||||
let map_config_to_ns =
|
||||
|ns_config| AbstractNameServer::new(ns_config, *options, conn_provider.clone());
|
||||
|ns_config| NameServer::new(ns_config, *options, conn_provider.clone());
|
||||
|
||||
let (datagram, stream): (Vec<_>, Vec<_>) = name_servers
|
||||
.into_inner()
|
||||
@ -148,8 +148,8 @@ where
|
||||
#[cfg(not(feature = "mdns"))]
|
||||
pub fn from_nameservers(
|
||||
options: &ResolverOpts,
|
||||
datagram_conns: Vec<AbstractNameServer<C, P>>,
|
||||
stream_conns: Vec<AbstractNameServer<C, P>>,
|
||||
datagram_conns: Vec<NameServer<C, P>>,
|
||||
stream_conns: Vec<NameServer<C, P>>,
|
||||
) -> Self {
|
||||
Self {
|
||||
datagram_conns: Arc::from(datagram_conns),
|
||||
@ -166,7 +166,7 @@ where
|
||||
stream_conns: Vec<NameServer<C, P>>,
|
||||
mdns_conns: NameServer<C, P>,
|
||||
) -> Self {
|
||||
NameServerPool {
|
||||
GenericNameServerPool {
|
||||
datagram_conns: Arc::from(datagram_conns),
|
||||
stream_conns: Arc::from(stream_conns),
|
||||
mdns_conns,
|
||||
@ -179,8 +179,8 @@ where
|
||||
#[allow(dead_code)]
|
||||
fn from_nameservers_test(
|
||||
options: &ResolverOpts,
|
||||
datagram_conns: Arc<[AbstractNameServer<C, P>]>,
|
||||
stream_conns: Arc<[AbstractNameServer<C, P>]>,
|
||||
datagram_conns: Arc<[NameServer<C, P>]>,
|
||||
stream_conns: Arc<[NameServer<C, P>]>,
|
||||
) -> Self {
|
||||
Self {
|
||||
datagram_conns,
|
||||
@ -197,7 +197,7 @@ where
|
||||
stream_conns: Arc<[NameServer<C, P>]>,
|
||||
mdns_conns: NameServer<C, P>,
|
||||
) -> Self {
|
||||
NameServerPool {
|
||||
GenericNameServerPool {
|
||||
datagram_conns,
|
||||
stream_conns,
|
||||
mdns_conns,
|
||||
@ -208,10 +208,10 @@ where
|
||||
|
||||
async fn try_send(
|
||||
opts: ResolverOpts,
|
||||
conns: Arc<[AbstractNameServer<C, P>]>,
|
||||
conns: Arc<[NameServer<C, P>]>,
|
||||
request: DnsRequest,
|
||||
) -> Result<DnsResponse, ResolveError> {
|
||||
let mut conns: Vec<AbstractNameServer<C, P>> = conns.to_vec();
|
||||
let mut conns: Vec<NameServer<C, P>> = conns.to_vec();
|
||||
|
||||
match opts.server_ordering_strategy {
|
||||
// select the highest priority connection
|
||||
@ -226,7 +226,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<C, P> DnsHandle for AbstractNameServerPool<C, P>
|
||||
impl<C, P> DnsHandle for NameServerPool<C, P>
|
||||
where
|
||||
C: DnsHandle<Error = ResolveError> + Send + Sync + 'static + CreateConnection,
|
||||
P: RuntimeProvider + 'static,
|
||||
@ -306,7 +306,7 @@ where
|
||||
// TODO: we should be able to have a self-referential future here with Pin and not require cloned conns
|
||||
/// An async function that will loop over all the conns with a max parallel request count of ops.num_concurrent_req
|
||||
async fn parallel_conn_loop<C, P>(
|
||||
mut conns: Vec<AbstractNameServer<C, P>>,
|
||||
mut conns: Vec<NameServer<C, P>>,
|
||||
request: DnsRequest,
|
||||
opts: ResolverOpts,
|
||||
) -> Result<DnsResponse, ResolveError>
|
||||
@ -326,13 +326,13 @@ where
|
||||
// close to the connection, which means the top level resolution might take substantially longer
|
||||
// to fire than the timeout configured in `ResolverOpts`.
|
||||
let mut backoff = Duration::from_millis(20);
|
||||
let mut busy = SmallVec::<[AbstractNameServer<C, P>; 2]>::new();
|
||||
let mut busy = SmallVec::<[NameServer<C, P>; 2]>::new();
|
||||
|
||||
loop {
|
||||
let request_cont = request.clone();
|
||||
|
||||
// construct the parallel requests, 2 is the default
|
||||
let mut par_conns = SmallVec::<[AbstractNameServer<C, P>; 2]>::new();
|
||||
let mut par_conns = SmallVec::<[NameServer<C, P>; 2]>::new();
|
||||
let count = conns.len().min(opts.num_concurrent_reqs.max(1));
|
||||
|
||||
// Shuffe DNS NameServers to avoid overloads to the first configured ones
|
||||
@ -486,7 +486,7 @@ mod tests {
|
||||
use super::*;
|
||||
use crate::config::NameServerConfig;
|
||||
use crate::config::Protocol;
|
||||
use crate::name_server::NameServer;
|
||||
use crate::name_server::GenericNameServer;
|
||||
use crate::name_server::TokioRuntimeProvider;
|
||||
|
||||
#[ignore]
|
||||
@ -519,7 +519,7 @@ mod tests {
|
||||
resolver_config.add_name_server(config2);
|
||||
|
||||
let io_loop = Runtime::new().unwrap();
|
||||
let mut pool = NameServerPool::tokio_from_config(
|
||||
let mut pool = GenericNameServerPool::tokio_from_config(
|
||||
&resolver_config,
|
||||
&ResolverOpts::default(),
|
||||
TokioRuntimeProvider::new(),
|
||||
@ -581,10 +581,10 @@ mod tests {
|
||||
..ResolverOpts::default()
|
||||
};
|
||||
let ns_config = { tcp };
|
||||
let name_server = NameServer::new(ns_config, opts, conn_provider);
|
||||
let name_server = GenericNameServer::new(ns_config, opts, conn_provider);
|
||||
let name_servers: Arc<[_]> = Arc::from([name_server]);
|
||||
|
||||
let mut pool = NameServerPool::from_nameservers_test(
|
||||
let mut pool = GenericNameServerPool::from_nameservers_test(
|
||||
&opts,
|
||||
Arc::from([]),
|
||||
Arc::clone(&name_servers),
|
||||
|
@ -17,14 +17,13 @@ use trust_dns_proto::error::ProtoError;
|
||||
use trust_dns_proto::xfer::{DnsHandle, DnsResponse, FirstAnswer};
|
||||
use trust_dns_resolver::config::*;
|
||||
use trust_dns_resolver::error::{ResolveError, ResolveErrorKind};
|
||||
use trust_dns_resolver::name_server::{AbstractNameServer, AbstractNameServerPool};
|
||||
use trust_dns_resolver::name_server::{NameServer, NameServerPool};
|
||||
|
||||
const DEFAULT_SERVER_ADDR: IpAddr = IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1));
|
||||
|
||||
type MockedNameServer<O> =
|
||||
AbstractNameServer<MockClientHandle<O, ResolveError>, MockConnProvider<O>>;
|
||||
type MockedNameServer<O> = NameServer<MockClientHandle<O, ResolveError>, MockConnProvider<O>>;
|
||||
type MockedNameServerPool<O> =
|
||||
AbstractNameServerPool<MockClientHandle<O, ResolveError>, MockConnProvider<O>>;
|
||||
NameServerPool<MockClientHandle<O, ResolveError>, MockConnProvider<O>>;
|
||||
|
||||
#[cfg(test)]
|
||||
fn mock_nameserver(
|
||||
@ -80,7 +79,7 @@ fn mock_nameserver_on_send_nx<O: OnSend + Unpin>(
|
||||
};
|
||||
let client = MockClientHandle::mock_on_send(messages, on_send);
|
||||
|
||||
AbstractNameServer::from_conn(
|
||||
NameServer::from_conn(
|
||||
NameServerConfig {
|
||||
socket_addr: SocketAddr::new(addr, 0),
|
||||
protocol: Protocol::Udp,
|
||||
@ -115,10 +114,10 @@ fn mock_nameserver_pool_on_send<O: OnSend + Unpin>(
|
||||
options: ResolverOpts,
|
||||
) -> MockedNameServerPool<O> {
|
||||
#[cfg(not(feature = "mdns"))]
|
||||
return AbstractNameServerPool::from_nameservers(&options, udp, tcp);
|
||||
return NameServerPool::from_nameservers(&options, udp, tcp);
|
||||
|
||||
#[cfg(feature = "mdns")]
|
||||
return AbstractNameServerPool::from_nameservers(
|
||||
return NameServerPool::from_nameservers(
|
||||
&options, udp,
|
||||
tcp,
|
||||
//_mdns.unwrap_or_else(move || mock_nameserver_on_send(vec![], options, on_send)),
|
||||
|
Loading…
Reference in New Issue
Block a user