mirror of
https://github.com/slackhq/nebula.git
synced 2026-02-16 01:34:22 +01:00
Remove WriteRaw, cidrTree -> routeTree to better describe its purpose, remove redundancy from field names (#582)
This commit is contained in:
@@ -4,8 +4,10 @@ import (
|
||||
"fmt"
|
||||
"math"
|
||||
"net"
|
||||
"runtime"
|
||||
"strconv"
|
||||
|
||||
"github.com/slackhq/nebula/cidr"
|
||||
"github.com/slackhq/nebula/config"
|
||||
)
|
||||
|
||||
@@ -16,6 +18,20 @@ type Route struct {
|
||||
Via *net.IP
|
||||
}
|
||||
|
||||
func makeRouteTree(routes []Route, allowMTU bool) (*cidr.Tree4, error) {
|
||||
routeTree := 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 {
|
||||
routeTree.AddCIDR(r.Cidr, r.Via)
|
||||
}
|
||||
}
|
||||
return routeTree, nil
|
||||
}
|
||||
|
||||
func parseRoutes(c *config.C, network *net.IPNet) ([]Route, error) {
|
||||
var err error
|
||||
|
||||
|
||||
Reference in New Issue
Block a user