-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Labels
Description
As mentioned in #9, extending the library in order to support conversions of an IPv4 address to an IPv4-Mapped IPv6 address and vice-versa could be useful in the case where we want to use IPv6 for dealing with both IPv4 and IPv6. Conversion should be according to section 2.5.5 of RFC 4291.
As an example:
// IP addresses
Ipv4 ipv4Address = Ipv4.parse("192.168.0.0");
Ipv6 ipv6Address = Ipv6.of(ipv4Address) // ::ffff:c0a8:0
Ipv6 ipv6Address = ipv4Address.asIpv4MappedIpv6(); // ::ffff:c0a8:0
boolean ... = ipv6Address.isIpv4MappedIpv6() // true
// IP ranges
Ipv4Range ipv4Range = Ipv4Range.parse("192.168.0.0/32")
Ipv6Range ipv6Range = ipv4range.asIpv4MappedIpv6(); // ::ffff:c0a8:0/120
...Reactions are currently unavailable