mirror of
https://github.com/gravitl/netmaker.git
synced 2025-02-25 16:44:01 +08:00
adding logs to egress on netclient
This commit is contained in:
parent
ce100f6dbc
commit
05f8c7435b
1 changed files with 3 additions and 1 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue