Crates.io | async-std-resolver |
lib.rs | async-std-resolver |
version | 0.25.0-alpha.3 |
source | src |
created_at | 2020-04-10 22:12:52.712954 |
updated_at | 2024-11-08 20:08:24.504463 |
description | Hickory DNS is a safe and secure DNS library, for async-std. This Resolver library uses the hickory-proto library to perform all DNS queries. The Resolver is intended to be a high-level library for any DNS record resolution see Resolver and AsyncResolver for supported resolution types. The Client can be used for other queries. |
homepage | https://hickory-dns.org/ |
repository | https://github.com/hickory-dns/hickory-dns |
max_upload_size | |
id | 228479 |
size | 41,754 |
Hickory DNS Async-Std Resolver is a library which implements the DNS resolver using the Hickory DNS Resolver library.
This library contains implementations for IPv4 (A) and IPv6 (AAAA) resolution, more features are in the works. It is built on top of the async-std async-io project, this allows it to be integrated into other systems using the async-std and futures libraries. The Hickory DNS project contains other libraries for DNS: a client library for raw protocol usage, a server library for hosting zones, and variations on the TLS implementation over rustls and native-tls.
NOTICE This project was rebranded from Trust-DNS to Hickory DNS and has been moved to the https://github.com/hickory-dns/hickory-dns organization and repo, from 0.24
and onward.
/etc/resolv.conf
based configuration on Unix/Posix systemsmdns
feature)native-tls
, rustls
, and openssl
; native-tls
or rustls
are recommended)rustls
)use std::net::*;
use async_std::prelude::*;
use async_std_resolver::{resolver, config};
#[async_std::main]
async fn main() {
// Construct a new Resolver with default configuration options
let resolver = resolver(
config::ResolverConfig::default(),
config::ResolverOpts::default(),
).await;
// Lookup the IP addresses associated with a name.
// This returns a future that will lookup the IP addresses, it must be run in the Core to
// to get the actual result.
let mut response = resolver.lookup_ip("www.example.com.").await.unwrap();
// There can be many addresses associated with the name,
// this can return IPv4 and/or IPv6 addresses
let address = response.iter().next().expect("no addresses returned!");
if address.is_ipv4() {
assert_eq!(address, IpAddr::V4(Ipv4Addr::new(93, 184, 215, 14)));
} else {
assert_eq!(address, IpAddr::V6(Ipv6Addr::new(0x2606, 0x2800, 0x21f, 0xcb07, 0x6820, 0x80da, 0xaf6b, 0x8b2c)));
}
}
The current minimum rustc version for this project is 1.70
Hickory DNS does its best job to follow semver. Hickory DNS will be promoted to 1.0 upon stabilization of the publicly exposed APIs. This does not mean that Hickory DNS will necessarily break on upgrades between 0.x updates. Whenever possible, old APIs will be deprecated with notes on what replaced those deprecations. Hickory DNS will make a best effort to never break software which depends on it due to API changes, though this can not be guaranteed. Deprecated interfaces will be maintained for at minimum one major release after that in which they were deprecated (where possible), with the exception of the upgrade to 1.0 where all deprecated interfaces will be planned to be removed.