mirror of
https://github.com/gravitl/netmaker.git
synced 2024-11-11 01:54:34 +08:00
allowed addition of manually added allowed ips
This commit is contained in:
parent
c87e39aa61
commit
14cee3a96d
1 changed files with 10 additions and 0 deletions
|
@ -208,6 +208,16 @@ func GetPeers(macaddress string, network string, server string, dualstack bool,
|
||||||
}
|
}
|
||||||
var allowedips []net.IPNet
|
var allowedips []net.IPNet
|
||||||
allowedips = append(allowedips, peeraddr)
|
allowedips = append(allowedips, peeraddr)
|
||||||
|
// handle manually set peers
|
||||||
|
for _, allowedIp := range node.AllowedIPs {
|
||||||
|
if _, ipnet, err := net.ParseCIDR(allowedIp); err == nil {
|
||||||
|
nodeEndpointArr := strings.Split(node.Endpoint, ":")
|
||||||
|
if !ipnet.Contains(net.IP(nodeEndpointArr[0])) { // don't need to add an allowed ip that already exists..
|
||||||
|
allowedips = append(allowedips, *ipnet)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// handle egress gateway peers
|
||||||
if node.IsEgressGateway == "yes" {
|
if node.IsEgressGateway == "yes" {
|
||||||
hasGateway = true
|
hasGateway = true
|
||||||
ranges := node.EgressGatewayRanges
|
ranges := node.EgressGatewayRanges
|
||||||
|
|
Loading…
Reference in a new issue