2023-01-27 21:37:20 +00:00
|
|
|
// Copyright (c) Tailscale Inc & AUTHORS
|
|
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
2020-07-24 07:59:49 +00:00
|
|
|
|
2022-05-01 23:24:54 +00:00
|
|
|
// Code generated by tailscale.com/cmd/cloner; DO NOT EDIT.
|
2020-07-24 07:59:49 +00:00
|
|
|
|
|
|
|
package tailcfg
|
|
|
|
|
|
|
|
import (
|
2022-07-25 03:08:42 +00:00
|
|
|
"net/netip"
|
2022-04-29 20:30:54 +00:00
|
|
|
"time"
|
|
|
|
|
2021-08-05 21:05:24 +00:00
|
|
|
"tailscale.com/types/dnstype"
|
2021-09-03 20:17:46 +00:00
|
|
|
"tailscale.com/types/key"
|
2020-09-04 22:19:54 +00:00
|
|
|
"tailscale.com/types/opt"
|
|
|
|
"tailscale.com/types/structs"
|
2022-08-12 19:34:25 +00:00
|
|
|
"tailscale.com/types/tkatype"
|
2020-07-24 07:59:49 +00: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 17:40:34 +00:00
|
|
|
dst.Logins = append(src.Logins[:0:0], src.Logins...)
|
2020-07-24 07:59:49 +00:00
|
|
|
return dst
|
|
|
|
}
|
|
|
|
|
2021-09-15 17:05:34 +00:00
|
|
|
// A compilation failure here means this code must be regenerated, with the command at the top of this file.
|
2021-09-16 22:58:43 +00:00
|
|
|
var _UserCloneNeedsRegeneration = User(struct {
|
2020-09-04 22:19:54 +00:00
|
|
|
ID UserID
|
|
|
|
LoginName string
|
|
|
|
DisplayName string
|
|
|
|
ProfilePicURL string
|
|
|
|
Domain string
|
|
|
|
Logins []LoginID
|
|
|
|
Created time.Time
|
|
|
|
}{})
|
|
|
|
|
2020-07-24 07:59:49 +00: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 19:34:25 +00:00
|
|
|
dst.KeySignature = append(src.KeySignature[:0:0], src.KeySignature...)
|
2020-07-27 17:40:34 +00: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 21:26:31 +00:00
|
|
|
dst.Tags = append(src.Tags[:0:0], src.Tags...)
|
2021-07-27 15:01:29 +00:00
|
|
|
dst.PrimaryRoutes = append(src.PrimaryRoutes[:0:0], src.PrimaryRoutes...)
|
2020-07-24 07:59:49 +00:00
|
|
|
if dst.LastSeen != nil {
|
|
|
|
dst.LastSeen = new(time.Time)
|
|
|
|
*dst.LastSeen = *src.LastSeen
|
|
|
|
}
|
2021-04-15 23:03:59 +00:00
|
|
|
if dst.Online != nil {
|
|
|
|
dst.Online = new(bool)
|
|
|
|
*dst.Online = *src.Online
|
|
|
|
}
|
2021-04-01 21:03:34 +00:00
|
|
|
dst.Capabilities = append(src.Capabilities[:0:0], src.Capabilities...)
|
2020-07-24 07:59:49 +00:00
|
|
|
return dst
|
|
|
|
}
|
|
|
|
|
2021-09-15 17:05:34 +00:00
|
|
|
// A compilation failure here means this code must be regenerated, with the command at the top of this file.
|
2021-09-16 22:58:43 +00: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 19:34:25 +00:00
|
|
|
KeySignature tkatype.MarshaledSignature
|
2021-09-03 20:17:46 +00:00
|
|
|
Machine key.MachinePublic
|
2021-11-02 21:41:56 +00:00
|
|
|
DiscoKey key.DiscoPublic
|
2022-07-25 03:08:42 +00: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
|
2023-01-19 20:40:58 +00:00
|
|
|
Cap CapabilityVersion
|
2021-10-20 21:26:31 +00:00
|
|
|
Tags []string
|
2022-07-25 03:08:42 +00:00
|
|
|
PrimaryRoutes []netip.Prefix
|
2021-01-27 16:50:31 +00:00
|
|
|
LastSeen *time.Time
|
2021-04-15 23:03:59 +00:00
|
|
|
Online *bool
|
2021-01-27 16:50:31 +00:00
|
|
|
KeepAlive bool
|
|
|
|
MachineAuthorized bool
|
2021-04-01 21:03:34 +00: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 19:49:24 +00:00
|
|
|
DataPlaneAuditLogID string
|
2023-01-10 17:55:43 +00:00
|
|
|
Expired bool
|
2020-09-04 22:19:54 +00:00
|
|
|
}{})
|
|
|
|
|
2020-07-27 17:40:34 +00: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 17:40:34 +00:00
|
|
|
return dst
|
|
|
|
}
|
|
|
|
|
2021-09-15 17:05:34 +00:00
|
|
|
// A compilation failure here means this code must be regenerated, with the command at the top of this file.
|
2021-09-16 22:58:43 +00:00
|
|
|
var _HostinfoCloneNeedsRegeneration = Hostinfo(struct {
|
2022-08-30 19:30:55 +00:00
|
|
|
IPNVersion string
|
|
|
|
FrontendLogID string
|
|
|
|
BackendLogID string
|
|
|
|
OS string
|
|
|
|
OSVersion string
|
2022-09-11 17:57:18 +00:00
|
|
|
Container opt.Bool
|
|
|
|
Env string
|
|
|
|
Distro string
|
|
|
|
DistroVersion string
|
|
|
|
DistroCodeName string
|
2023-02-27 17:58:54 +00:00
|
|
|
App string
|
2022-08-30 19:30:55 +00:00
|
|
|
Desktop opt.Bool
|
|
|
|
Package string
|
|
|
|
DeviceModel string
|
2023-01-29 22:04:40 +00:00
|
|
|
PushDeviceToken string
|
2022-08-30 19:30:55 +00:00
|
|
|
Hostname string
|
|
|
|
ShieldsUp bool
|
|
|
|
ShareeNode bool
|
2022-09-13 14:09:57 +00:00
|
|
|
NoLogsNoSupport bool
|
2022-11-16 04:30:53 +00:00
|
|
|
WireIngress bool
|
2023-01-21 18:04:43 +00:00
|
|
|
AllowsUpdate bool
|
2023-01-22 18:16:15 +00:00
|
|
|
Machine string
|
2022-08-30 19:30:55 +00:00
|
|
|
GoArch string
|
2023-01-22 18:16:15 +00:00
|
|
|
GoArchVar string
|
2022-08-30 19:30:55 +00:00
|
|
|
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 22:19:54 +00:00
|
|
|
}{})
|
|
|
|
|
2020-07-24 07:59:49 +00: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 12:31:19 +00:00
|
|
|
|
2021-09-15 17:05:34 +00:00
|
|
|
// A compilation failure here means this code must be regenerated, with the command at the top of this file.
|
2021-09-16 22:58:43 +00:00
|
|
|
var _NetInfoCloneNeedsRegeneration = NetInfo(struct {
|
2020-09-04 22:19:54 +00:00
|
|
|
MappingVariesByDestIP opt.Bool
|
|
|
|
HairPinning opt.Bool
|
|
|
|
WorkingIPv6 opt.Bool
|
2022-07-18 23:56:10 +00:00
|
|
|
OSHasIPv6 opt.Bool
|
2020-09-04 22:19:54 +00:00
|
|
|
WorkingUDP opt.Bool
|
2022-08-04 21:10:13 +00:00
|
|
|
WorkingICMPv4 opt.Bool
|
2021-03-09 23:09:10 +00:00
|
|
|
HavePortMap bool
|
2020-09-04 22:19:54 +00:00
|
|
|
UPnP opt.Bool
|
|
|
|
PMP opt.Bool
|
|
|
|
PCP opt.Bool
|
|
|
|
PreferredDERP int
|
|
|
|
LinkType string
|
|
|
|
DERPLatency map[string]float64
|
|
|
|
}{})
|
|
|
|
|
2020-09-04 11:41:30 +00: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 17:05:34 +00:00
|
|
|
// A compilation failure here means this code must be regenerated, with the command at the top of this file.
|
2021-09-16 22:58:43 +00:00
|
|
|
var _LoginCloneNeedsRegeneration = Login(struct {
|
2020-09-04 22:19:54 +00:00
|
|
|
_ structs.Incomparable
|
|
|
|
ID LoginID
|
|
|
|
Provider string
|
|
|
|
LoginName string
|
|
|
|
DisplayName string
|
|
|
|
ProfilePicURL string
|
|
|
|
Domain string
|
|
|
|
}{})
|
|
|
|
|
2020-09-04 11:41:30 +00: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 21:41:58 +00:00
|
|
|
dst.Resolvers = make([]*dnstype.Resolver, len(src.Resolvers))
|
2021-04-08 08:35:14 +00:00
|
|
|
for i := range dst.Resolvers {
|
2022-05-03 21:41:58 +00:00
|
|
|
dst.Resolvers[i] = src.Resolvers[i].Clone()
|
2021-04-08 08:35:14 +00:00
|
|
|
}
|
|
|
|
if dst.Routes != nil {
|
2022-05-03 21:41:58 +00:00
|
|
|
dst.Routes = map[string][]*dnstype.Resolver{}
|
2021-04-08 08:35:14 +00:00
|
|
|
for k := range src.Routes {
|
2022-05-03 21:41:58 +00:00
|
|
|
dst.Routes[k] = append([]*dnstype.Resolver{}, src.Routes[k]...)
|
2021-04-08 08:35:14 +00:00
|
|
|
}
|
|
|
|
}
|
2022-05-03 21:41:58 +00:00
|
|
|
dst.FallbackResolvers = make([]*dnstype.Resolver, len(src.FallbackResolvers))
|
2021-04-20 04:30:39 +00:00
|
|
|
for i := range dst.FallbackResolvers {
|
2022-05-03 21:41:58 +00:00
|
|
|
dst.FallbackResolvers[i] = src.FallbackResolvers[i].Clone()
|
2021-04-20 04:30:39 +00:00
|
|
|
}
|
2020-09-04 11:41:30 +00:00
|
|
|
dst.Domains = append(src.Domains[:0:0], src.Domains...)
|
2021-04-08 08:35:14 +00:00
|
|
|
dst.Nameservers = append(src.Nameservers[:0:0], src.Nameservers...)
|
2021-06-15 19:12:15 +00:00
|
|
|
dst.CertDomains = append(src.CertDomains[:0:0], src.CertDomains...)
|
2021-06-16 17:58:25 +00: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 11:41:30 +00:00
|
|
|
return dst
|
|
|
|
}
|
2020-09-04 22:19:54 +00:00
|
|
|
|
2021-09-15 17:05:34 +00:00
|
|
|
// A compilation failure here means this code must be regenerated, with the command at the top of this file.
|
2021-09-16 22:58:43 +00:00
|
|
|
var _DNSConfigCloneNeedsRegeneration = DNSConfig(struct {
|
2022-05-03 21:41:58 +00: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 03:08:42 +00:00
|
|
|
Nameservers []netip.Addr
|
2021-11-29 22:18:09 +00:00
|
|
|
CertDomains []string
|
|
|
|
ExtraRecords []DNSRecord
|
|
|
|
ExitNodeFilteredSet []string
|
2021-04-08 08:35:14 +00:00
|
|
|
}{})
|
|
|
|
|
2020-10-06 18:02:57 +00: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 17:43:00 +00:00
|
|
|
dst.NodeKeySignature = append(src.NodeKeySignature[:0:0], src.NodeKeySignature...)
|
2020-10-06 18:02:57 +00:00
|
|
|
return dst
|
|
|
|
}
|
|
|
|
|
2021-09-15 17:05:34 +00:00
|
|
|
// A compilation failure here means this code must be regenerated, with the command at the top of this file.
|
2021-09-16 22:58:43 +00:00
|
|
|
var _RegisterResponseCloneNeedsRegeneration = RegisterResponse(struct {
|
2020-10-06 18:02:57 +00:00
|
|
|
User User
|
|
|
|
Login Login
|
|
|
|
NodeKeyExpired bool
|
|
|
|
MachineAuthorized bool
|
|
|
|
AuthURL string
|
2022-10-13 17:43:00 +00:00
|
|
|
NodeKeySignature tkatype.MarshaledSignature
|
2021-10-26 17:19:35 +00:00
|
|
|
Error string
|
2020-10-06 18:02:57 +00:00
|
|
|
}{})
|
|
|
|
|
2021-06-23 05:01:11 +00: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 17:05:34 +00:00
|
|
|
// A compilation failure here means this code must be regenerated, with the command at the top of this file.
|
2021-09-16 22:58:43 +00:00
|
|
|
var _DERPRegionCloneNeedsRegeneration = DERPRegion(struct {
|
2021-06-23 05:01:11 +00: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 17:05:34 +00:00
|
|
|
// A compilation failure here means this code must be regenerated, with the command at the top of this file.
|
2021-09-16 22:58:43 +00:00
|
|
|
var _DERPMapCloneNeedsRegeneration = DERPMap(struct {
|
2021-06-22 23:24:32 +00:00
|
|
|
Regions map[int]*DERPRegion
|
|
|
|
OmitDefaultRegions bool
|
2021-06-23 05:01:11 +00: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 17:05:34 +00:00
|
|
|
// A compilation failure here means this code must be regenerated, with the command at the top of this file.
|
2021-09-16 22:58:43 +00:00
|
|
|
var _DERPNodeCloneNeedsRegeneration = DERPNode(struct {
|
2021-07-09 18:16:43 +00: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 05:01:11 +00:00
|
|
|
}{})
|
|
|
|
|
2022-07-27 03:48:38 +00: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 14:18:26 +00: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 22:19:54 +00: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 14:18:26 +00: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 22:19:54 +00: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 18:02:57 +00:00
|
|
|
case *RegisterResponse:
|
|
|
|
switch dst := dst.(type) {
|
|
|
|
case *RegisterResponse:
|
|
|
|
*dst = *src.Clone()
|
|
|
|
return true
|
|
|
|
case **RegisterResponse:
|
|
|
|
*dst = src.Clone()
|
|
|
|
return true
|
|
|
|
}
|
2021-06-23 05:01:11 +00: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 03:48:38 +00: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 14:18:26 +00:00
|
|
|
case *ControlDialPlan:
|
|
|
|
switch dst := dst.(type) {
|
|
|
|
case *ControlDialPlan:
|
|
|
|
*dst = *src.Clone()
|
|
|
|
return true
|
|
|
|
case **ControlDialPlan:
|
|
|
|
*dst = src.Clone()
|
|
|
|
return true
|
|
|
|
}
|
2020-09-04 22:19:54 +00:00
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|