Allow connections to IPv6 addresses #280
Merged
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.
This pull request aims to fix a problem I ran into where
dogstatsd-ruby
was unable to submit metrics to an agent running on an IPv6-only Kubernetes cluster.UDPSocket.new
, unlike its TCP counterpart, will not automatically choose the best/correct address family.To remedy this, we call into
Addrinfo
to grab the appropriate family and then pass the parsed family over to UDPSocket. This will additionally work for DNS hostnames, but it will add a bit of time penalty due to the double-DNS lookup. This can be solved by usingAddrinfo.udp(host, port).connect
, but this broke far too many tests to be acceptable/solvable in one pull request.I've attempted to attach tests for the IPv6 case, which should be satisfactory.
Let me know if anything else is needed!