recommended fixes [1 of 2]
This commit is contained in:
parent
c2382d29a1
commit
de2ca33700
4 changed files with 36 additions and 31 deletions
|
@ -7,6 +7,7 @@ import (
|
|||
"fmt"
|
||||
"io"
|
||||
"math/rand"
|
||||
"net/netip"
|
||||
"os"
|
||||
"regexp"
|
||||
"strconv"
|
||||
|
@ -46,8 +47,8 @@ func Contains[T comparable](haystack []T, needle T) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
// ContainsContains returns true if any element of haystack .Contains(needle).
|
||||
func ContainsContains[T interface{ Contains(U) bool }, U any](haystack []T, needle U) bool {
|
||||
// ContainsIP returns true if any one of the of prefixes contains the ip.
|
||||
func ContainsIP(haystack []netip.Prefix, needle netip.Addr) bool {
|
||||
for _, s := range haystack {
|
||||
if s.Contains(needle) {
|
||||
return true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue