mirror of
https://github.com/slackhq/nebula.git
synced 2025-12-15 15:20:44 -08:00
Use generics for CIDRTrees to avoid casting issues (#1004)
This commit is contained in:
parent
a44e1b8b05
commit
5181cb0474
21 changed files with 264 additions and 247 deletions
|
|
@ -23,7 +23,7 @@ type tun struct {
|
|||
cidr *net.IPNet
|
||||
MTU int
|
||||
Routes []Route
|
||||
routeTree *cidr.Tree4
|
||||
routeTree *cidr.Tree4[iputil.VpnIp]
|
||||
l *logrus.Logger
|
||||
|
||||
io.ReadWriteCloser
|
||||
|
|
@ -115,12 +115,8 @@ func (t *tun) Activate() error {
|
|||
}
|
||||
|
||||
func (t *tun) 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 *tun) Cidr() *net.IPNet {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue