8000 Add IPv6 support via inet_family by dominicletz · Pull Request #149 · dominicletz/websockex · GitHub
[go: up one dir, main page]

Skip to content

Add IPv6 support via inet_family - #149

Merged
dominicletz merged 1 commit into
masterfrom
cursor/ipv6-inet-family-1af8
Nov 2, 2026
Merged

dominicletz merged 1 commit into
masterfrom
cursor/ipv6-inet-family-1af8

Conversation

@dominicletz
@dominicletz dominicletz commented Nov 2, 2026 •
Copy link
Copy Markdown
Owner

Hostnames stay on IPv4. inet_family: :inet6 dials them over IPv6. An address literal selects its own family, so ws://[::1]:8080/ws does not need the option.

The family is the family of the socket that is opened. With an HTTP CONNECT proxy, that is the proxy host, not the WebSocket target. A family that disagrees with a literal address is an error from WebSockex.Conn.new/2.

:socket_options cannot carry this. Those options go through Keyword.merge/2, which rejects the bare :inet6 atom OTP expects, so the family is inserted beside that list and shared by direct TCP, TLS, and the proxy dial.

Also brackets IPv6 literals in the WebSocket Host header ([::1]:port), and does not send an IP address as SNI when a proxied wss:// connection is upgraded.

This replaces #139, which was based on the tree from November 2025 and could not be rebased onto the TLS verification and proxy changes. The new tests connect to a ::1 listener and read the peer address, and they are skipped only when that listen returns :eafnosupport or :eaddrnotavail.

Open in Web Open in Cursor 

Note

Medium Risk
Changes how sockets are opened for direct, TLS, and proxied paths, including SNI on tunnel upgrades, though defaults stay IPv4 and behavior is heavily tested.

Reviewed by Cursor Bugbot for commit 52cdd5a. Configure here.

8000

Hostnames stay on IPv4 unless inet_family: :inet6 is set. Address literals
select their own family, and a proxy uses the family of the proxy host.
The WebSocket Host header brackets IPv6 literals, and a TLS upgrade through
a proxy does not send an IP address as SNI.

Co-authored-by: dominic.letz <dominic.letz@berlin.de>
@dominicletz
dominicletz merged commit 9c31e42 into master Nov 2, 2026
3 checks passed
@dominicletz
dominicletz deleted the cursor/ipv6-inet-family-1af8 branch November 2, 2026 23:33
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.

2 participants

0