From 95cddfcc75ed36d9c47fe91b7099faa131bdd7c5 Mon Sep 17 00:00:00 2001 From: David Crawshaw Date: Fri, 4 Sep 2020 07:41:30 -0400 Subject: [PATCH] tailcfg: add Clone methods to Login and DNSConfig Signed-off-by: David Crawshaw --- tailcfg/tailcfg.go | 2 +- tailcfg/tailcfg_clone.go | 26 +++++++++++++++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/tailcfg/tailcfg.go b/tailcfg/tailcfg.go index 8bab4b210..7ecf890e5 100644 --- a/tailcfg/tailcfg.go +++ b/tailcfg/tailcfg.go @@ -4,7 +4,7 @@ package tailcfg -//go:generate go run tailscale.com/cmd/cloner -type=User,Node,Hostinfo,NetInfo,Group,Role,Capability -output=tailcfg_clone.go +//go:generate go run tailscale.com/cmd/cloner -type=User,Node,Hostinfo,NetInfo,Group,Role,Capability,Login,DNSConfig -output=tailcfg_clone.go import ( "bytes" diff --git a/tailcfg/tailcfg_clone.go b/tailcfg/tailcfg_clone.go index 7ef9fea86..513b9890a 100644 --- a/tailcfg/tailcfg_clone.go +++ b/tailcfg/tailcfg_clone.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// Code generated by tailscale.com/cmd/cloner -type User,Node,Hostinfo,NetInfo,Group,Role,Capability; DO NOT EDIT. +// Code generated by tailscale.com/cmd/cloner -type User,Node,Hostinfo,NetInfo,Group,Role,Capability,Login,DNSConfig; DO NOT EDIT. package tailcfg @@ -108,3 +108,27 @@ func (src *Capability) Clone() *Capability { *dst = *src return dst } + +// Clone makes a deep copy of Login. +// The result aliases no memory with the original. +func (src *Login) Clone() *Login { + if src == nil { + return nil + } + dst := new(Login) + *dst = *src + return dst +} + +// Clone makes a deep copy of DNSConfig. +// The result aliases no memory with the original. +func (src *DNSConfig) Clone() *DNSConfig { + if src == nil { + return nil + } + dst := new(DNSConfig) + *dst = *src + dst.Nameservers = append(src.Nameservers[:0:0], src.Nameservers...) + dst.Domains = append(src.Domains[:0:0], src.Domains...) + return dst +}