Happy Eyeballs (RFC 8305) for dual-stack IPv6/IPv4 connections.
- resolves DNS for IPv6 and IPv4;
- prioritizes IPv6;
- starts IPv4 after 250 ms if IPv6 has not completed yet;
- returns the first successful connection.
#[tokio::main]
async fn main() -> std::io::Result<()> {
let stream = tokio_happy_eyeballs::connect("example.com:443").await?;
println!("Connected to {}", stream.peer_addr()?);
Ok(())
}This project is distributed under the MIT software license – see the LICENSE file for details