From 399e832ca1902e15b0d591f8b2517a0dfcd7c3c6 Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Sun, 4 May 2025 15:57:51 +0200 Subject: [PATCH] types/node: slice.ContainsFunc Signed-off-by: Kristoffer Dalby --- hscontrol/types/node.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/hscontrol/types/node.go b/hscontrol/types/node.go index 572e38b7..2749237e 100644 --- a/hscontrol/types/node.go +++ b/hscontrol/types/node.go @@ -239,10 +239,8 @@ func (node *Node) Prefixes() []netip.Prefix { // node has any exit routes enabled. // If none are enabled, it will return nil. func (node *Node) ExitRoutes() []netip.Prefix { - for _, route := range node.SubnetRoutes() { - if tsaddr.IsExitRoute(route) { - return tsaddr.ExitRoutes() - } + if slices.ContainsFunc(node.SubnetRoutes(), tsaddr.IsExitRoute) { + return tsaddr.ExitRoutes() } return nil