Ipv4 to ipv6 mapped address?

Hey folks,

If I have an ipv6 address I can see if it is a ipv4_mapped address like so:

In [12]: i = IPv6Address('::ffff:2222:1111')

In [13]: i.ipv4_mapped
Out[13]: IPv4Address('')


Can we have a ipv6_mapped property on IPv4Address to get the ipv6 mapped address for the given ipv4 address as defined by RFC 3056 - Connection of IPv6 Domains via IPv4 Clouds ?

There has been at least a couple random cases where I would have been able to use this functionality. I know we can manually do it with math, but I figure it makes sense as the other side to ipv4_mapped.

You can construct them using the IPv4 notation:

>>> ipaddress.IPv6Address("::")

Is that what you’re looking for?

1 Like

Yep exactly. Though that isn’t really obvious at least to me. Hence figuring ipv6_mapped would be nice.