Add IPv6 support for gRPC gun adapter#495
Merged
polvalente merged 8 commits intoelixir-grpc:masterfrom Feb 10, 2026
Merged
Conversation
sleipnir
requested changes
Feb 9, 2026
Collaborator
sleipnir
left a comment
There was a problem hiding this comment.
Could you add a test to verify this fallback?
sleipnir
approved these changes
Feb 9, 2026
polvalente
approved these changes
Feb 10, 2026
Co-authored-by: Paulo Valente <16843419+polvalente@users.noreply.github.com>
Co-authored-by: Paulo Valente <16843419+polvalente@users.noreply.github.com>
Contributor
Author
|
Thanks for the reviews! 👍 |
polvalente
approved these changes
Feb 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Improves IPv6 support for gRPC client connections by (1) falling back to AAAA DNS lookups when no A records exist, and (2) passing IP addresses to Gun as tuples instead of strings.
Why
IPv6 connections were failing with the Gun adapter for two reasons:
dns://targets, only A (IPv4) records were queried. Hosts that expose only IPv6 or that we want to use over IPv6 had no resolved addresses, so the client never attempted an IPv6 connection.:gun.open/3as a string. Gun expects IP addresses asinet:ip_address()tuples (e.g. an 8-element tuple for IPv6). Passing a string could lead to failed or unreliable IPv6 connections.This PR fixes both: DNS now falls back to AAAA when A returns nothing, and we parse IP strings to tuples before calling Gun so IPv6 addresses are in the correct form.
Changes
1. DNS resolver: AAAA fallback (
grpc_client/lib/grpc/client/resolver/dns.ex)lookup_addresses(host, :aaaa).2. Gun adapter: parse host to tuple before
open(grpc_client/lib/grpc/client/adapters/gun.ex):gun.open/3, the host is passed through a newparse_address/1helper.:inet.parse_address/1is used and the resulting tuple is passed to:gun.open.