Allow customizing the static hosts configuration

This allows custom runtimes to provide the hosts configuration in their
own way, like using io_uring instead of the std::fs::File::open() to
read the system hosts file.
This commit is contained in:
Fantix King
2022-05-01 15:39:06 -04:00
committed by Benjamin Fry
parent 788e056349
commit 1845ccd088
2 changed files with 63 additions and 54 deletions

View File

@@ -436,6 +436,11 @@ impl<C: DnsHandle<Error = ResolveError>, P: ConnectionProvider<Conn = C>> AsyncR
.await
}
/// Customizes the static hosts used in this resolver.
pub fn set_hosts(&mut self, hosts: Option<Hosts>) {
self.hosts = hosts.map(|hosts| Arc::new(hosts));
}
lookup_fn!(
reverse_lookup,
lookup::ReverseLookup,