Skip to content

shadowylab/tokio-happy-eyeballs

Repository files navigation

tokio-happy-eyeballs

Happy Eyeballs (RFC 8305) for dual-stack IPv6/IPv4 connections.

What it does

  • resolves DNS for IPv6 and IPv4;
  • prioritizes IPv6;
  • starts IPv4 after 250 ms if IPv6 has not completed yet;
  • returns the first successful connection.

Example

#[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(())
}

License

This project is distributed under the MIT software license – see the LICENSE file for details

About

Happy Eyeballs (RFC 8305) for dual-stack IPv6/IPv4 connections.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors