mirror of
https://github.com/slackhq/nebula.git
synced 2025-11-23 00:44:25 +01:00
Use generics for CIDRTrees to avoid casting issues (#1004)
This commit is contained in:
@@ -18,7 +18,7 @@ type waterTun struct {
|
||||
cidr *net.IPNet
|
||||
MTU int
|
||||
Routes []Route
|
||||
routeTree *cidr.Tree4
|
||||
routeTree *cidr.Tree4[iputil.VpnIp]
|
||||
|
||||
*water.Interface
|
||||
}
|
||||
@@ -97,12 +97,8 @@ func (t *waterTun) Activate() error {
|
||||
}
|
||||
|
||||
func (t *waterTun) RouteFor(ip iputil.VpnIp) iputil.VpnIp {
|
||||
r := t.routeTree.MostSpecificContains(ip)
|
||||
if r != nil {
|
||||
return r.(iputil.VpnIp)
|
||||
}
|
||||
|
||||
return 0
|
||||
_, r := t.routeTree.MostSpecificContains(ip)
|
||||
return r
|
||||
}
|
||||
|
||||
func (t *waterTun) Cidr() *net.IPNet {
|
||||
|
||||
Reference in New Issue
Block a user