From dea7b9c6177533dc76854bf3b6db791ea2ab6a6e Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Mon, 17 Mar 2025 09:32:45 +0100 Subject: [PATCH] use slices clone Signed-off-by: Kristoffer Dalby --- hscontrol/mapper/tail.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hscontrol/mapper/tail.go b/hscontrol/mapper/tail.go index 9e3ff4cf..c8c61825 100644 --- a/hscontrol/mapper/tail.go +++ b/hscontrol/mapper/tail.go @@ -5,6 +5,8 @@ import ( "net/netip" "time" + "slices" + "github.com/juanfont/headscale/hscontrol/policy" "github.com/juanfont/headscale/hscontrol/routes" "github.com/juanfont/headscale/hscontrol/types" @@ -49,9 +51,8 @@ func tailNode( ) (*tailcfg.Node, error) { addrs := node.Prefixes() - allowedIPs := append( - []netip.Prefix{}, - addrs...) // we append the node own IP, as it is required by the clients + // we append the node own IP, as it is required by the clients + allowedIPs := slices.Clone(node.Prefixes()) for _, route := range node.SubnetRoutes() { allowedIPs = append(allowedIPs, netip.Prefix(route))