netaddr icon indicating copy to clipboard operation
netaddr copied to clipboard

Make IPSet a fmt.Stringer?

Open josharian opened this issue 4 years ago • 3 comments

@Xe requested that IPSet be a fmt.Stringer. It's not obvious what a good representation would be, but having something to look at would be better than nothing. One option might be something like:

IPSet(127.0.0.0-127.0.0.255,192.168.1.5-192.168.1.5 without 127.0.0.1-127.0.0.2)

Other ideas welcomed.

josharian avatar Jun 29 '21 21:06 josharian

why the without part if you could "simply" say 127.0.0.3-127.0.0.255?

jxsl13 avatar Sep 23 '21 22:09 jxsl13

Once minimized, the IPSet consists of only inclusive ranges, so the without part would never appear. Given that, a comma-separated list of IPRange's stringification seems like a fine string form. WDYT @josharian

danderson avatar Sep 23 '21 22:09 danderson

SGTM

josharian avatar Sep 24 '21 17:09 josharian