corebgp
corebgp copied to clipboard
Use netip.Addr instead of net.IP
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).
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.
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!
closed with std lib netip in https://github.com/jwhited/corebgp/commit/f6ab10ec00942d7608c69603d85b09225a6ffda7