hickory-to-socket-addrs

Crates.iohickory-to-socket-addrs
lib.rshickory-to-socket-addrs
version4.1.0
created_at2025-08-10 15:59:55.167892+00
updated_at2025-08-20 07:35:14.530303+00
descriptionstd::net::ToSocketAddrs backed by hickory-dns
homepage
repositoryhttps://github.com/amqp-rs/hickory-to-socket-addrs
max_upload_size
id1789042
size52,839
Marc-Antoine Perennou (Keruspe)

documentation

https://docs.rs/hickory-to-socket-addrs

README

API Docs Build status Downloads Dependency Status LICENSE

hickory-to-socket-addrs: std::net::ToSocketAddrs on top of hickory-dns

The entry point is the HickoryToSocketAddrs struct, which wraps the host and port and use hickory-dns under the hood to perform DNS resolution instead of glibc's getaddrinfo which can block or has a lot of other known issues.

If this is run in a tokio context, we use it, otherwise we spawn a new tokio runtime to perform the query.

Example

use hickory_to_socket_addrs::HickoryToSocketAddrs;
use std::net::ToSocketAddrs;

let socket_addrs = "www.rust-lang.org:443"
    .parse::<HickoryToSocketAddrs<_>>()?
    .to_socket_addrs()?
    .collect::<Vec<_>>();
Commit count: 18

cargo fmt