Registry / networking / hickory-resolver

hickory-resolver

JSON →
library0.26.1rscratesunverified

A safe and secure DNS stub resolver library for DNS record resolution.

# Cargo.toml [dependencies] hickory-resolver = "0.26.1"
INSTALL
IMPORT
SIG · HICKORY-RESOLVER
H
hickory-resolver
networkingrustv0.26.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

TokioResolver
use hickory_resolver::TokioResolver;

Resolve a domain name to IP addresses using the Tokio-based resolver.

use hickory_resolver::TokioResolver; use std::net::IpAddr; #[tokio::main] async fn main() { let resolver = TokioResolver::new().unwrap(); let response = resolver.lookup_ip("example.com").await.unwrap(); for ip in response.iter() { println!("IP: {}", ip); } }
Debug
Known issues
gotchaRequires a Tokio runtime; the `TokioResolver` is async and must be used within an async context.
fix
Use `#[tokio::main]` or another async runtime.
affects: >=0.20.0
Upgrade
Version history
0.26.1latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
7 hits · last 30 days
node
6
Amazon
1
Resources
hickory-resolver — cargo add hickory-resolver · libregistry