|
|
|
@ -74,11 +74,9 @@ func (src *Node) Clone() *Node {
|
|
|
|
|
if dst.SelfNodeV6MasqAddrForThisPeer != nil {
|
|
|
|
|
dst.SelfNodeV6MasqAddrForThisPeer = ptr.To(*src.SelfNodeV6MasqAddrForThisPeer)
|
|
|
|
|
}
|
|
|
|
|
if src.ExitNodeDNSResolvers != nil {
|
|
|
|
|
dst.ExitNodeDNSResolvers = make([]*dnstype.Resolver, len(src.ExitNodeDNSResolvers))
|
|
|
|
|
for i := range dst.ExitNodeDNSResolvers {
|
|
|
|
|
dst.ExitNodeDNSResolvers[i] = src.ExitNodeDNSResolvers[i].Clone()
|
|
|
|
|
}
|
|
|
|
|
dst.ExitNodeDNSResolvers = append([]*dnstype.Resolver(nil), make([]*dnstype.Resolver, len(src.ExitNodeDNSResolvers))...)
|
|
|
|
|
for i := range dst.ExitNodeDNSResolvers {
|
|
|
|
|
dst.ExitNodeDNSResolvers[i] = src.ExitNodeDNSResolvers[i].Clone()
|
|
|
|
|
}
|
|
|
|
|
return dst
|
|
|
|
|
}
|
|
|
|
@ -237,11 +235,9 @@ func (src *DNSConfig) Clone() *DNSConfig {
|
|
|
|
|
}
|
|
|
|
|
dst := new(DNSConfig)
|
|
|
|
|
*dst = *src
|
|
|
|
|
if src.Resolvers != nil {
|
|
|
|
|
dst.Resolvers = make([]*dnstype.Resolver, len(src.Resolvers))
|
|
|
|
|
for i := range dst.Resolvers {
|
|
|
|
|
dst.Resolvers[i] = src.Resolvers[i].Clone()
|
|
|
|
|
}
|
|
|
|
|
dst.Resolvers = append([]*dnstype.Resolver(nil), 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{}
|
|
|
|
@ -249,11 +245,9 @@ func (src *DNSConfig) Clone() *DNSConfig {
|
|
|
|
|
dst.Routes[k] = append([]*dnstype.Resolver{}, src.Routes[k]...)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
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.FallbackResolvers = append([]*dnstype.Resolver(nil), 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...)
|
|
|
|
@ -387,11 +381,9 @@ func (src *DERPRegion) Clone() *DERPRegion {
|
|
|
|
|
}
|
|
|
|
|
dst := new(DERPRegion)
|
|
|
|
|
*dst = *src
|
|
|
|
|
if src.Nodes != nil {
|
|
|
|
|
dst.Nodes = make([]*DERPNode, len(src.Nodes))
|
|
|
|
|
for i := range dst.Nodes {
|
|
|
|
|
dst.Nodes[i] = src.Nodes[i].Clone()
|
|
|
|
|
}
|
|
|
|
|
dst.Nodes = append([]*DERPNode(nil), make([]*DERPNode, len(src.Nodes))...)
|
|
|
|
|
for i := range dst.Nodes {
|
|
|
|
|
dst.Nodes[i] = src.Nodes[i].Clone()
|
|
|
|
|
}
|
|
|
|
|
return dst
|
|
|
|
|
}
|
|
|
|
@ -468,11 +460,9 @@ func (src *SSHRule) Clone() *SSHRule {
|
|
|
|
|
if dst.RuleExpires != nil {
|
|
|
|
|
dst.RuleExpires = ptr.To(*src.RuleExpires)
|
|
|
|
|
}
|
|
|
|
|
if src.Principals != nil {
|
|
|
|
|
dst.Principals = make([]*SSHPrincipal, len(src.Principals))
|
|
|
|
|
for i := range dst.Principals {
|
|
|
|
|
dst.Principals[i] = src.Principals[i].Clone()
|
|
|
|
|
}
|
|
|
|
|
dst.Principals = append([]*SSHPrincipal(nil), 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()
|
|
|
|
|