Skip to content

amqp-rs/hickory-to-socket-addrs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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<_>>();

About

`std::net::ToSocketAddrs` on top of `hickory-dns`

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Languages