Skip to content

Add IPv6 client support with Happy Eyeballs#150

Merged
benoitc merged 5 commits into
mainfrom
feat/client-ipv6-happy-eyeballs
May 30, 2026
Merged

Add IPv6 client support with Happy Eyeballs#150
benoitc merged 5 commits into
mainfrom
feat/client-ipv6-happy-eyeballs

Conversation

@benoitc
Copy link
Copy Markdown
Owner

@benoitc benoitc commented May 30, 2026

Adds IPv6 to the client connect path.

quic:connect/4 now accepts IP-tuple and bracketed IPv6 literal hosts, resolves hostnames in the caller process (returning {error, _} instead of silently dialing localhost on failure), and uses RFC 8305 Happy Eyeballs for dual-stack hostnames: addresses are raced IPv6-first and the first to finish its handshake is returned. For a multi-address hostname connect/4 blocks until the first attempt connects; a single address, IP literal/tuple, or pre-opened socket keeps the immediate async return.

The migration rebind now reopens the socket with the connection's address family. Racing attempts and coordinators run under supervision, and connections monitor their owner so a supervised winner closes when its owner exits.

New options: happy_eyeballs (default true), family (inet | inet6 | any), connection_attempt_delay (250 ms), connect_timeout (5000 ms).

quic:connect("example.com", 443, #{}, self()).                 % Happy Eyeballs, IPv6-first
quic:connect("[::1]", 443, #{}, self()).                       % IPv6 literal
quic:connect("example.com", 443, #{family => inet6}, self()).  % force IPv6

benoitc added 5 commits May 30, 2026 11:05
- Resolve hostnames in the caller and race addresses IPv6-first, returning errors instead of dialing localhost
- Accept IP-tuple and bracketed IPv6 literal hosts; add family, happy_eyeballs, connection_attempt_delay and connect_timeout options
- Reopen the migration socket with the connection's address family
- Supervise connection attempts and Happy Eyeballs coordinators; monitor the owner so a supervised connection closes with it
@benoitc benoitc merged commit 980b40d into main May 30, 2026
10 checks passed
@benoitc benoitc deleted the feat/client-ipv6-happy-eyeballs branch May 30, 2026 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant