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.
Coverage decreased (-0.4%) to 95.16% when pulling 129dcf86e10569d10f0078000ab8de5d7e9ebc61 on Freeaqingme:master into 1966d35336fbd6e5f4204453c6a269d16e01b027 on pires:main.
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.