2022-05-02 00:15:14 +01:00
|
|
|
// Copyright (c) 2022 Tailscale Inc & AUTHORS All rights reserved.
|
2020-07-24 08:59:49 +01:00
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
2022-05-02 00:24:54 +01:00
|
|
|
// Code generated by tailscale.com/cmd/cloner; DO NOT EDIT.
|
2020-07-24 08:59:49 +01:00
|
|
|
|
|
|
|
package tailcfg
|
|
|
|
|
|
|
|
import (
|
2022-07-25 04:08:42 +01:00
|
|
|
"net/netip"
|
2022-04-29 21:30:54 +01:00
|
|
|
"time"
|
|
|
|
|
2021-08-05 22:05:24 +01:00
|
|
|
"tailscale.com/types/dnstype"
|
2021-09-03 21:17:46 +01:00
|
|
|
"tailscale.com/types/key"
|
2020-09-04 23:19:54 +01:00
|
|
|
"tailscale.com/types/opt"
|
|
|
|
"tailscale.com/types/structs"
|
2022-08-12 20:34:25 +01:00
|
|
|
"tailscale.com/types/tkatype"
|
2020-07-24 08:59:49 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
// Clone makes a deep copy of User.
|
|
|
|
// The result aliases no memory with the original.
|
|
|
|
func (src *User) Clone() *User {
|
|
|
|
if src == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
dst := new(User)
|
|
|
|
*dst = *src
|
2020-07-27 18:40:34 +01:00
|
|
|
dst.Logins = append(src.Logins[:0:0], src.Logins...)
|
2020-07-24 08:59:49 +01:00
|
|
|
return dst
|
|
|
|
}
|
|
|
|
|
2021-09-15 18:05:34 +01:00
|
|
|
// A compilation failure here means this code must be regenerated, with the command at the top of this file.
|
2021-09-16 23:58:43 +01:00
|
|
|
var _UserCloneNeedsRegeneration = User(struct {
|
2020-09-04 23:19:54 +01:00
|
|
|
ID UserID
|
|
|
|
LoginName string
|
|
|
|
DisplayName string
|
|
|
|
ProfilePicURL string
|
|
|
|
Domain string
|
|
|
|
Logins []LoginID
|
|
|
|
Created time.Time
|
|
|
|
}{})
|
|
|
|
|
2020-07-24 08:59:49 +01:00
|
|
|
// Clone makes a deep copy of Node.
|
|
|
|
// The result aliases no memory with the original.
|
|
|
|
func (src *Node) Clone() *Node {
|
|
|
|
if src == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
dst := new(Node)
|
|
|
|
*dst = *src
|
2022-08-12 20:34:25 +01:00
|
|
|
dst.KeySignature = append(src.KeySignature[:0:0], src.KeySignature...)
|
2020-07-27 18:40:34 +01:00
|
|
|
dst.Addresses = append(src.Addresses[:0:0], src.Addresses...)
|
|
|
|
dst.AllowedIPs = append(src.AllowedIPs[:0:0], src.AllowedIPs...)
|
|
|
|
dst.Endpoints = append(src.Endpoints[:0:0], src.Endpoints...)
|
2022-02-15 16:19:44 +00:00
|
|
|
dst.Hostinfo = src.Hostinfo
|
2021-10-20 22:26:31 +01:00
|
|
|
dst.Tags = append(src.Tags[:0:0], src.Tags...)
|
2021-07-27 16:01:29 +01:00
|
|
|
dst.PrimaryRoutes = append(src.PrimaryRoutes[:0:0], src.PrimaryRoutes...)
|
2020-07-24 08:59:49 +01:00
|
|
|
if dst.LastSeen != nil {
|
|
|
|
dst.LastSeen = new(time.Time)
|
|
|
|
*dst.LastSeen = *src.LastSeen
|
|
|
|
}
|
2021-04-16 00:03:59 +01:00
|
|
|
if dst.Online != nil {
|
|
|
|
dst.Online = new(bool)
|
|
|
|
*dst.Online = *src.Online
|
|
|
|
}
|
2021-04-01 22:03:34 +01:00
|
|
|
dst.Capabilities = append(src.Capabilities[:0:0], src.Capabilities...)
|
2020-07-24 08:59:49 +01:00
|
|
|
return dst
|
|
|
|
}
|
|
|
|
|
2021-09-15 18:05:34 +01:00
|
|
|
// A compilation failure here means this code must be regenerated, with the command at the top of this file.
|
2021-09-16 23:58:43 +01:00
|
|
|
var _NodeCloneNeedsRegeneration = Node(struct {
|
2021-01-27 16:50:31 +00:00
|
|
|
ID NodeID
|
|
|
|
StableID StableNodeID
|
|
|
|
Name string
|
|
|
|
User UserID
|
|
|
|
Sharer UserID
|
2021-11-02 03:55:52 +00:00
|
|
|
Key key.NodePublic
|
2021-01-27 16:50:31 +00:00
|
|
|
KeyExpiry time.Time
|
2022-08-12 20:34:25 +01:00
|
|
|
KeySignature tkatype.MarshaledSignature
|
2021-09-03 21:17:46 +01:00
|
|
|
Machine key.MachinePublic
|
2021-11-02 21:41:56 +00:00
|
|
|
DiscoKey key.DiscoPublic
|
2022-07-25 04:08:42 +01:00
|
|
|
Addresses []netip.Prefix
|
|
|
|
AllowedIPs []netip.Prefix
|
2021-01-27 16:50:31 +00:00
|
|
|
Endpoints []string
|
|
|
|
DERP string
|
2022-02-15 16:19:44 +00:00
|
|
|
Hostinfo HostinfoView
|
2021-01-27 16:50:31 +00:00
|
|
|
Created time.Time
|
2021-10-20 22:26:31 +01:00
|
|
|
Tags []string
|
2022-07-25 04:08:42 +01:00
|
|
|
PrimaryRoutes []netip.Prefix
|
2021-01-27 16:50:31 +00:00
|
|
|
LastSeen *time.Time
|
2021-04-16 00:03:59 +01:00
|
|
|
Online *bool
|
2021-01-27 16:50:31 +00:00
|
|
|
KeepAlive bool
|
|
|
|
MachineAuthorized bool
|
2021-04-01 22:03:34 +01:00
|
|
|
Capabilities []string
|
2022-11-02 20:13:26 +00:00
|
|
|
UnsignedPeerAPIOnly bool
|
2021-01-27 16:50:31 +00:00
|
|
|
ComputedName string
|
|
|
|
computedHostIfDifferent string
|
|
|
|
ComputedNameWithHost string
|
2022-09-22 20:49:24 +01:00
|
|
|
DataPlaneAuditLogID string
|
2020-09-04 23:19:54 +01:00
|
|
|
}{})
|
|
|
|
|
2020-07-27 18:40:34 +01:00
|
|
|
// Clone makes a deep copy of Hostinfo.
|
|
|
|
// The result aliases no memory with the original.
|
|
|
|
func (src *Hostinfo) Clone() *Hostinfo {
|
|
|
|
if src == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
dst := new(Hostinfo)
|
|
|
|
*dst = *src
|
|
|
|
dst.RoutableIPs = append(src.RoutableIPs[:0:0], src.RoutableIPs...)
|
|
|
|
dst.RequestTags = append(src.RequestTags[:0:0], src.RequestTags...)
|
|
|
|
dst.Services = append(src.Services[:0:0], src.Services...)
|
|
|
|
dst.NetInfo = src.NetInfo.Clone()
|
2022-02-17 23:00:41 +00:00
|
|
|
dst.SSH_HostKeys = append(src.SSH_HostKeys[:0:0], src.SSH_HostKeys...)
|
2020-07-27 18:40:34 +01:00
|
|
|
return dst
|
|
|
|
}
|
|
|
|
|
2021-09-15 18:05:34 +01:00
|
|
|
// A compilation failure here means this code must be regenerated, with the command at the top of this file.
|
2021-09-16 23:58:43 +01:00
|
|
|
var _HostinfoCloneNeedsRegeneration = Hostinfo(struct {
|
2022-08-30 20:30:55 +01:00
|
|
|
IPNVersion string
|
|
|
|
FrontendLogID string
|
|
|
|
BackendLogID string
|
|
|
|
OS string
|
|
|
|
OSVersion string
|
2022-09-11 18:57:18 +01:00
|
|
|
Container opt.Bool
|
|
|
|
Env string
|
|
|
|
Distro string
|
|
|
|
DistroVersion string
|
|
|
|
DistroCodeName string
|
2022-08-30 20:30:55 +01:00
|
|
|
Desktop opt.Bool
|
|
|
|
Package string
|
|
|
|
DeviceModel string
|
|
|
|
Hostname string
|
|
|
|
ShieldsUp bool
|
|
|
|
ShareeNode bool
|
2022-09-13 15:09:57 +01:00
|
|
|
NoLogsNoSupport bool
|
2022-08-30 20:30:55 +01:00
|
|
|
GoArch string
|
|
|
|
GoVersion string
|
|
|
|
RoutableIPs []netip.Prefix
|
|
|
|
RequestTags []string
|
|
|
|
Services []Service
|
|
|
|
NetInfo *NetInfo
|
|
|
|
SSH_HostKeys []string
|
|
|
|
Cloud string
|
|
|
|
Userspace opt.Bool
|
|
|
|
UserspaceRouter opt.Bool
|
2020-09-04 23:19:54 +01:00
|
|
|
}{})
|
|
|
|
|
2020-07-24 08:59:49 +01:00
|
|
|
// Clone makes a deep copy of NetInfo.
|
|
|
|
// The result aliases no memory with the original.
|
|
|
|
func (src *NetInfo) Clone() *NetInfo {
|
|
|
|
if src == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
dst := new(NetInfo)
|
|
|
|
*dst = *src
|
|
|
|
if dst.DERPLatency != nil {
|
|
|
|
dst.DERPLatency = map[string]float64{}
|
|
|
|
for k, v := range src.DERPLatency {
|
|
|
|
dst.DERPLatency[k] = v
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return dst
|
|
|
|
}
|
2020-08-21 13:31:19 +01:00
|
|
|
|
2021-09-15 18:05:34 +01:00
|
|
|
// A compilation failure here means this code must be regenerated, with the command at the top of this file.
|
2021-09-16 23:58:43 +01:00
|
|
|
var _NetInfoCloneNeedsRegeneration = NetInfo(struct {
|
2020-09-04 23:19:54 +01:00
|
|
|
MappingVariesByDestIP opt.Bool
|
|
|
|
HairPinning opt.Bool
|
|
|
|
WorkingIPv6 opt.Bool
|
2022-07-19 00:56:10 +01:00
|
|
|
OSHasIPv6 opt.Bool
|
2020-09-04 23:19:54 +01:00
|
|
|
WorkingUDP opt.Bool
|
2022-08-04 22:10:13 +01:00
|
|
|
WorkingICMPv4 opt.Bool
|
2021-03-09 23:09:10 +00:00
|
|
|
HavePortMap bool
|
2020-09-04 23:19:54 +01:00
|
|
|
UPnP opt.Bool
|
|
|
|
PMP opt.Bool
|
|
|
|
PCP opt.Bool
|
|
|
|
PreferredDERP int
|
|
|
|
LinkType string
|
|
|
|
DERPLatency map[string]float64
|
|
|
|
}{})
|
|
|
|
|
2020-09-04 12:41:30 +01:00
|
|
|
// 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
|
|
|
|
}
|
|
|
|
|
2021-09-15 18:05:34 +01:00
|
|
|
// A compilation failure here means this code must be regenerated, with the command at the top of this file.
|
2021-09-16 23:58:43 +01:00
|
|
|
var _LoginCloneNeedsRegeneration = Login(struct {
|
2020-09-04 23:19:54 +01:00
|
|
|
_ structs.Incomparable
|
|
|
|
ID LoginID
|
|
|
|
Provider string
|
|
|
|
LoginName string
|
|
|
|
DisplayName string
|
|
|
|
ProfilePicURL string
|
|
|
|
Domain string
|
|
|
|
}{})
|
|
|
|
|
2020-09-04 12:41:30 +01:00
|
|
|
// 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
|
2022-05-03 22:41:58 +01:00
|
|
|
dst.Resolvers = make([]*dnstype.Resolver, len(src.Resolvers))
|
2021-04-08 09:35:14 +01:00
|
|
|
for i := range dst.Resolvers {
|
2022-05-03 22:41:58 +01:00
|
|
|
dst.Resolvers[i] = src.Resolvers[i].Clone()
|
2021-04-08 09:35:14 +01:00
|
|
|
}
|
|
|
|
if dst.Routes != nil {
|
2022-05-03 22:41:58 +01:00
|
|
|
dst.Routes = map[string][]*dnstype.Resolver{}
|
2021-04-08 09:35:14 +01:00
|
|
|
for k := range src.Routes {
|
2022-05-03 22:41:58 +01:00
|
|
|
dst.Routes[k] = append([]*dnstype.Resolver{}, src.Routes[k]...)
|
2021-04-08 09:35:14 +01:00
|
|
|
}
|
|
|
|
}
|
2022-05-03 22:41:58 +01:00
|
|
|
dst.FallbackResolvers = make([]*dnstype.Resolver, len(src.FallbackResolvers))
|
2021-04-20 05:30:39 +01:00
|
|
|
for i := range dst.FallbackResolvers {
|
2022-05-03 22:41:58 +01:00
|
|
|
dst.FallbackResolvers[i] = src.FallbackResolvers[i].Clone()
|
2021-04-20 05:30:39 +01:00
|
|
|
}
|
2020-09-04 12:41:30 +01:00
|
|
|
dst.Domains = append(src.Domains[:0:0], src.Domains...)
|
2021-04-08 09:35:14 +01:00
|
|
|
dst.Nameservers = append(src.Nameservers[:0:0], src.Nameservers...)
|
2021-06-15 20:12:15 +01:00
|
|
|
dst.CertDomains = append(src.CertDomains[:0:0], src.CertDomains...)
|
2021-06-16 18:58:25 +01:00
|
|
|
dst.ExtraRecords = append(src.ExtraRecords[:0:0], src.ExtraRecords...)
|
2021-11-29 22:18:09 +00:00
|
|
|
dst.ExitNodeFilteredSet = append(src.ExitNodeFilteredSet[:0:0], src.ExitNodeFilteredSet...)
|
2020-09-04 12:41:30 +01:00
|
|
|
return dst
|
|
|
|
}
|
2020-09-04 23:19:54 +01:00
|
|
|
|
2021-09-15 18:05:34 +01:00
|
|
|
// A compilation failure here means this code must be regenerated, with the command at the top of this file.
|
2021-09-16 23:58:43 +01:00
|
|
|
var _DNSConfigCloneNeedsRegeneration = DNSConfig(struct {
|
2022-05-03 22:41:58 +01:00
|
|
|
Resolvers []*dnstype.Resolver
|
|
|
|
Routes map[string][]*dnstype.Resolver
|
|
|
|
FallbackResolvers []*dnstype.Resolver
|
2021-11-29 22:18:09 +00:00
|
|
|
Domains []string
|
|
|
|
Proxied bool
|
2022-07-25 04:08:42 +01:00
|
|
|
Nameservers []netip.Addr
|
2021-11-29 22:18:09 +00:00
|
|
|
CertDomains []string
|
|
|
|
ExtraRecords []DNSRecord
|
|
|
|
ExitNodeFilteredSet []string
|
2021-04-08 09:35:14 +01:00
|
|
|
}{})
|
|
|
|
|
2020-10-06 19:02:57 +01:00
|
|
|
// Clone makes a deep copy of RegisterResponse.
|
|
|
|
// The result aliases no memory with the original.
|
|
|
|
func (src *RegisterResponse) Clone() *RegisterResponse {
|
|
|
|
if src == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
dst := new(RegisterResponse)
|
|
|
|
*dst = *src
|
|
|
|
dst.User = *src.User.Clone()
|
2022-10-13 18:43:00 +01:00
|
|
|
dst.NodeKeySignature = append(src.NodeKeySignature[:0:0], src.NodeKeySignature...)
|
2020-10-06 19:02:57 +01:00
|
|
|
return dst
|
|
|
|
}
|
|
|
|
|
2021-09-15 18:05:34 +01:00
|
|
|
// A compilation failure here means this code must be regenerated, with the command at the top of this file.
|
2021-09-16 23:58:43 +01:00
|
|
|
var _RegisterResponseCloneNeedsRegeneration = RegisterResponse(struct {
|
2020-10-06 19:02:57 +01:00
|
|
|
User User
|
|
|
|
Login Login
|
|
|
|
NodeKeyExpired bool
|
|
|
|
MachineAuthorized bool
|
|
|
|
AuthURL string
|
2022-10-13 18:43:00 +01:00
|
|
|
NodeKeySignature tkatype.MarshaledSignature
|
2021-10-26 18:19:35 +01:00
|
|
|
Error string
|
2020-10-06 19:02:57 +01:00
|
|
|
}{})
|
|
|
|
|
2021-06-23 06:01:11 +01:00
|
|
|
// Clone makes a deep copy of DERPRegion.
|
|
|
|
// The result aliases no memory with the original.
|
|
|
|
func (src *DERPRegion) Clone() *DERPRegion {
|
|
|
|
if src == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
dst := new(DERPRegion)
|
|
|
|
*dst = *src
|
|
|
|
dst.Nodes = make([]*DERPNode, len(src.Nodes))
|
|
|
|
for i := range dst.Nodes {
|
|
|
|
dst.Nodes[i] = src.Nodes[i].Clone()
|
|
|
|
}
|
|
|
|
return dst
|
|
|
|
}
|
|
|
|
|
2021-09-15 18:05:34 +01:00
|
|
|
// A compilation failure here means this code must be regenerated, with the command at the top of this file.
|
2021-09-16 23:58:43 +01:00
|
|
|
var _DERPRegionCloneNeedsRegeneration = DERPRegion(struct {
|
2021-06-23 06:01:11 +01:00
|
|
|
RegionID int
|
|
|
|
RegionCode string
|
|
|
|
RegionName string
|
|
|
|
Avoid bool
|
|
|
|
Nodes []*DERPNode
|
|
|
|
}{})
|
|
|
|
|
|
|
|
// Clone makes a deep copy of DERPMap.
|
|
|
|
// The result aliases no memory with the original.
|
|
|
|
func (src *DERPMap) Clone() *DERPMap {
|
|
|
|
if src == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
dst := new(DERPMap)
|
|
|
|
*dst = *src
|
|
|
|
if dst.Regions != nil {
|
|
|
|
dst.Regions = map[int]*DERPRegion{}
|
|
|
|
for k, v := range src.Regions {
|
|
|
|
dst.Regions[k] = v.Clone()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return dst
|
|
|
|
}
|
|
|
|
|
2021-09-15 18:05:34 +01:00
|
|
|
// A compilation failure here means this code must be regenerated, with the command at the top of this file.
|
2021-09-16 23:58:43 +01:00
|
|
|
var _DERPMapCloneNeedsRegeneration = DERPMap(struct {
|
2021-06-23 00:24:32 +01:00
|
|
|
Regions map[int]*DERPRegion
|
|
|
|
OmitDefaultRegions bool
|
2021-06-23 06:01:11 +01:00
|
|
|
}{})
|
|
|
|
|
|
|
|
// Clone makes a deep copy of DERPNode.
|
|
|
|
// The result aliases no memory with the original.
|
|
|
|
func (src *DERPNode) Clone() *DERPNode {
|
|
|
|
if src == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
dst := new(DERPNode)
|
|
|
|
*dst = *src
|
|
|
|
return dst
|
|
|
|
}
|
|
|
|
|
2021-09-15 18:05:34 +01:00
|
|
|
// A compilation failure here means this code must be regenerated, with the command at the top of this file.
|
2021-09-16 23:58:43 +01:00
|
|
|
var _DERPNodeCloneNeedsRegeneration = DERPNode(struct {
|
2021-07-09 19:16:43 +01:00
|
|
|
Name string
|
|
|
|
RegionID int
|
|
|
|
HostName string
|
|
|
|
CertName string
|
|
|
|
IPv4 string
|
|
|
|
IPv6 string
|
|
|
|
STUNPort int
|
|
|
|
STUNOnly bool
|
|
|
|
DERPPort int
|
|
|
|
InsecureForTests bool
|
|
|
|
STUNTestIP string
|
2021-06-23 06:01:11 +01:00
|
|
|
}{})
|
|
|
|
|
2022-07-27 04:48:38 +01:00
|
|
|
// Clone makes a deep copy of SSHRule.
|
|
|
|
// The result aliases no memory with the original.
|
|
|
|
func (src *SSHRule) Clone() *SSHRule {
|
|
|
|
if src == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
dst := new(SSHRule)
|
|
|
|
*dst = *src
|
|
|
|
if dst.RuleExpires != nil {
|
|
|
|
dst.RuleExpires = new(time.Time)
|
|
|
|
*dst.RuleExpires = *src.RuleExpires
|
|
|
|
}
|
|
|
|
dst.Principals = make([]*SSHPrincipal, len(src.Principals))
|
|
|
|
for i := range dst.Principals {
|
|
|
|
dst.Principals[i] = src.Principals[i].Clone()
|
|
|
|
}
|
|
|
|
if dst.SSHUsers != nil {
|
|
|
|
dst.SSHUsers = map[string]string{}
|
|
|
|
for k, v := range src.SSHUsers {
|
|
|
|
dst.SSHUsers[k] = v
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if dst.Action != nil {
|
|
|
|
dst.Action = new(SSHAction)
|
|
|
|
*dst.Action = *src.Action
|
|
|
|
}
|
|
|
|
return dst
|
|
|
|
}
|
|
|
|
|
|
|
|
// A compilation failure here means this code must be regenerated, with the command at the top of this file.
|
|
|
|
var _SSHRuleCloneNeedsRegeneration = SSHRule(struct {
|
|
|
|
RuleExpires *time.Time
|
|
|
|
Principals []*SSHPrincipal
|
|
|
|
SSHUsers map[string]string
|
|
|
|
Action *SSHAction
|
|
|
|
}{})
|
|
|
|
|
|
|
|
// Clone makes a deep copy of SSHPrincipal.
|
|
|
|
// The result aliases no memory with the original.
|
|
|
|
func (src *SSHPrincipal) Clone() *SSHPrincipal {
|
|
|
|
if src == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
dst := new(SSHPrincipal)
|
|
|
|
*dst = *src
|
|
|
|
dst.PubKeys = append(src.PubKeys[:0:0], src.PubKeys...)
|
|
|
|
return dst
|
|
|
|
}
|
|
|
|
|
|
|
|
// A compilation failure here means this code must be regenerated, with the command at the top of this file.
|
|
|
|
var _SSHPrincipalCloneNeedsRegeneration = SSHPrincipal(struct {
|
|
|
|
Node StableNodeID
|
|
|
|
NodeIP string
|
|
|
|
UserLogin string
|
|
|
|
Any bool
|
|
|
|
PubKeys []string
|
|
|
|
}{})
|
|
|
|
|
2022-10-05 15:18:26 +01:00
|
|
|
// Clone makes a deep copy of ControlDialPlan.
|
|
|
|
// The result aliases no memory with the original.
|
|
|
|
func (src *ControlDialPlan) Clone() *ControlDialPlan {
|
|
|
|
if src == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
dst := new(ControlDialPlan)
|
|
|
|
*dst = *src
|
|
|
|
dst.Candidates = append(src.Candidates[:0:0], src.Candidates...)
|
|
|
|
return dst
|
|
|
|
}
|
|
|
|
|
|
|
|
// A compilation failure here means this code must be regenerated, with the command at the top of this file.
|
|
|
|
var _ControlDialPlanCloneNeedsRegeneration = ControlDialPlan(struct {
|
|
|
|
Candidates []ControlIPCandidate
|
|
|
|
}{})
|
|
|
|
|
2020-09-04 23:19:54 +01:00
|
|
|
// Clone duplicates src into dst and reports whether it succeeded.
|
|
|
|
// To succeed, <src, dst> must be of types <*T, *T> or <*T, **T>,
|
2022-10-05 15:18:26 +01:00
|
|
|
// where T is one of User,Node,Hostinfo,NetInfo,Login,DNSConfig,RegisterResponse,DERPRegion,DERPMap,DERPNode,SSHRule,SSHPrincipal,ControlDialPlan.
|
2022-03-16 23:27:57 +00:00
|
|
|
func Clone(dst, src any) bool {
|
2020-09-04 23:19:54 +01:00
|
|
|
switch src := src.(type) {
|
|
|
|
case *User:
|
|
|
|
switch dst := dst.(type) {
|
|
|
|
case *User:
|
|
|
|
*dst = *src.Clone()
|
|
|
|
return true
|
|
|
|
case **User:
|
|
|
|
*dst = src.Clone()
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
case *Node:
|
|
|
|
switch dst := dst.(type) {
|
|
|
|
case *Node:
|
|
|
|
*dst = *src.Clone()
|
|
|
|
return true
|
|
|
|
case **Node:
|
|
|
|
*dst = src.Clone()
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
case *Hostinfo:
|
|
|
|
switch dst := dst.(type) {
|
|
|
|
case *Hostinfo:
|
|
|
|
*dst = *src.Clone()
|
|
|
|
return true
|
|
|
|
case **Hostinfo:
|
|
|
|
*dst = src.Clone()
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
case *NetInfo:
|
|
|
|
switch dst := dst.(type) {
|
|
|
|
case *NetInfo:
|
|
|
|
*dst = *src.Clone()
|
|
|
|
return true
|
|
|
|
case **NetInfo:
|
|
|
|
*dst = src.Clone()
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
case *Login:
|
|
|
|
switch dst := dst.(type) {
|
|
|
|
case *Login:
|
|
|
|
*dst = *src.Clone()
|
|
|
|
return true
|
|
|
|
case **Login:
|
|
|
|
*dst = src.Clone()
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
case *DNSConfig:
|
|
|
|
switch dst := dst.(type) {
|
|
|
|
case *DNSConfig:
|
|
|
|
*dst = *src.Clone()
|
|
|
|
return true
|
|
|
|
case **DNSConfig:
|
|
|
|
*dst = src.Clone()
|
|
|
|
return true
|
|
|
|
}
|
2020-10-06 19:02:57 +01:00
|
|
|
case *RegisterResponse:
|
|
|
|
switch dst := dst.(type) {
|
|
|
|
case *RegisterResponse:
|
|
|
|
*dst = *src.Clone()
|
|
|
|
return true
|
|
|
|
case **RegisterResponse:
|
|
|
|
*dst = src.Clone()
|
|
|
|
return true
|
|
|
|
}
|
2021-06-23 06:01:11 +01:00
|
|
|
case *DERPRegion:
|
|
|
|
switch dst := dst.(type) {
|
|
|
|
case *DERPRegion:
|
|
|
|
*dst = *src.Clone()
|
|
|
|
return true
|
|
|
|
case **DERPRegion:
|
|
|
|
*dst = src.Clone()
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
case *DERPMap:
|
|
|
|
switch dst := dst.(type) {
|
|
|
|
case *DERPMap:
|
|
|
|
*dst = *src.Clone()
|
|
|
|
return true
|
|
|
|
case **DERPMap:
|
|
|
|
*dst = src.Clone()
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
case *DERPNode:
|
|
|
|
switch dst := dst.(type) {
|
|
|
|
case *DERPNode:
|
|
|
|
*dst = *src.Clone()
|
|
|
|
return true
|
|
|
|
case **DERPNode:
|
|
|
|
*dst = src.Clone()
|
|
|
|
return true
|
|
|
|
}
|
2022-07-27 04:48:38 +01:00
|
|
|
case *SSHRule:
|
|
|
|
switch dst := dst.(type) {
|
|
|
|
case *SSHRule:
|
|
|
|
*dst = *src.Clone()
|
|
|
|
return true
|
|
|
|
case **SSHRule:
|
|
|
|
*dst = src.Clone()
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
case *SSHPrincipal:
|
|
|
|
switch dst := dst.(type) {
|
|
|
|
case *SSHPrincipal:
|
|
|
|
*dst = *src.Clone()
|
|
|
|
return true
|
|
|
|
case **SSHPrincipal:
|
|
|
|
*dst = src.Clone()
|
|
|
|
return true
|
|
|
|
}
|
2022-10-05 15:18:26 +01:00
|
|
|
case *ControlDialPlan:
|
|
|
|
switch dst := dst.(type) {
|
|
|
|
case *ControlDialPlan:
|
|
|
|
*dst = *src.Clone()
|
|
|
|
return true
|
|
|
|
case **ControlDialPlan:
|
|
|
|
*dst = src.Clone()
|
|
|
|
return true
|
|
|
|
}
|
2020-09-04 23:19:54 +01:00
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|