diff --git a/hscontrol/policy/matcher/matcher.go b/hscontrol/policy/matcher/matcher.go index ef29b171..ec07d19c 100644 --- a/hscontrol/policy/matcher/matcher.go +++ b/hscontrol/policy/matcher/matcher.go @@ -68,21 +68,9 @@ func (m *Match) DestsContainsIP(ips ...netip.Addr) bool { } func (m *Match) SrcsOverlapsPrefixes(prefixes ...netip.Prefix) bool { - for _, prefix := range prefixes { - if m.srcs.ContainsPrefix(prefix) { - return true - } - } - - return false + return slices.ContainsFunc(prefixes, m.srcs.OverlapsPrefix) } func (m *Match) DestsOverlapsPrefixes(prefixes ...netip.Prefix) bool { - for _, prefix := range prefixes { - if m.dests.ContainsPrefix(prefix) { - return true - } - } - - return false + return slices.ContainsFunc(prefixes, m.dests.OverlapsPrefix) }