Use generics for CIDRTrees to avoid casting issues (#1004)

This commit is contained in:
Nate Brown
2023-11-02 17:05:08 -05:00
committed by GitHub
parent a44e1b8b05
commit 5181cb0474
21 changed files with 264 additions and 247 deletions

View File

@@ -205,7 +205,7 @@ type HostInfo struct {
localIndexId uint32
vpnIp iputil.VpnIp
recvError atomic.Uint32
remoteCidr *cidr.Tree4
remoteCidr *cidr.Tree4[struct{}]
relayState RelayState
// HandshakePacket records the packets used to create this hostinfo
@@ -633,7 +633,7 @@ func (i *HostInfo) CreateRemoteCIDR(c *cert.NebulaCertificate) {
return
}
remoteCidr := cidr.NewTree4()
remoteCidr := cidr.NewTree4[struct{}]()
for _, ip := range c.Details.Ips {
remoteCidr.AddCIDR(&net.IPNet{IP: ip.IP, Mask: net.IPMask{255, 255, 255, 255}}, struct{}{})
}