3 unstable releases

0.1.1 Jun 12, 2024
0.1.0 Sep 21, 2022
0.0.0 Jun 27, 2019

#1545 in Network programming

Download history 5/week @ 2024-05-31 151/week @ 2024-06-07 33/week @ 2024-06-14 3/week @ 2024-06-21 12/week @ 2024-07-19 30/week @ 2024-07-26

198 downloads per month
Used in also_sync

MIT/Apache

91KB
2K SLoC

async-dns

This crate provides asynchronous DNS lookups.

In asynchronous Rust code, it is necessary to resolve URL names using DNS. In most cases, this is done by calling getaddrinfo on a blocking threadpool. However, since DNS is a UDP-based protocol, it doesn't make much sense to block on a thread when fully asynchronous options are available.

This crate provides a fully asynchronous alternative, based on the following mechanisms:

  • On Windows, it uses the DnsQueryEx function, which allows for non-blocking DNS queries.
  • On Unix, it uses a custom implementation of DNS provided by the dns-protocol crate. async-fs is used to read files and async-io is used for the actual UDP packets.

It returns the list of addresses that it found to be associated with the given name.

License

Dual licensed under the MIT and Apache 2.0 licenses.

Dependencies

~3–13MB
~168K SLoC