Extra stuff from inet.af/netaddr that didn't make it into Go's net/netip

  • By null
  • Last update: Dec 27, 2022
  • Comments: 3

netipx Test Status Go Reference

What

This is a package containing the bits of the old inet.af/netaddr package that didn't make it into Go 1.18's net/netip standard library package.

As background, see:

This package requires Go 1.18+ to use and complements the net/netip.

FAQ

Why's it no longer under inet.af? Since that joke started, that TLD is now under control of the Taliban. (Yes, we should've known better. We'd even previously scolded people for relying on questionable ccTLDs. Whoops.)

Will this stuff make it into the standard library? Maybe. We'll see.

Download

netipx.zip

Comments(3)

  • 1

    how to merge ip range to ips and mask?

    like this: Range(192.168.11.11-192.168.11.11) ==> IP(192.168.11.11) Range(192.168.12.0-192.168.12.255) ==> NETWORK(192.168.12.0/24)

    thank you so much ! ! !

  • 2

    removed intern and assume-no-moving-gc

    i recently found out that my builds was broken by inetaf/netaddr after updating to go 1.19, the error was because of an outdated assume-no-moving-gc package.

    ok this was easy to solve since 1.19 was added to the allowlist in assume-no-moving-gc, but it would be nice to not have this problems on updates. I really like the solution of netipx of reimplementing the builder(etc..) for the new netip package.

    I checked the codebase and assume-no-moving-gc was imported by the go4.org/intern package, in netipx the intern package is now only used in a single testfile netipx_test.go and seems to be deprecated.

  • 3

    rename IPRange, IPSet, IPSetBuilder without the "IP" prefix?

    pros:

    1. shorter
    2. consistent with net/netip's Addr, Prefix
    3. there's no v1 release yet, so it's technically still possible

    cons:

    1. would require more work when upgrading from v0 to v1

    on an unrelated note, I have a couple of questions on the direction of this project:

    1. ~~is the intention to upstream more of netipx into net/netip?~~ nvm just read https://github.com/golang/go/issues/53236
    2. are there plans for a stable v1 release?