mirror of
https://github.com/juanfont/headscale.git
synced 2026-03-31 14:33:42 +02:00
reflect.DeepEqual is a value copy that causes golang to continuously allocate memory
This commit is contained in:
10
utils.go
10
utils.go
@@ -269,6 +269,16 @@ func stringToIPPrefix(prefixes []string) ([]netip.Prefix, error) {
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func containsStr(ts []string, t string) bool {
|
||||
for _, v := range ts {
|
||||
if v == t {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
func contains[T string | netip.Prefix](ts []T, t T) bool {
|
||||
for _, v := range ts {
|
||||
if reflect.DeepEqual(v, t) {
|
||||
|
||||
Reference in New Issue
Block a user