Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow connections to IPv6 addresses #280

Merged
merged 1 commit into from
Jul 21, 2023
Merged

Conversation

KazWolfe
Copy link
Contributor

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 using Addrinfo.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!

- Dynamically determine the address family to use with Addrinfo
- Set UDPSocket to use the determined address family.
- Add test case for v6 addressing
@remeh
Copy link
Contributor

remeh commented Jul 19, 2023

Hey @KazWolfe,

Thank you for the contribution! I'll give it a look later today.

@remeh
Copy link
Contributor

remeh commented Jul 21, 2023

LGTM! Thank you for the PR!

@remeh remeh merged commit 02e217e into DataDog:master Jul 21, 2023
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants