corebgp icon indicating copy to clipboard operation
corebgp copied to clipboard

Use netip.Addr instead of net.IP

Open grongor opened this issue 3 years ago • 2 comments

Hello!

First, let me thank you for this great package :) It helped me a lot recently.

In Go 1.18 there will be a new netip package that contains a better implementation of IP addresses (originally at https://github.com/inetaf/netaddr , see https://github.com/golang/go/issues/46518 ). I've been using it for a while and for most workloads it's much better :) Conversion between netip.Addr and net.IP is possible and trivial, so anybody who wishes to keep using net.IP can do so without much hassle. I just think that we should default to netip.Addr, and use net.IP only where required (address manipulation at bit/byte level).

Go 1.18 will be out in February, so there is no rush :) But please let me know if you intend to merge this. Because if you do, I'd like to post more PRs, namely the fixes for the two issues you have here and then also some adjustments to the peer config struct (I'd like to separate the config and state, and include the peer state in plugin API).

grongor avatar Dec 19 '21 14:12 grongor

thanks @grongor, let's see what this looks like in the standard library when 1.18 lands. This would obviously be a breaking change, but it also forces users to adopt 1.18. Maybe a corebgp v1.0 would be a nice place for this to land.

jwhited avatar Dec 30 '21 00:12 jwhited

Yeah that was also what I was thinking :) Forcing users to use latest Go isn't a problem because Go is perfectly backwards compatible. Please ping me when/if you decide to use this, I would then build on top of that. Thanks!

grongor avatar Dec 30 '21 07:12 grongor

closed with std lib netip in https://github.com/jwhited/corebgp/commit/f6ab10ec00942d7608c69603d85b09225a6ffda7

jwhited avatar Dec 18 '22 00:12 jwhited