Skip to content
This repository has been archived by the owner on May 25, 2023. It is now read-only.

Add dotted decimal output for mapped addr #219

Closed
wants to merge 1 commit into from

Conversation

cmol
Copy link

@cmol cmol commented Feb 8, 2022

For IPv4 mapped IPv6 addresses it is commont to see the IPv4 part of the
address as dotted decmal after a prefix of ::ffff: making
::ffff:c000:0202 be printed as ::ffff:192.0.2.2.

This commit implements a method that prints this format for mapped
addresses, and uses String() for all non mapped addresses.

For IPv4 mapped IPv6 addresses it is commont to see the IPv4 part of the
address as dotted decmal after a prefix of `::ffff:` making
`::ffff:c000:0202` be printed as `::ffff:192.0.2.2`.

This commit implements a method that prints this format for mapped
addresses, and uses `String()` for all non mapped addresses.
@bradfitz
Copy link
Contributor

bradfitz commented Feb 8, 2022

Now that this is in Go 1.18, we're no longer adding features to this package.

Also, this is already the behavior in Go 1.18: https://go.dev/play/p/mexPHj_mn8a?v=gotip

@bradfitz bradfitz closed this Feb 8, 2022
@cmol cmol deleted the ipv4_mapped_ipv6_dotted_decimal branch February 8, 2022 14:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants