Skip to content

Conversation

Freeaqingme
Copy link
Contributor

This is a follow-up on MR #49 by @emersion . All credits should go to him :)

I had a need to parse 4in6 addresses myself as well, so I took his MR as a starting point and took it from there. I have not yet tested this code in production, but I figured I'd already turn it into a PR.

There is one issue that I had to sort of work around: In the default net.IP library, an IPv4 address is (or can be) stored more or less in the same way an IPv6 address is stored with a ::FFFF: prefix. As such, there's no way to make a distinction based on a net.IP object if it was an IPv4 address, or IPv6 4in6 address.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.4%) to 95.16% when pulling 129dcf8 on Freeaqingme:master into 1966d35 on pires:main.

@pires
Copy link
Owner

pires commented May 2, 2022

Maybe it's a good time to introduce https://pkg.go.dev/net/netip#Addr.Is4In6?

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.

4 participants