Skip to content

Prefer IPv6 over IPv4 during endpoint resolution - #60

Draft
userunkn4wn wants to merge 1 commit into
WireGuard:masterfrom
userunkn4wn:master
Draft

Prefer IPv6 over IPv4 during endpoint resolution#60
userunkn4wn wants to merge 1 commit into
WireGuard:masterfrom
userunkn4wn:master

Conversation

@userunkn4wn

Copy link
Copy Markdown

I know this repository is only a mirror, but I would still like to use this pull request to start a discussion.

I noticed that WireGuard on iOS appears to prefer IPv4 DNS records over IPv6 records. This behavior is not suitable for my use case and may reflect a more traditional or legacy address-selection approach.

The proposed change demonstrates one possible way to prefer IPv6 over IPv4:

  1. First, resolve the hostname using AF_INET6 together with AI_ADDRCONFIG.
  2. If a usable IPv6 address is returned, use it as the resolved endpoint.
  3. Otherwise, fall back to the original resolution logic, which prefers IPv4.

Please note that AI_ADDRCONFIG does not verify actual IPv6 connectivity. It only ensures that IPv6 results are returned when IPv6 is configured on the local system.

This code has not been tested because I do not currently have access to the Apple Developer Program. I would therefore appreciate feedback, testing, or suggestions for a better implementation.

I would also be interested in discussing whether there are still technical reasons for preferring IPv4 over IPv6 on current iOS versions.

Signed-off-by: Fabian <98067373+userunkn4wn@users.noreply.github.com>
@celyr

celyr commented Jul 13, 2026

Copy link
Copy Markdown

+1, if not this at least give us an option to prefer ipv6 if available!

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