Remove WriteRaw, cidrTree -> routeTree to better describe its purpose, remove redundancy from field names (#582)

This commit is contained in:
Nate Brown
2021-11-12 12:47:09 -06:00
committed by GitHub
parent 467e605d5e
commit 78d0d46bae
15 changed files with 137 additions and 204 deletions

View File

@@ -1,12 +1,9 @@
package overlay
import (
"fmt"
"net"
"runtime"
"github.com/sirupsen/logrus"
"github.com/slackhq/nebula/cidr"
"github.com/slackhq/nebula/config"
"github.com/slackhq/nebula/util"
)
@@ -52,17 +49,3 @@ func NewDeviceFromConfig(c *config.C, l *logrus.Logger, tunCidr *net.IPNet, fd *
)
}
}
func makeCidrTree(routes []Route, allowMTU bool) (*cidr.Tree4, error) {
cidrTree := cidr.NewTree4()
for _, r := range routes {
if !allowMTU && r.MTU > 0 {
return nil, fmt.Errorf("route MTU is not supported in %s", runtime.GOOS)
}
if r.Via != nil {
cidrTree.AddCIDR(r.Cidr, r.Via)
}
}
return cidrTree, nil
}