pkg/mesh: rename mesh granularity types
This commit renames the mesh granularity types to make them more intuitive. The functionality provided by them remains exactly the same.
This commit is contained in:
parent
c65627dab0
commit
9f30d8d1a1
@ -59,8 +59,8 @@ var (
|
|||||||
string(mesh.AlwaysEncapsulate),
|
string(mesh.AlwaysEncapsulate),
|
||||||
}, ", ")
|
}, ", ")
|
||||||
availableGranularities = strings.Join([]string{
|
availableGranularities = strings.Join([]string{
|
||||||
string(mesh.DataCenterGranularity),
|
string(mesh.LogicalGranularity),
|
||||||
string(mesh.NodeGranularity),
|
string(mesh.FullGranularity),
|
||||||
}, ", ")
|
}, ", ")
|
||||||
availableLogLevels = strings.Join([]string{
|
availableLogLevels = strings.Join([]string{
|
||||||
logLevelAll,
|
logLevelAll,
|
||||||
@ -78,7 +78,7 @@ func Main() error {
|
|||||||
cni := flag.Bool("cni", true, "Should Kilo manage the node's CNI configuration.")
|
cni := flag.Bool("cni", true, "Should Kilo manage the node's CNI configuration.")
|
||||||
cniPath := flag.String("cni-path", mesh.DefaultCNIPath, "Path to CNI config.")
|
cniPath := flag.String("cni-path", mesh.DefaultCNIPath, "Path to CNI config.")
|
||||||
encapsulate := flag.String("encapsulate", string(mesh.AlwaysEncapsulate), fmt.Sprintf("When should Kilo encapsulate packets within a location. Possible values: %s", availableEncapsulations))
|
encapsulate := flag.String("encapsulate", string(mesh.AlwaysEncapsulate), fmt.Sprintf("When should Kilo encapsulate packets within a location. Possible values: %s", availableEncapsulations))
|
||||||
granularity := flag.String("mesh-granularity", string(mesh.DataCenterGranularity), fmt.Sprintf("The granularity of the network mesh to create. Possible values: %s", availableGranularities))
|
granularity := flag.String("mesh-granularity", string(mesh.LogicalGranularity), fmt.Sprintf("The granularity of the network mesh to create. Possible values: %s", availableGranularities))
|
||||||
kubeconfig := flag.String("kubeconfig", "", "Path to kubeconfig.")
|
kubeconfig := flag.String("kubeconfig", "", "Path to kubeconfig.")
|
||||||
hostname := flag.String("hostname", "", "Hostname of the node on which this process is running.")
|
hostname := flag.String("hostname", "", "Hostname of the node on which this process is running.")
|
||||||
listen := flag.String("listen", ":1107", "The address at which to listen for health and metrics.")
|
listen := flag.String("listen", ":1107", "The address at which to listen for health and metrics.")
|
||||||
@ -140,8 +140,8 @@ func Main() error {
|
|||||||
|
|
||||||
gr := mesh.Granularity(*granularity)
|
gr := mesh.Granularity(*granularity)
|
||||||
switch gr {
|
switch gr {
|
||||||
case mesh.DataCenterGranularity:
|
case mesh.LogicalGranularity:
|
||||||
case mesh.NodeGranularity:
|
case mesh.FullGranularity:
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("mesh granularity %v unknown; possible values are: %s", *granularity, availableGranularities)
|
return fmt.Errorf("mesh granularity %v unknown; possible values are: %s", *granularity, availableGranularities)
|
||||||
}
|
}
|
||||||
|
@ -45,8 +45,8 @@ var (
|
|||||||
k8s.Backend,
|
k8s.Backend,
|
||||||
}, ", ")
|
}, ", ")
|
||||||
availableGranularities = strings.Join([]string{
|
availableGranularities = strings.Join([]string{
|
||||||
string(mesh.DataCenterGranularity),
|
string(mesh.LogicalGranularity),
|
||||||
string(mesh.NodeGranularity),
|
string(mesh.FullGranularity),
|
||||||
}, ", ")
|
}, ", ")
|
||||||
availableLogLevels = strings.Join([]string{
|
availableLogLevels = strings.Join([]string{
|
||||||
logLevelAll,
|
logLevelAll,
|
||||||
@ -76,8 +76,8 @@ func runRoot(_ *cobra.Command, _ []string) error {
|
|||||||
|
|
||||||
opts.granularity = mesh.Granularity(granularity)
|
opts.granularity = mesh.Granularity(granularity)
|
||||||
switch opts.granularity {
|
switch opts.granularity {
|
||||||
case mesh.DataCenterGranularity:
|
case mesh.LogicalGranularity:
|
||||||
case mesh.NodeGranularity:
|
case mesh.FullGranularity:
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("mesh granularity %v unknown; posible values are: %s", granularity, availableGranularities)
|
return fmt.Errorf("mesh granularity %v unknown; posible values are: %s", granularity, availableGranularities)
|
||||||
}
|
}
|
||||||
@ -115,7 +115,7 @@ func main() {
|
|||||||
Version: version.Version,
|
Version: version.Version,
|
||||||
}
|
}
|
||||||
cmd.PersistentFlags().StringVar(&backend, "backend", k8s.Backend, fmt.Sprintf("The backend for the mesh. Possible values: %s", availableBackends))
|
cmd.PersistentFlags().StringVar(&backend, "backend", k8s.Backend, fmt.Sprintf("The backend for the mesh. Possible values: %s", availableBackends))
|
||||||
cmd.PersistentFlags().StringVar(&granularity, "mesh-granularity", string(mesh.DataCenterGranularity), fmt.Sprintf("The granularity of the network mesh to create. Possible values: %s", availableGranularities))
|
cmd.PersistentFlags().StringVar(&granularity, "mesh-granularity", string(mesh.LogicalGranularity), fmt.Sprintf("The granularity of the network mesh to create. Possible values: %s", availableGranularities))
|
||||||
cmd.PersistentFlags().StringVar(&kubeconfig, "kubeconfig", os.Getenv("KUBECONFIG"), "Path to kubeconfig.")
|
cmd.PersistentFlags().StringVar(&kubeconfig, "kubeconfig", os.Getenv("KUBECONFIG"), "Path to kubeconfig.")
|
||||||
cmd.PersistentFlags().StringVar(&subnet, "subnet", "10.4.0.0/16", "CIDR from which to allocate addressees to WireGuard interfaces.")
|
cmd.PersistentFlags().StringVar(&subnet, "subnet", "10.4.0.0/16", "CIDR from which to allocate addressees to WireGuard interfaces.")
|
||||||
|
|
||||||
|
@ -58,13 +58,13 @@ type Granularity string
|
|||||||
type Encapsulate string
|
type Encapsulate string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// DataCenterGranularity indicates that the network should create
|
// LogicalGranularity indicates that the network should create
|
||||||
// a mesh between data-centers but not between nodes within a
|
// a mesh between logical locations, e.g. data-centers, but not between
|
||||||
// single data-center.
|
// all nodes within a single location.
|
||||||
DataCenterGranularity Granularity = "data-center"
|
LogicalGranularity Granularity = "location"
|
||||||
// NodeGranularity indicates that the network should create
|
// FullGranularity indicates that the network should create
|
||||||
// a mesh between every node.
|
// a mesh between every node.
|
||||||
NodeGranularity Granularity = "node"
|
FullGranularity Granularity = "full"
|
||||||
// NeverEncapsulate indicates that no packets within a location
|
// NeverEncapsulate indicates that no packets within a location
|
||||||
// should be encapsulated.
|
// should be encapsulated.
|
||||||
NeverEncapsulate Encapsulate = "never"
|
NeverEncapsulate Encapsulate = "never"
|
||||||
|
@ -76,18 +76,18 @@ func NewTopology(nodes map[string]*Node, peers map[string]*Peer, granularity Gra
|
|||||||
for _, node := range nodes {
|
for _, node := range nodes {
|
||||||
var location string
|
var location string
|
||||||
switch granularity {
|
switch granularity {
|
||||||
case DataCenterGranularity:
|
case LogicalGranularity:
|
||||||
location = node.Location
|
location = node.Location
|
||||||
case NodeGranularity:
|
case FullGranularity:
|
||||||
location = node.Name
|
location = node.Name
|
||||||
}
|
}
|
||||||
topoMap[location] = append(topoMap[location], node)
|
topoMap[location] = append(topoMap[location], node)
|
||||||
}
|
}
|
||||||
var localLocation string
|
var localLocation string
|
||||||
switch granularity {
|
switch granularity {
|
||||||
case DataCenterGranularity:
|
case LogicalGranularity:
|
||||||
localLocation = nodes[hostname].Location
|
localLocation = nodes[hostname].Location
|
||||||
case NodeGranularity:
|
case FullGranularity:
|
||||||
localLocation = hostname
|
localLocation = hostname
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,8 +105,8 @@ func TestNewTopology(t *testing.T) {
|
|||||||
result *Topology
|
result *Topology
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "datacenter from a",
|
name: "logical from a",
|
||||||
granularity: DataCenterGranularity,
|
granularity: LogicalGranularity,
|
||||||
hostname: nodes["a"].Name,
|
hostname: nodes["a"].Name,
|
||||||
result: &Topology{
|
result: &Topology{
|
||||||
hostname: nodes["a"].Name,
|
hostname: nodes["a"].Name,
|
||||||
@ -141,8 +141,8 @@ func TestNewTopology(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "datacenter from b",
|
name: "logical from b",
|
||||||
granularity: DataCenterGranularity,
|
granularity: LogicalGranularity,
|
||||||
hostname: nodes["b"].Name,
|
hostname: nodes["b"].Name,
|
||||||
result: &Topology{
|
result: &Topology{
|
||||||
hostname: nodes["b"].Name,
|
hostname: nodes["b"].Name,
|
||||||
@ -177,8 +177,8 @@ func TestNewTopology(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "datacenter from c",
|
name: "logical from c",
|
||||||
granularity: DataCenterGranularity,
|
granularity: LogicalGranularity,
|
||||||
hostname: nodes["c"].Name,
|
hostname: nodes["c"].Name,
|
||||||
result: &Topology{
|
result: &Topology{
|
||||||
hostname: nodes["c"].Name,
|
hostname: nodes["c"].Name,
|
||||||
@ -213,8 +213,8 @@ func TestNewTopology(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "node from a",
|
name: "full from a",
|
||||||
granularity: NodeGranularity,
|
granularity: FullGranularity,
|
||||||
hostname: nodes["a"].Name,
|
hostname: nodes["a"].Name,
|
||||||
result: &Topology{
|
result: &Topology{
|
||||||
hostname: nodes["a"].Name,
|
hostname: nodes["a"].Name,
|
||||||
@ -259,8 +259,8 @@ func TestNewTopology(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "node from b",
|
name: "full from b",
|
||||||
granularity: NodeGranularity,
|
granularity: FullGranularity,
|
||||||
hostname: nodes["b"].Name,
|
hostname: nodes["b"].Name,
|
||||||
result: &Topology{
|
result: &Topology{
|
||||||
hostname: nodes["b"].Name,
|
hostname: nodes["b"].Name,
|
||||||
@ -305,8 +305,8 @@ func TestNewTopology(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "node from c",
|
name: "full from c",
|
||||||
granularity: NodeGranularity,
|
granularity: FullGranularity,
|
||||||
hostname: nodes["c"].Name,
|
hostname: nodes["c"].Name,
|
||||||
result: &Topology{
|
result: &Topology{
|
||||||
hostname: nodes["c"].Name,
|
hostname: nodes["c"].Name,
|
||||||
@ -387,34 +387,34 @@ func TestRoutes(t *testing.T) {
|
|||||||
result []*netlink.Route
|
result []*netlink.Route
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "datacenter from a",
|
name: "logical from a",
|
||||||
topology: mustTopoForGranularityAndHost(DataCenterGranularity, nodes["a"].Name),
|
topology: mustTopoForGranularityAndHost(LogicalGranularity, nodes["a"].Name),
|
||||||
result: []*netlink.Route{
|
result: []*netlink.Route{
|
||||||
{
|
{
|
||||||
Dst: mustTopoForGranularityAndHost(DataCenterGranularity, nodes["a"].Name).segments[1].cidrs[0],
|
Dst: mustTopoForGranularityAndHost(LogicalGranularity, nodes["a"].Name).segments[1].cidrs[0],
|
||||||
Flags: int(netlink.FLAG_ONLINK),
|
Flags: int(netlink.FLAG_ONLINK),
|
||||||
Gw: mustTopoForGranularityAndHost(DataCenterGranularity, nodes["a"].Name).segments[1].wireGuardIP,
|
Gw: mustTopoForGranularityAndHost(LogicalGranularity, nodes["a"].Name).segments[1].wireGuardIP,
|
||||||
LinkIndex: kiloIface,
|
LinkIndex: kiloIface,
|
||||||
Protocol: unix.RTPROT_STATIC,
|
Protocol: unix.RTPROT_STATIC,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Dst: oneAddressCIDR(nodes["b"].InternalIP.IP),
|
Dst: oneAddressCIDR(nodes["b"].InternalIP.IP),
|
||||||
Flags: int(netlink.FLAG_ONLINK),
|
Flags: int(netlink.FLAG_ONLINK),
|
||||||
Gw: mustTopoForGranularityAndHost(DataCenterGranularity, nodes["a"].Name).segments[1].wireGuardIP,
|
Gw: mustTopoForGranularityAndHost(LogicalGranularity, nodes["a"].Name).segments[1].wireGuardIP,
|
||||||
LinkIndex: kiloIface,
|
LinkIndex: kiloIface,
|
||||||
Protocol: unix.RTPROT_STATIC,
|
Protocol: unix.RTPROT_STATIC,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Dst: mustTopoForGranularityAndHost(DataCenterGranularity, nodes["a"].Name).segments[1].cidrs[1],
|
Dst: mustTopoForGranularityAndHost(LogicalGranularity, nodes["a"].Name).segments[1].cidrs[1],
|
||||||
Flags: int(netlink.FLAG_ONLINK),
|
Flags: int(netlink.FLAG_ONLINK),
|
||||||
Gw: mustTopoForGranularityAndHost(DataCenterGranularity, nodes["a"].Name).segments[1].wireGuardIP,
|
Gw: mustTopoForGranularityAndHost(LogicalGranularity, nodes["a"].Name).segments[1].wireGuardIP,
|
||||||
LinkIndex: kiloIface,
|
LinkIndex: kiloIface,
|
||||||
Protocol: unix.RTPROT_STATIC,
|
Protocol: unix.RTPROT_STATIC,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Dst: oneAddressCIDR(nodes["c"].InternalIP.IP),
|
Dst: oneAddressCIDR(nodes["c"].InternalIP.IP),
|
||||||
Flags: int(netlink.FLAG_ONLINK),
|
Flags: int(netlink.FLAG_ONLINK),
|
||||||
Gw: mustTopoForGranularityAndHost(DataCenterGranularity, nodes["a"].Name).segments[1].wireGuardIP,
|
Gw: mustTopoForGranularityAndHost(LogicalGranularity, nodes["a"].Name).segments[1].wireGuardIP,
|
||||||
LinkIndex: kiloIface,
|
LinkIndex: kiloIface,
|
||||||
Protocol: unix.RTPROT_STATIC,
|
Protocol: unix.RTPROT_STATIC,
|
||||||
},
|
},
|
||||||
@ -436,20 +436,20 @@ func TestRoutes(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "datacenter from b",
|
name: "logical from b",
|
||||||
topology: mustTopoForGranularityAndHost(DataCenterGranularity, nodes["b"].Name),
|
topology: mustTopoForGranularityAndHost(LogicalGranularity, nodes["b"].Name),
|
||||||
result: []*netlink.Route{
|
result: []*netlink.Route{
|
||||||
{
|
{
|
||||||
Dst: mustTopoForGranularityAndHost(DataCenterGranularity, nodes["b"].Name).segments[0].cidrs[0],
|
Dst: mustTopoForGranularityAndHost(LogicalGranularity, nodes["b"].Name).segments[0].cidrs[0],
|
||||||
Flags: int(netlink.FLAG_ONLINK),
|
Flags: int(netlink.FLAG_ONLINK),
|
||||||
Gw: mustTopoForGranularityAndHost(DataCenterGranularity, nodes["b"].Name).segments[0].wireGuardIP,
|
Gw: mustTopoForGranularityAndHost(LogicalGranularity, nodes["b"].Name).segments[0].wireGuardIP,
|
||||||
LinkIndex: kiloIface,
|
LinkIndex: kiloIface,
|
||||||
Protocol: unix.RTPROT_STATIC,
|
Protocol: unix.RTPROT_STATIC,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Dst: oneAddressCIDR(nodes["a"].InternalIP.IP),
|
Dst: oneAddressCIDR(nodes["a"].InternalIP.IP),
|
||||||
Flags: int(netlink.FLAG_ONLINK),
|
Flags: int(netlink.FLAG_ONLINK),
|
||||||
Gw: mustTopoForGranularityAndHost(DataCenterGranularity, nodes["b"].Name).segments[0].wireGuardIP,
|
Gw: mustTopoForGranularityAndHost(LogicalGranularity, nodes["b"].Name).segments[0].wireGuardIP,
|
||||||
LinkIndex: kiloIface,
|
LinkIndex: kiloIface,
|
||||||
Protocol: unix.RTPROT_STATIC,
|
Protocol: unix.RTPROT_STATIC,
|
||||||
},
|
},
|
||||||
@ -471,18 +471,18 @@ func TestRoutes(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "datacenter from c",
|
name: "logical from c",
|
||||||
topology: mustTopoForGranularityAndHost(DataCenterGranularity, nodes["c"].Name),
|
topology: mustTopoForGranularityAndHost(LogicalGranularity, nodes["c"].Name),
|
||||||
result: []*netlink.Route{
|
result: []*netlink.Route{
|
||||||
{
|
{
|
||||||
Dst: oneAddressCIDR(mustTopoForGranularityAndHost(DataCenterGranularity, nodes["c"].Name).segments[0].wireGuardIP),
|
Dst: oneAddressCIDR(mustTopoForGranularityAndHost(LogicalGranularity, nodes["c"].Name).segments[0].wireGuardIP),
|
||||||
Flags: int(netlink.FLAG_ONLINK),
|
Flags: int(netlink.FLAG_ONLINK),
|
||||||
Gw: nodes["b"].InternalIP.IP,
|
Gw: nodes["b"].InternalIP.IP,
|
||||||
LinkIndex: privIface,
|
LinkIndex: privIface,
|
||||||
Protocol: unix.RTPROT_STATIC,
|
Protocol: unix.RTPROT_STATIC,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Dst: mustTopoForGranularityAndHost(DataCenterGranularity, nodes["c"].Name).segments[0].cidrs[0],
|
Dst: mustTopoForGranularityAndHost(LogicalGranularity, nodes["c"].Name).segments[0].cidrs[0],
|
||||||
Flags: int(netlink.FLAG_ONLINK),
|
Flags: int(netlink.FLAG_ONLINK),
|
||||||
Gw: nodes["b"].InternalIP.IP,
|
Gw: nodes["b"].InternalIP.IP,
|
||||||
LinkIndex: privIface,
|
LinkIndex: privIface,
|
||||||
@ -496,7 +496,7 @@ func TestRoutes(t *testing.T) {
|
|||||||
Protocol: unix.RTPROT_STATIC,
|
Protocol: unix.RTPROT_STATIC,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Dst: oneAddressCIDR(mustTopoForGranularityAndHost(DataCenterGranularity, nodes["c"].Name).segments[1].wireGuardIP),
|
Dst: oneAddressCIDR(mustTopoForGranularityAndHost(LogicalGranularity, nodes["c"].Name).segments[1].wireGuardIP),
|
||||||
Flags: int(netlink.FLAG_ONLINK),
|
Flags: int(netlink.FLAG_ONLINK),
|
||||||
Gw: nodes["b"].InternalIP.IP,
|
Gw: nodes["b"].InternalIP.IP,
|
||||||
LinkIndex: privIface,
|
LinkIndex: privIface,
|
||||||
@ -526,34 +526,34 @@ func TestRoutes(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "node from a",
|
name: "full from a",
|
||||||
topology: mustTopoForGranularityAndHost(NodeGranularity, nodes["a"].Name),
|
topology: mustTopoForGranularityAndHost(FullGranularity, nodes["a"].Name),
|
||||||
result: []*netlink.Route{
|
result: []*netlink.Route{
|
||||||
{
|
{
|
||||||
Dst: mustTopoForGranularityAndHost(NodeGranularity, nodes["a"].Name).segments[1].cidrs[0],
|
Dst: mustTopoForGranularityAndHost(FullGranularity, nodes["a"].Name).segments[1].cidrs[0],
|
||||||
Flags: int(netlink.FLAG_ONLINK),
|
Flags: int(netlink.FLAG_ONLINK),
|
||||||
Gw: mustTopoForGranularityAndHost(NodeGranularity, nodes["a"].Name).segments[1].wireGuardIP,
|
Gw: mustTopoForGranularityAndHost(FullGranularity, nodes["a"].Name).segments[1].wireGuardIP,
|
||||||
LinkIndex: kiloIface,
|
LinkIndex: kiloIface,
|
||||||
Protocol: unix.RTPROT_STATIC,
|
Protocol: unix.RTPROT_STATIC,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Dst: oneAddressCIDR(nodes["b"].InternalIP.IP),
|
Dst: oneAddressCIDR(nodes["b"].InternalIP.IP),
|
||||||
Flags: int(netlink.FLAG_ONLINK),
|
Flags: int(netlink.FLAG_ONLINK),
|
||||||
Gw: mustTopoForGranularityAndHost(NodeGranularity, nodes["a"].Name).segments[1].wireGuardIP,
|
Gw: mustTopoForGranularityAndHost(FullGranularity, nodes["a"].Name).segments[1].wireGuardIP,
|
||||||
LinkIndex: kiloIface,
|
LinkIndex: kiloIface,
|
||||||
Protocol: unix.RTPROT_STATIC,
|
Protocol: unix.RTPROT_STATIC,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Dst: mustTopoForGranularityAndHost(NodeGranularity, nodes["a"].Name).segments[2].cidrs[0],
|
Dst: mustTopoForGranularityAndHost(FullGranularity, nodes["a"].Name).segments[2].cidrs[0],
|
||||||
Flags: int(netlink.FLAG_ONLINK),
|
Flags: int(netlink.FLAG_ONLINK),
|
||||||
Gw: mustTopoForGranularityAndHost(NodeGranularity, nodes["a"].Name).segments[2].wireGuardIP,
|
Gw: mustTopoForGranularityAndHost(FullGranularity, nodes["a"].Name).segments[2].wireGuardIP,
|
||||||
LinkIndex: kiloIface,
|
LinkIndex: kiloIface,
|
||||||
Protocol: unix.RTPROT_STATIC,
|
Protocol: unix.RTPROT_STATIC,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Dst: oneAddressCIDR(nodes["c"].InternalIP.IP),
|
Dst: oneAddressCIDR(nodes["c"].InternalIP.IP),
|
||||||
Flags: int(netlink.FLAG_ONLINK),
|
Flags: int(netlink.FLAG_ONLINK),
|
||||||
Gw: mustTopoForGranularityAndHost(NodeGranularity, nodes["a"].Name).segments[2].wireGuardIP,
|
Gw: mustTopoForGranularityAndHost(FullGranularity, nodes["a"].Name).segments[2].wireGuardIP,
|
||||||
LinkIndex: kiloIface,
|
LinkIndex: kiloIface,
|
||||||
Protocol: unix.RTPROT_STATIC,
|
Protocol: unix.RTPROT_STATIC,
|
||||||
},
|
},
|
||||||
@ -575,34 +575,34 @@ func TestRoutes(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "node from b",
|
name: "full from b",
|
||||||
topology: mustTopoForGranularityAndHost(NodeGranularity, nodes["b"].Name),
|
topology: mustTopoForGranularityAndHost(FullGranularity, nodes["b"].Name),
|
||||||
result: []*netlink.Route{
|
result: []*netlink.Route{
|
||||||
{
|
{
|
||||||
Dst: mustTopoForGranularityAndHost(NodeGranularity, nodes["b"].Name).segments[0].cidrs[0],
|
Dst: mustTopoForGranularityAndHost(FullGranularity, nodes["b"].Name).segments[0].cidrs[0],
|
||||||
Flags: int(netlink.FLAG_ONLINK),
|
Flags: int(netlink.FLAG_ONLINK),
|
||||||
Gw: mustTopoForGranularityAndHost(NodeGranularity, nodes["b"].Name).segments[0].wireGuardIP,
|
Gw: mustTopoForGranularityAndHost(FullGranularity, nodes["b"].Name).segments[0].wireGuardIP,
|
||||||
LinkIndex: kiloIface,
|
LinkIndex: kiloIface,
|
||||||
Protocol: unix.RTPROT_STATIC,
|
Protocol: unix.RTPROT_STATIC,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Dst: oneAddressCIDR(nodes["a"].InternalIP.IP),
|
Dst: oneAddressCIDR(nodes["a"].InternalIP.IP),
|
||||||
Flags: int(netlink.FLAG_ONLINK),
|
Flags: int(netlink.FLAG_ONLINK),
|
||||||
Gw: mustTopoForGranularityAndHost(NodeGranularity, nodes["b"].Name).segments[0].wireGuardIP,
|
Gw: mustTopoForGranularityAndHost(FullGranularity, nodes["b"].Name).segments[0].wireGuardIP,
|
||||||
LinkIndex: kiloIface,
|
LinkIndex: kiloIface,
|
||||||
Protocol: unix.RTPROT_STATIC,
|
Protocol: unix.RTPROT_STATIC,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Dst: mustTopoForGranularityAndHost(NodeGranularity, nodes["b"].Name).segments[2].cidrs[0],
|
Dst: mustTopoForGranularityAndHost(FullGranularity, nodes["b"].Name).segments[2].cidrs[0],
|
||||||
Flags: int(netlink.FLAG_ONLINK),
|
Flags: int(netlink.FLAG_ONLINK),
|
||||||
Gw: mustTopoForGranularityAndHost(NodeGranularity, nodes["b"].Name).segments[2].wireGuardIP,
|
Gw: mustTopoForGranularityAndHost(FullGranularity, nodes["b"].Name).segments[2].wireGuardIP,
|
||||||
LinkIndex: kiloIface,
|
LinkIndex: kiloIface,
|
||||||
Protocol: unix.RTPROT_STATIC,
|
Protocol: unix.RTPROT_STATIC,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Dst: oneAddressCIDR(nodes["c"].InternalIP.IP),
|
Dst: oneAddressCIDR(nodes["c"].InternalIP.IP),
|
||||||
Flags: int(netlink.FLAG_ONLINK),
|
Flags: int(netlink.FLAG_ONLINK),
|
||||||
Gw: mustTopoForGranularityAndHost(NodeGranularity, nodes["b"].Name).segments[2].wireGuardIP,
|
Gw: mustTopoForGranularityAndHost(FullGranularity, nodes["b"].Name).segments[2].wireGuardIP,
|
||||||
LinkIndex: kiloIface,
|
LinkIndex: kiloIface,
|
||||||
Protocol: unix.RTPROT_STATIC,
|
Protocol: unix.RTPROT_STATIC,
|
||||||
},
|
},
|
||||||
@ -624,34 +624,34 @@ func TestRoutes(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "node from c",
|
name: "full from c",
|
||||||
topology: mustTopoForGranularityAndHost(NodeGranularity, nodes["c"].Name),
|
topology: mustTopoForGranularityAndHost(FullGranularity, nodes["c"].Name),
|
||||||
result: []*netlink.Route{
|
result: []*netlink.Route{
|
||||||
{
|
{
|
||||||
Dst: mustTopoForGranularityAndHost(NodeGranularity, nodes["c"].Name).segments[0].cidrs[0],
|
Dst: mustTopoForGranularityAndHost(FullGranularity, nodes["c"].Name).segments[0].cidrs[0],
|
||||||
Flags: int(netlink.FLAG_ONLINK),
|
Flags: int(netlink.FLAG_ONLINK),
|
||||||
Gw: mustTopoForGranularityAndHost(NodeGranularity, nodes["c"].Name).segments[0].wireGuardIP,
|
Gw: mustTopoForGranularityAndHost(FullGranularity, nodes["c"].Name).segments[0].wireGuardIP,
|
||||||
LinkIndex: kiloIface,
|
LinkIndex: kiloIface,
|
||||||
Protocol: unix.RTPROT_STATIC,
|
Protocol: unix.RTPROT_STATIC,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Dst: oneAddressCIDR(nodes["a"].InternalIP.IP),
|
Dst: oneAddressCIDR(nodes["a"].InternalIP.IP),
|
||||||
Flags: int(netlink.FLAG_ONLINK),
|
Flags: int(netlink.FLAG_ONLINK),
|
||||||
Gw: mustTopoForGranularityAndHost(NodeGranularity, nodes["c"].Name).segments[0].wireGuardIP,
|
Gw: mustTopoForGranularityAndHost(FullGranularity, nodes["c"].Name).segments[0].wireGuardIP,
|
||||||
LinkIndex: kiloIface,
|
LinkIndex: kiloIface,
|
||||||
Protocol: unix.RTPROT_STATIC,
|
Protocol: unix.RTPROT_STATIC,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Dst: mustTopoForGranularityAndHost(NodeGranularity, nodes["c"].Name).segments[1].cidrs[0],
|
Dst: mustTopoForGranularityAndHost(FullGranularity, nodes["c"].Name).segments[1].cidrs[0],
|
||||||
Flags: int(netlink.FLAG_ONLINK),
|
Flags: int(netlink.FLAG_ONLINK),
|
||||||
Gw: mustTopoForGranularityAndHost(NodeGranularity, nodes["c"].Name).segments[1].wireGuardIP,
|
Gw: mustTopoForGranularityAndHost(FullGranularity, nodes["c"].Name).segments[1].wireGuardIP,
|
||||||
LinkIndex: kiloIface,
|
LinkIndex: kiloIface,
|
||||||
Protocol: unix.RTPROT_STATIC,
|
Protocol: unix.RTPROT_STATIC,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Dst: oneAddressCIDR(nodes["b"].InternalIP.IP),
|
Dst: oneAddressCIDR(nodes["b"].InternalIP.IP),
|
||||||
Flags: int(netlink.FLAG_ONLINK),
|
Flags: int(netlink.FLAG_ONLINK),
|
||||||
Gw: mustTopoForGranularityAndHost(NodeGranularity, nodes["c"].Name).segments[1].wireGuardIP,
|
Gw: mustTopoForGranularityAndHost(FullGranularity, nodes["c"].Name).segments[1].wireGuardIP,
|
||||||
LinkIndex: kiloIface,
|
LinkIndex: kiloIface,
|
||||||
Protocol: unix.RTPROT_STATIC,
|
Protocol: unix.RTPROT_STATIC,
|
||||||
},
|
},
|
||||||
@ -673,35 +673,35 @@ func TestRoutes(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "datacenter from a local",
|
name: "logical from a local",
|
||||||
local: true,
|
local: true,
|
||||||
topology: mustTopoForGranularityAndHost(DataCenterGranularity, nodes["a"].Name),
|
topology: mustTopoForGranularityAndHost(LogicalGranularity, nodes["a"].Name),
|
||||||
result: []*netlink.Route{
|
result: []*netlink.Route{
|
||||||
{
|
{
|
||||||
Dst: nodes["b"].Subnet,
|
Dst: nodes["b"].Subnet,
|
||||||
Flags: int(netlink.FLAG_ONLINK),
|
Flags: int(netlink.FLAG_ONLINK),
|
||||||
Gw: mustTopoForGranularityAndHost(DataCenterGranularity, nodes["a"].Name).segments[1].wireGuardIP,
|
Gw: mustTopoForGranularityAndHost(LogicalGranularity, nodes["a"].Name).segments[1].wireGuardIP,
|
||||||
LinkIndex: kiloIface,
|
LinkIndex: kiloIface,
|
||||||
Protocol: unix.RTPROT_STATIC,
|
Protocol: unix.RTPROT_STATIC,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Dst: oneAddressCIDR(nodes["b"].InternalIP.IP),
|
Dst: oneAddressCIDR(nodes["b"].InternalIP.IP),
|
||||||
Flags: int(netlink.FLAG_ONLINK),
|
Flags: int(netlink.FLAG_ONLINK),
|
||||||
Gw: mustTopoForGranularityAndHost(DataCenterGranularity, nodes["a"].Name).segments[1].wireGuardIP,
|
Gw: mustTopoForGranularityAndHost(LogicalGranularity, nodes["a"].Name).segments[1].wireGuardIP,
|
||||||
LinkIndex: kiloIface,
|
LinkIndex: kiloIface,
|
||||||
Protocol: unix.RTPROT_STATIC,
|
Protocol: unix.RTPROT_STATIC,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Dst: nodes["c"].Subnet,
|
Dst: nodes["c"].Subnet,
|
||||||
Flags: int(netlink.FLAG_ONLINK),
|
Flags: int(netlink.FLAG_ONLINK),
|
||||||
Gw: mustTopoForGranularityAndHost(DataCenterGranularity, nodes["a"].Name).segments[1].wireGuardIP,
|
Gw: mustTopoForGranularityAndHost(LogicalGranularity, nodes["a"].Name).segments[1].wireGuardIP,
|
||||||
LinkIndex: kiloIface,
|
LinkIndex: kiloIface,
|
||||||
Protocol: unix.RTPROT_STATIC,
|
Protocol: unix.RTPROT_STATIC,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Dst: oneAddressCIDR(nodes["c"].InternalIP.IP),
|
Dst: oneAddressCIDR(nodes["c"].InternalIP.IP),
|
||||||
Flags: int(netlink.FLAG_ONLINK),
|
Flags: int(netlink.FLAG_ONLINK),
|
||||||
Gw: mustTopoForGranularityAndHost(DataCenterGranularity, nodes["a"].Name).segments[1].wireGuardIP,
|
Gw: mustTopoForGranularityAndHost(LogicalGranularity, nodes["a"].Name).segments[1].wireGuardIP,
|
||||||
LinkIndex: kiloIface,
|
LinkIndex: kiloIface,
|
||||||
Protocol: unix.RTPROT_STATIC,
|
Protocol: unix.RTPROT_STATIC,
|
||||||
},
|
},
|
||||||
@ -723,21 +723,21 @@ func TestRoutes(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "datacenter from b local",
|
name: "logical from b local",
|
||||||
local: true,
|
local: true,
|
||||||
topology: mustTopoForGranularityAndHost(DataCenterGranularity, nodes["b"].Name),
|
topology: mustTopoForGranularityAndHost(LogicalGranularity, nodes["b"].Name),
|
||||||
result: []*netlink.Route{
|
result: []*netlink.Route{
|
||||||
{
|
{
|
||||||
Dst: nodes["a"].Subnet,
|
Dst: nodes["a"].Subnet,
|
||||||
Flags: int(netlink.FLAG_ONLINK),
|
Flags: int(netlink.FLAG_ONLINK),
|
||||||
Gw: mustTopoForGranularityAndHost(DataCenterGranularity, nodes["b"].Name).segments[0].wireGuardIP,
|
Gw: mustTopoForGranularityAndHost(LogicalGranularity, nodes["b"].Name).segments[0].wireGuardIP,
|
||||||
LinkIndex: kiloIface,
|
LinkIndex: kiloIface,
|
||||||
Protocol: unix.RTPROT_STATIC,
|
Protocol: unix.RTPROT_STATIC,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Dst: oneAddressCIDR(nodes["a"].InternalIP.IP),
|
Dst: oneAddressCIDR(nodes["a"].InternalIP.IP),
|
||||||
Flags: int(netlink.FLAG_ONLINK),
|
Flags: int(netlink.FLAG_ONLINK),
|
||||||
Gw: mustTopoForGranularityAndHost(DataCenterGranularity, nodes["b"].Name).segments[0].wireGuardIP,
|
Gw: mustTopoForGranularityAndHost(LogicalGranularity, nodes["b"].Name).segments[0].wireGuardIP,
|
||||||
LinkIndex: kiloIface,
|
LinkIndex: kiloIface,
|
||||||
Protocol: unix.RTPROT_STATIC,
|
Protocol: unix.RTPROT_STATIC,
|
||||||
},
|
},
|
||||||
@ -766,12 +766,12 @@ func TestRoutes(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "datacenter from c local",
|
name: "logical from c local",
|
||||||
local: true,
|
local: true,
|
||||||
topology: mustTopoForGranularityAndHost(DataCenterGranularity, nodes["c"].Name),
|
topology: mustTopoForGranularityAndHost(LogicalGranularity, nodes["c"].Name),
|
||||||
result: []*netlink.Route{
|
result: []*netlink.Route{
|
||||||
{
|
{
|
||||||
Dst: oneAddressCIDR(mustTopoForGranularityAndHost(DataCenterGranularity, nodes["c"].Name).segments[0].wireGuardIP),
|
Dst: oneAddressCIDR(mustTopoForGranularityAndHost(LogicalGranularity, nodes["c"].Name).segments[0].wireGuardIP),
|
||||||
Flags: int(netlink.FLAG_ONLINK),
|
Flags: int(netlink.FLAG_ONLINK),
|
||||||
Gw: nodes["b"].InternalIP.IP,
|
Gw: nodes["b"].InternalIP.IP,
|
||||||
LinkIndex: privIface,
|
LinkIndex: privIface,
|
||||||
@ -792,7 +792,7 @@ func TestRoutes(t *testing.T) {
|
|||||||
Protocol: unix.RTPROT_STATIC,
|
Protocol: unix.RTPROT_STATIC,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Dst: oneAddressCIDR(mustTopoForGranularityAndHost(DataCenterGranularity, nodes["c"].Name).segments[1].wireGuardIP),
|
Dst: oneAddressCIDR(mustTopoForGranularityAndHost(LogicalGranularity, nodes["c"].Name).segments[1].wireGuardIP),
|
||||||
Flags: int(netlink.FLAG_ONLINK),
|
Flags: int(netlink.FLAG_ONLINK),
|
||||||
Gw: nodes["b"].InternalIP.IP,
|
Gw: nodes["b"].InternalIP.IP,
|
||||||
LinkIndex: privIface,
|
LinkIndex: privIface,
|
||||||
@ -829,35 +829,35 @@ func TestRoutes(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "node from a local",
|
name: "full from a local",
|
||||||
local: true,
|
local: true,
|
||||||
topology: mustTopoForGranularityAndHost(NodeGranularity, nodes["a"].Name),
|
topology: mustTopoForGranularityAndHost(FullGranularity, nodes["a"].Name),
|
||||||
result: []*netlink.Route{
|
result: []*netlink.Route{
|
||||||
{
|
{
|
||||||
Dst: nodes["b"].Subnet,
|
Dst: nodes["b"].Subnet,
|
||||||
Flags: int(netlink.FLAG_ONLINK),
|
Flags: int(netlink.FLAG_ONLINK),
|
||||||
Gw: mustTopoForGranularityAndHost(NodeGranularity, nodes["a"].Name).segments[1].wireGuardIP,
|
Gw: mustTopoForGranularityAndHost(FullGranularity, nodes["a"].Name).segments[1].wireGuardIP,
|
||||||
LinkIndex: kiloIface,
|
LinkIndex: kiloIface,
|
||||||
Protocol: unix.RTPROT_STATIC,
|
Protocol: unix.RTPROT_STATIC,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Dst: oneAddressCIDR(nodes["b"].InternalIP.IP),
|
Dst: oneAddressCIDR(nodes["b"].InternalIP.IP),
|
||||||
Flags: int(netlink.FLAG_ONLINK),
|
Flags: int(netlink.FLAG_ONLINK),
|
||||||
Gw: mustTopoForGranularityAndHost(NodeGranularity, nodes["a"].Name).segments[1].wireGuardIP,
|
Gw: mustTopoForGranularityAndHost(FullGranularity, nodes["a"].Name).segments[1].wireGuardIP,
|
||||||
LinkIndex: kiloIface,
|
LinkIndex: kiloIface,
|
||||||
Protocol: unix.RTPROT_STATIC,
|
Protocol: unix.RTPROT_STATIC,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Dst: nodes["c"].Subnet,
|
Dst: nodes["c"].Subnet,
|
||||||
Flags: int(netlink.FLAG_ONLINK),
|
Flags: int(netlink.FLAG_ONLINK),
|
||||||
Gw: mustTopoForGranularityAndHost(NodeGranularity, nodes["a"].Name).segments[2].wireGuardIP,
|
Gw: mustTopoForGranularityAndHost(FullGranularity, nodes["a"].Name).segments[2].wireGuardIP,
|
||||||
LinkIndex: kiloIface,
|
LinkIndex: kiloIface,
|
||||||
Protocol: unix.RTPROT_STATIC,
|
Protocol: unix.RTPROT_STATIC,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Dst: oneAddressCIDR(nodes["c"].InternalIP.IP),
|
Dst: oneAddressCIDR(nodes["c"].InternalIP.IP),
|
||||||
Flags: int(netlink.FLAG_ONLINK),
|
Flags: int(netlink.FLAG_ONLINK),
|
||||||
Gw: mustTopoForGranularityAndHost(NodeGranularity, nodes["a"].Name).segments[2].wireGuardIP,
|
Gw: mustTopoForGranularityAndHost(FullGranularity, nodes["a"].Name).segments[2].wireGuardIP,
|
||||||
LinkIndex: kiloIface,
|
LinkIndex: kiloIface,
|
||||||
Protocol: unix.RTPROT_STATIC,
|
Protocol: unix.RTPROT_STATIC,
|
||||||
},
|
},
|
||||||
@ -879,35 +879,35 @@ func TestRoutes(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "node from b local",
|
name: "full from b local",
|
||||||
local: true,
|
local: true,
|
||||||
topology: mustTopoForGranularityAndHost(NodeGranularity, nodes["b"].Name),
|
topology: mustTopoForGranularityAndHost(FullGranularity, nodes["b"].Name),
|
||||||
result: []*netlink.Route{
|
result: []*netlink.Route{
|
||||||
{
|
{
|
||||||
Dst: nodes["a"].Subnet,
|
Dst: nodes["a"].Subnet,
|
||||||
Flags: int(netlink.FLAG_ONLINK),
|
Flags: int(netlink.FLAG_ONLINK),
|
||||||
Gw: mustTopoForGranularityAndHost(NodeGranularity, nodes["b"].Name).segments[0].wireGuardIP,
|
Gw: mustTopoForGranularityAndHost(FullGranularity, nodes["b"].Name).segments[0].wireGuardIP,
|
||||||
LinkIndex: kiloIface,
|
LinkIndex: kiloIface,
|
||||||
Protocol: unix.RTPROT_STATIC,
|
Protocol: unix.RTPROT_STATIC,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Dst: oneAddressCIDR(nodes["a"].InternalIP.IP),
|
Dst: oneAddressCIDR(nodes["a"].InternalIP.IP),
|
||||||
Flags: int(netlink.FLAG_ONLINK),
|
Flags: int(netlink.FLAG_ONLINK),
|
||||||
Gw: mustTopoForGranularityAndHost(NodeGranularity, nodes["b"].Name).segments[0].wireGuardIP,
|
Gw: mustTopoForGranularityAndHost(FullGranularity, nodes["b"].Name).segments[0].wireGuardIP,
|
||||||
LinkIndex: kiloIface,
|
LinkIndex: kiloIface,
|
||||||
Protocol: unix.RTPROT_STATIC,
|
Protocol: unix.RTPROT_STATIC,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Dst: nodes["c"].Subnet,
|
Dst: nodes["c"].Subnet,
|
||||||
Flags: int(netlink.FLAG_ONLINK),
|
Flags: int(netlink.FLAG_ONLINK),
|
||||||
Gw: mustTopoForGranularityAndHost(NodeGranularity, nodes["b"].Name).segments[2].wireGuardIP,
|
Gw: mustTopoForGranularityAndHost(FullGranularity, nodes["b"].Name).segments[2].wireGuardIP,
|
||||||
LinkIndex: kiloIface,
|
LinkIndex: kiloIface,
|
||||||
Protocol: unix.RTPROT_STATIC,
|
Protocol: unix.RTPROT_STATIC,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Dst: oneAddressCIDR(nodes["c"].InternalIP.IP),
|
Dst: oneAddressCIDR(nodes["c"].InternalIP.IP),
|
||||||
Flags: int(netlink.FLAG_ONLINK),
|
Flags: int(netlink.FLAG_ONLINK),
|
||||||
Gw: mustTopoForGranularityAndHost(NodeGranularity, nodes["b"].Name).segments[2].wireGuardIP,
|
Gw: mustTopoForGranularityAndHost(FullGranularity, nodes["b"].Name).segments[2].wireGuardIP,
|
||||||
LinkIndex: kiloIface,
|
LinkIndex: kiloIface,
|
||||||
Protocol: unix.RTPROT_STATIC,
|
Protocol: unix.RTPROT_STATIC,
|
||||||
},
|
},
|
||||||
@ -929,35 +929,35 @@ func TestRoutes(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "node from c local",
|
name: "full from c local",
|
||||||
local: true,
|
local: true,
|
||||||
topology: mustTopoForGranularityAndHost(NodeGranularity, nodes["c"].Name),
|
topology: mustTopoForGranularityAndHost(FullGranularity, nodes["c"].Name),
|
||||||
result: []*netlink.Route{
|
result: []*netlink.Route{
|
||||||
{
|
{
|
||||||
Dst: nodes["a"].Subnet,
|
Dst: nodes["a"].Subnet,
|
||||||
Flags: int(netlink.FLAG_ONLINK),
|
Flags: int(netlink.FLAG_ONLINK),
|
||||||
Gw: mustTopoForGranularityAndHost(NodeGranularity, nodes["c"].Name).segments[0].wireGuardIP,
|
Gw: mustTopoForGranularityAndHost(FullGranularity, nodes["c"].Name).segments[0].wireGuardIP,
|
||||||
LinkIndex: kiloIface,
|
LinkIndex: kiloIface,
|
||||||
Protocol: unix.RTPROT_STATIC,
|
Protocol: unix.RTPROT_STATIC,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Dst: oneAddressCIDR(nodes["a"].InternalIP.IP),
|
Dst: oneAddressCIDR(nodes["a"].InternalIP.IP),
|
||||||
Flags: int(netlink.FLAG_ONLINK),
|
Flags: int(netlink.FLAG_ONLINK),
|
||||||
Gw: mustTopoForGranularityAndHost(NodeGranularity, nodes["c"].Name).segments[0].wireGuardIP,
|
Gw: mustTopoForGranularityAndHost(FullGranularity, nodes["c"].Name).segments[0].wireGuardIP,
|
||||||
LinkIndex: kiloIface,
|
LinkIndex: kiloIface,
|
||||||
Protocol: unix.RTPROT_STATIC,
|
Protocol: unix.RTPROT_STATIC,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Dst: nodes["b"].Subnet,
|
Dst: nodes["b"].Subnet,
|
||||||
Flags: int(netlink.FLAG_ONLINK),
|
Flags: int(netlink.FLAG_ONLINK),
|
||||||
Gw: mustTopoForGranularityAndHost(NodeGranularity, nodes["c"].Name).segments[1].wireGuardIP,
|
Gw: mustTopoForGranularityAndHost(FullGranularity, nodes["c"].Name).segments[1].wireGuardIP,
|
||||||
LinkIndex: kiloIface,
|
LinkIndex: kiloIface,
|
||||||
Protocol: unix.RTPROT_STATIC,
|
Protocol: unix.RTPROT_STATIC,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Dst: oneAddressCIDR(nodes["b"].InternalIP.IP),
|
Dst: oneAddressCIDR(nodes["b"].InternalIP.IP),
|
||||||
Flags: int(netlink.FLAG_ONLINK),
|
Flags: int(netlink.FLAG_ONLINK),
|
||||||
Gw: mustTopoForGranularityAndHost(NodeGranularity, nodes["c"].Name).segments[1].wireGuardIP,
|
Gw: mustTopoForGranularityAndHost(FullGranularity, nodes["c"].Name).segments[1].wireGuardIP,
|
||||||
LinkIndex: kiloIface,
|
LinkIndex: kiloIface,
|
||||||
Protocol: unix.RTPROT_STATIC,
|
Protocol: unix.RTPROT_STATIC,
|
||||||
},
|
},
|
||||||
@ -994,8 +994,8 @@ func TestConf(t *testing.T) {
|
|||||||
result string
|
result string
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "datacenter from a",
|
name: "logical from a",
|
||||||
topology: mustTopo(t, nodes, peers, DataCenterGranularity, nodes["a"].Name, port, key, kiloNet),
|
topology: mustTopo(t, nodes, peers, LogicalGranularity, nodes["a"].Name, port, key, kiloNet),
|
||||||
result: `[Interface]
|
result: `[Interface]
|
||||||
PrivateKey = private
|
PrivateKey = private
|
||||||
ListenPort = 51820
|
ListenPort = 51820
|
||||||
@ -1018,8 +1018,8 @@ AllowedIPs = 10.5.0.3/24
|
|||||||
`,
|
`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "datacenter from b",
|
name: "logical from b",
|
||||||
topology: mustTopo(t, nodes, peers, DataCenterGranularity, nodes["b"].Name, port, key, kiloNet),
|
topology: mustTopo(t, nodes, peers, LogicalGranularity, nodes["b"].Name, port, key, kiloNet),
|
||||||
result: `[Interface]
|
result: `[Interface]
|
||||||
PrivateKey = private
|
PrivateKey = private
|
||||||
ListenPort = 51820
|
ListenPort = 51820
|
||||||
@ -1042,8 +1042,8 @@ AllowedIPs = 10.5.0.3/24
|
|||||||
`,
|
`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "datacenter from c",
|
name: "logical from c",
|
||||||
topology: mustTopo(t, nodes, peers, DataCenterGranularity, nodes["c"].Name, port, key, kiloNet),
|
topology: mustTopo(t, nodes, peers, LogicalGranularity, nodes["c"].Name, port, key, kiloNet),
|
||||||
result: `[Interface]
|
result: `[Interface]
|
||||||
PrivateKey = private
|
PrivateKey = private
|
||||||
ListenPort = 51820
|
ListenPort = 51820
|
||||||
@ -1066,8 +1066,8 @@ AllowedIPs = 10.5.0.3/24
|
|||||||
`,
|
`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "node from a",
|
name: "full from a",
|
||||||
topology: mustTopo(t, nodes, peers, NodeGranularity, nodes["a"].Name, port, key, kiloNet),
|
topology: mustTopo(t, nodes, peers, FullGranularity, nodes["a"].Name, port, key, kiloNet),
|
||||||
result: `[Interface]
|
result: `[Interface]
|
||||||
PrivateKey = private
|
PrivateKey = private
|
||||||
ListenPort = 51820
|
ListenPort = 51820
|
||||||
@ -1095,8 +1095,8 @@ AllowedIPs = 10.5.0.3/24
|
|||||||
`,
|
`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "node from b",
|
name: "full from b",
|
||||||
topology: mustTopo(t, nodes, peers, NodeGranularity, nodes["b"].Name, port, key, kiloNet),
|
topology: mustTopo(t, nodes, peers, FullGranularity, nodes["b"].Name, port, key, kiloNet),
|
||||||
result: `[Interface]
|
result: `[Interface]
|
||||||
PrivateKey = private
|
PrivateKey = private
|
||||||
ListenPort = 51820
|
ListenPort = 51820
|
||||||
@ -1124,8 +1124,8 @@ AllowedIPs = 10.5.0.3/24
|
|||||||
`,
|
`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "node from c",
|
name: "full from c",
|
||||||
topology: mustTopo(t, nodes, peers, NodeGranularity, nodes["c"].Name, port, key, kiloNet),
|
topology: mustTopo(t, nodes, peers, FullGranularity, nodes["c"].Name, port, key, kiloNet),
|
||||||
result: `[Interface]
|
result: `[Interface]
|
||||||
PrivateKey = private
|
PrivateKey = private
|
||||||
ListenPort = 51820
|
ListenPort = 51820
|
||||||
|
Loading…
Reference in New Issue
Block a user