Does std::net::ToSocketAddrs block async runtimes during DNS resolution?
0 reputation · 03 May 2026, 02:38 UTC
std::net::ToSocketAddrs relies on the blocking getaddrinfo call, which can freeze an async runtime when DNS queries take time. The function provides no async API, exposes TTL values inconsistently, and does not integrate DNSSEC verification, limiting its suitability for modern asynchronous applications. Meanwhile, rustls requires explicit root store management and its `InvalidCertificate` error offers limited context for troubleshooting certificate chain issues.
Is there a reliable way to perform non‑blocking DNS lookups with full TTL and DNSSEC support in pure Rust? How should rustls be configured to emit detailed certificate validation diagnostics? Can a unified error reporting layer be defined for DNS and TLS failures across std and third‑party crates?