mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-16 13:51:42 +08:00
send peer update for extclient extraAllowedIps update
This commit is contained in:
@@ -481,6 +481,9 @@ func updateExtClient(w http.ResponseWriter, r *http.Request) {
|
|||||||
sendPeerUpdate = true
|
sendPeerUpdate = true
|
||||||
logic.SetClientACLs(&oldExtClient, update.DeniedACLs)
|
logic.SetClientACLs(&oldExtClient, update.DeniedACLs)
|
||||||
}
|
}
|
||||||
|
if !logic.IsSlicesEqual(update.ExtraAllowedIPs, oldExtClient.ExtraAllowedIPs) {
|
||||||
|
sendPeerUpdate = true
|
||||||
|
}
|
||||||
|
|
||||||
if update.Enabled != oldExtClient.Enabled {
|
if update.Enabled != oldExtClient.Enabled {
|
||||||
sendPeerUpdate = true
|
sendPeerUpdate = true
|
||||||
|
@@ -134,4 +134,18 @@ func RemoveStringSlice(slice []string, i int) []string {
|
|||||||
return append(slice[:i], slice[i+1:]...)
|
return append(slice[:i], slice[i+1:]...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IsSlicesEqual tells whether a and b contain the same elements.
|
||||||
|
// A nil argument is equivalent to an empty slice.
|
||||||
|
func IsSlicesEqual(a, b []string) bool {
|
||||||
|
if len(a) != len(b) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
for i, v := range a {
|
||||||
|
if v != b[i] {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
// == private ==
|
// == private ==
|
||||||
|
Reference in New Issue
Block a user