@ -74,10 +74,12 @@ func (src *Node) Clone() *Node {
if dst . SelfNodeV6MasqAddrForThisPeer != nil {
dst . SelfNodeV6MasqAddrForThisPeer = ptr . To ( * src . SelfNodeV6MasqAddrForThisPeer )
}
dst . ExitNodeDNSResolvers = append ( [ ] * dnstype . Resolver ( nil ) , make ( [ ] * dnstype . Resolver , len ( src . ExitNodeDNSResolvers ) ) ... )
if src . ExitNodeDNSResolvers != nil {
dst . ExitNodeDNSResolvers = make ( [ ] * dnstype . Resolver , len ( src . ExitNodeDNSResolvers ) )
for i := range dst . ExitNodeDNSResolvers {
dst . ExitNodeDNSResolvers [ i ] = src . ExitNodeDNSResolvers [ i ] . Clone ( )
}
}
return dst
}
@ -235,20 +237,24 @@ func (src *DNSConfig) Clone() *DNSConfig {
}
dst := new ( DNSConfig )
* dst = * src
dst . Resolvers = append ( [ ] * dnstype . Resolver ( nil ) , make ( [ ] * dnstype . Resolver , len ( src . Resolvers ) ) ... )
if src . Resolvers != nil {
dst . Resolvers = make ( [ ] * dnstype . Resolver , len ( src . Resolvers ) )
for i := range dst . Resolvers {
dst . Resolvers [ i ] = src . Resolvers [ i ] . Clone ( )
}
}
if dst . Routes != nil {
dst . Routes = map [ string ] [ ] * dnstype . Resolver { }
for k := range src . Routes {
dst . Routes [ k ] = append ( [ ] * dnstype . Resolver { } , src . Routes [ k ] ... )
}
}
dst . FallbackResolvers = append ( [ ] * dnstype . Resolver ( nil ) , make ( [ ] * dnstype . Resolver , len ( src . FallbackResolvers ) ) ... )
if src . FallbackResolvers != nil {
dst . FallbackResolvers = make ( [ ] * dnstype . Resolver , len ( src . FallbackResolvers ) )
for i := range dst . FallbackResolvers {
dst . FallbackResolvers [ i ] = src . FallbackResolvers [ i ] . Clone ( )
}
}
dst . Domains = append ( src . Domains [ : 0 : 0 ] , src . Domains ... )
dst . Nameservers = append ( src . Nameservers [ : 0 : 0 ] , src . Nameservers ... )
dst . CertDomains = append ( src . CertDomains [ : 0 : 0 ] , src . CertDomains ... )
@ -381,10 +387,12 @@ func (src *DERPRegion) Clone() *DERPRegion {
}
dst := new ( DERPRegion )
* dst = * src
dst . Nodes = append ( [ ] * DERPNode ( nil ) , make ( [ ] * DERPNode , len ( src . Nodes ) ) ... )
if src . Nodes != nil {
dst . Nodes = make ( [ ] * DERPNode , len ( src . Nodes ) )
for i := range dst . Nodes {
dst . Nodes [ i ] = src . Nodes [ i ] . Clone ( )
}
}
return dst
}
@ -460,10 +468,12 @@ func (src *SSHRule) Clone() *SSHRule {
if dst . RuleExpires != nil {
dst . RuleExpires = ptr . To ( * src . RuleExpires )
}
dst . Principals = append ( [ ] * SSHPrincipal ( nil ) , make ( [ ] * SSHPrincipal , len ( src . Principals ) ) ... )
if src . Principals != nil {
dst . Principals = make ( [ ] * SSHPrincipal , len ( src . Principals ) )
for i := range dst . Principals {
dst . Principals [ i ] = src . Principals [ i ] . Clone ( )
}
}
dst . SSHUsers = maps . Clone ( src . SSHUsers )
dst . Action = src . Action . Clone ( )
return dst