cmd/cloner: use maps.Clone and ptr.To

Updates #cleanup

Signed-off-by: Maisem Ali <maisem@tailscale.com>
This commit is contained in:
Maisem Ali
2023-08-20 13:16:06 -04:00
committed by Maisem Ali
parent 4511e7d64e
commit 8a5ec72c85
8 changed files with 45 additions and 96 deletions

View File

@@ -11,6 +11,7 @@ import (
"tailscale.com/tailcfg"
"tailscale.com/types/key"
"tailscale.com/types/logid"
"tailscale.com/types/ptr"
)
// Clone makes a deep copy of Config.
@@ -55,8 +56,7 @@ func (src *Peer) Clone() *Peer {
*dst = *src
dst.AllowedIPs = append(src.AllowedIPs[:0:0], src.AllowedIPs...)
if dst.V4MasqAddr != nil {
dst.V4MasqAddr = new(netip.Addr)
*dst.V4MasqAddr = *src.V4MasqAddr
dst.V4MasqAddr = ptr.To(*src.V4MasqAddr)
}
return dst
}