incus-mirror/shared/tls
John Axel Eriksson 07852cf616
shared/tls: implement Happy Eyeballs (RFC 8305) in RFC3493Dialer
The RFC3493Dialer function, before this, tried addresses sequentially
with a 10-second timeout per address. This causes problems in dual-stack
environments where one address family is unreachable:

- If DNS returns IPv4 addresses first but IPv4 is unreachable (e.g., in
  IPv6-only environments), the dialer would spend 10+ seconds timing out
  on each IPv4 address before trying IPv6.
- This exceeded typical HTTP client timeouts, causing connection failures
  even when IPv6 connectivity was available.

This change implements Happy Eyeballs (RFC 8305):

1. Sort addresses with IPv6 first (RFC 8305 recommends preferring IPv6)
2. Start connection attempts with a 250ms staggered delay (per RFC 8305)
3. Return the first successful connection immediately
4. Finally clean up unused connections

Signed-off-by: John Axel Eriksson <john@insane.se>
2025-12-16 14:07:07 -05:00
..
tlstest Move tls testing functions to tlstest 2025-04-19 10:08:43 +08:00
acme_test.go shared/tls: Move ACME challenge to shared/tls 2025-12-10 11:44:58 -08:00
acme.go shared/tls: Move ACME challenge to shared/tls 2025-12-10 11:44:58 -08:00
cert_test.go global: Update Go package to v6 2024-04-05 11:11:11 -04:00
cert.go shared/tls: Don't needlessly use format string functions 2025-05-23 01:42:22 -04:00
network_unix.go global: Update for shared/cert 2023-09-08 10:36:05 -04:00
network_windows.go shared/tls: Don't needlessly use format string functions 2025-05-23 01:42:22 -04:00
tls_test.go shared/tls: implement Happy Eyeballs (RFC 8305) in RFC3493Dialer 2025-12-16 14:07:07 -05:00
tls.go shared/tls: implement Happy Eyeballs (RFC 8305) in RFC3493Dialer 2025-12-16 14:07:07 -05:00