-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement Happy Eyeballs for TCP connections #25661
Comments
As on potential option, the HttpConnector in hyper-util provides happy eyeballs, and it returns a |
This is also an issue with testcontainers-node, where it fails to resolve docker client due to same reason
i ported the testcontainers package to deno and made a simple deno test to make a generic container like this:
|
I could try to make a stab on this, if no one has planned it yet. |
im beginning to think why use localhost at all, why not just use 127.0.0.1 🤷♂️ i think there has been several debates about localhost vs 127.0.0.1 on the internet, saying localhost is not stable. Its system dependent. btw, poking a bit into the ext/net, nothing particularly stands out and i think i would need some serious pointers if i were to do anything with that module in terms of fixing this issue ;) made a test though that just proves the point, that localhost returns both ipv6 and ipv4. #[test]
fn resolve_addr_localhost_sync() {
let expected = vec![
SocketAddr::V6(SocketAddrV6::new(
Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1),
80,
0,
0
)),
SocketAddr::V4(SocketAddrV4::new(
Ipv4Addr::new(127, 0, 0, 1),
80,
))
];
let actual = resolve_addr_sync("localhost", 80)
.unwrap()
.collect::<Vec<_>>();
assert_eq!(actual, expected);
} |
Right now we generally prefer IPv6 to IPv4 addresses when connecting to services. This unfortunately causes users to run into "connection failed" errors when their service does not actually listen on IPv6 (even though the DNS resolves to an IPv6 address).
Happy Eyeballs fixes this. It establishes connections to multiple addresses in parallel and uses the first one that connects.
The text was updated successfully, but these errors were encountered: