TUN-7700: Implement feature selector to determine if connections will prefer post quantum cryptography

This commit is contained in:
Chung-Ting Huang
2023-08-25 14:39:25 +01:00
parent 38d3c3cae5
commit bec683b67d
8 changed files with 385 additions and 43 deletions

View File

@@ -28,3 +28,22 @@ func Contains(feature string) bool {
}
return false
}
// Remove any duplicates from the slice
func Dedup(slice []string) []string {
// Convert the slice into a set
set := make(map[string]bool, 0)
for _, str := range slice {
set[str] = true
}
// Convert the set back into a slice
keys := make([]string, len(set))
i := 0
for str := range set {
keys[i] = str
i++
}
return keys
}