adding logs to egress on netclient

This commit is contained in:
afeiszli 2021-09-22 09:36:12 -04:00
parent ce100f6dbc
commit 05f8c7435b

View file

@ -211,11 +211,13 @@ func GetPeers(macaddress string, network string, server string, dualstack bool,
for _, iprange := range ranges { // go through each cidr for egress gateway
_, ipnet, err := net.ParseCIDR(iprange) // confirming it's valid cidr
if err != nil {
ncutils.PrintLog("could not parse gateway IP range. Not adding "+iprange,1)
continue // if can't parse CIDR
}
nodeEndpointArr := strings.Split(node.Endpoint, ":") // getting the public ip of node
if ipnet.Contains(net.IP(nodeEndpointArr[0])) { // ensuring egress gateway range does not contain public ip of node
continue // skip adding egress range if overlaps with nodes ip
ncutils.PrintLog("egress IP range of "+iprange+" overlaps with "+node.Endpoint+", omitting",1)
continue // skip adding egress range if overlaps with node's ip
}
gateways = append(gateways, iprange)
if err != nil {