Browse Source

testing additional check on publickey

afeiszli 3 years ago
parent
commit
7df19ffba3
1 changed files with 4 additions and 0 deletions
  1. 4 0
      netclient/wireguard/common.go

+ 4 - 0
netclient/wireguard/common.go

@@ -94,6 +94,10 @@ func SetPeers(iface, currentNodeAddr string, keepalive int32, peers []wgtypes.Pe
 			if peer.AllowedIPs[0].String() == currentPeer.AllowedIPs[0].String() {
 			if peer.AllowedIPs[0].String() == currentPeer.AllowedIPs[0].String() {
 				shouldDelete = false
 				shouldDelete = false
 			}
 			}
+			// re-check this if logic is not working, added in case of allowedips not working
+			if peer.PublicKey.String() == currentPeer.PublicKey.String() {
+				shouldDelete = false
+			}
 		}
 		}
 		if shouldDelete {
 		if shouldDelete {
 			output, err := ncutils.RunCmd("wg set "+iface+" peer "+currentPeer.PublicKey.String()+" remove", true)
 			output, err := ncutils.RunCmd("wg set "+iface+" peer "+currentPeer.PublicKey.String()+" remove", true)