DNS resolvers built on c-ares
, for asynchronous DNS requests.
This crate provides three resolver types - the Resolver
, the FutureResolver
, and the BlockingResolver
:
Resolver
is the thinnest wrapper around the underlying c-ares
library. It returns answers via callbacks. The other resolvers are built on top of this.FutureResolver
returns answers as futures::Future
s.BlockingResolver
isn't asynchronous at all - as the name suggests, it blocks until the lookup completes.API documentation is here.
```rust extern crate caresresolver; extern crate futures; extern crate tokio; use std::error::Error; use futures::future::Future;
fn main() { let resolver = caresresolver::FutureResolver::new().unwrap(); let query = resolver .querya("google.com") .maperr(|e| println!("Lookup failed with error '{}'", e.description())) .map(|result| println!("{}", result)); tokio::run(query); } ```
Further example programs can be found here.
Contributions are welcome. Please send pull requests!