mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-05 16:57:51 +08:00
initial commit
This commit is contained in:
@@ -203,3 +203,18 @@ func getNetworkProtocols(cidrs []string) (bool, bool) {
|
||||
}
|
||||
return ipv4, ipv6
|
||||
}
|
||||
|
||||
// StringDifference - returns the elements in `a` that aren't in `b`.
|
||||
func StringDifference(a, b []string) []string {
|
||||
mb := make(map[string]struct{}, len(b))
|
||||
for _, x := range b {
|
||||
mb[x] = struct{}{}
|
||||
}
|
||||
var diff []string
|
||||
for _, x := range a {
|
||||
if _, found := mb[x]; !found {
|
||||
diff = append(diff, x)
|
||||
}
|
||||
}
|
||||
return diff
|
||||
}
|
||||
|
Reference in New Issue
Block a user