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 (
2023-08-20 17:16:06 +00:00
"maps"
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"
2023-08-20 17:16:06 +00:00
"tailscale.com/types/ptr"
2020-09-04 22:19:54 +00:00
"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
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 {
2023-08-20 17:16:06 +00:00
dst . LastSeen = ptr . To ( * src . LastSeen )
2020-07-24 07:59:49 +00:00
}
2021-04-15 23:03:59 +00:00
if dst . Online != nil {
2023-08-20 17:16:06 +00:00
dst . Online = ptr . To ( * src . Online )
2021-04-15 23:03:59 +00:00
}
2021-04-01 21:03:34 +00:00
dst . Capabilities = append ( src . Capabilities [ : 0 : 0 ] , src . Capabilities ... )
2023-09-18 15:52:22 +00:00
if dst . CapMap != nil {
dst . CapMap = map [ NodeCapability ] [ ] RawMessage { }
for k := range src . CapMap {
dst . CapMap [ k ] = append ( [ ] RawMessage { } , src . CapMap [ k ] ... )
}
}
2023-04-13 17:12:31 +00:00
if dst . SelfNodeV4MasqAddrForThisPeer != nil {
2023-08-20 17:16:06 +00:00
dst . SelfNodeV4MasqAddrForThisPeer = ptr . To ( * src . SelfNodeV4MasqAddrForThisPeer )
2023-04-13 17:12:31 +00:00
}
2023-09-19 00:03:53 +00:00
if dst . SelfNodeV6MasqAddrForThisPeer != nil {
dst . SelfNodeV6MasqAddrForThisPeer = ptr . To ( * src . SelfNodeV6MasqAddrForThisPeer )
}
2023-09-30 01:15:53 +00:00
if src . ExitNodeDNSResolvers != nil {
dst . ExitNodeDNSResolvers = make ( [ ] * dnstype . Resolver , len ( src . ExitNodeDNSResolvers ) )
for i := range dst . ExitNodeDNSResolvers {
2024-07-08 15:11:00 +00:00
if src . ExitNodeDNSResolvers [ i ] == nil {
dst . ExitNodeDNSResolvers [ i ] = nil
} else {
dst . ExitNodeDNSResolvers [ i ] = src . ExitNodeDNSResolvers [ i ] . Clone ( )
}
2023-09-30 01:15:53 +00:00
}
2023-09-14 17:04:31 +00:00
}
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 {
2023-03-03 00:05:07 +00:00
ID NodeID
StableID StableNodeID
Name string
User UserID
Sharer UserID
Key key . NodePublic
KeyExpiry time . Time
KeySignature tkatype . MarshaledSignature
Machine key . MachinePublic
DiscoKey key . DiscoPublic
Addresses [ ] netip . Prefix
AllowedIPs [ ] netip . Prefix
2023-10-01 04:05:02 +00:00
Endpoints [ ] netip . AddrPort
2023-03-03 00:05:07 +00:00
DERP string
Hostinfo HostinfoView
Created time . Time
Cap CapabilityVersion
Tags [ ] string
PrimaryRoutes [ ] netip . Prefix
LastSeen * time . Time
Online * bool
MachineAuthorized bool
2023-09-06 17:17:25 +00:00
Capabilities [ ] NodeCapability
2023-09-18 15:52:22 +00:00
CapMap NodeCapMap
2023-03-03 00:05:07 +00:00
UnsignedPeerAPIOnly bool
ComputedName string
computedHostIfDifferent string
ComputedNameWithHost string
DataPlaneAuditLogID string
Expired bool
2023-04-13 17:12:31 +00:00
SelfNodeV4MasqAddrForThisPeer * netip . Addr
2023-09-19 00:03:53 +00:00
SelfNodeV6MasqAddrForThisPeer * netip . Addr
2023-04-06 00:28:28 +00:00
IsWireGuardOnly bool
2024-05-06 18:08:25 +00:00
IsJailed bool
2023-09-14 17:04:31 +00:00
ExitNodeDNSResolvers [ ] * dnstype . Resolver
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 ... )
2023-10-05 16:49:30 +00:00
dst . WoLMACs = append ( src . WoLMACs [ : 0 : 0 ] , src . WoLMACs ... )
2020-07-27 17:40:34 +00:00
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 ... )
2023-06-16 17:04:07 +00:00
if dst . Location != nil {
2023-08-20 17:16:06 +00:00
dst . Location = ptr . To ( * src . Location )
2023-06-16 17:04:07 +00:00
}
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
2023-10-05 16:49:30 +00:00
WoLMACs [ ] string
2022-08-30 19:30:55 +00:00
Services [ ] Service
NetInfo * NetInfo
SSH_HostKeys [ ] string
Cloud string
Userspace opt . Bool
UserspaceRouter opt . Bool
2023-11-10 02:00:56 +00:00
AppConnector opt . Bool
2023-06-16 17:04:07 +00:00
Location * Location
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
2023-08-20 17:16:06 +00:00
dst . DERPLatency = maps . Clone ( src . DERPLatency )
2020-07-24 07:59:49 +00:00
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
2023-08-15 21:52:04 +00:00
FirewallMode string
2020-09-04 22:19:54 +00:00
} { } )
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
} { } )
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
2023-09-30 01:15:53 +00:00
if src . Resolvers != nil {
dst . Resolvers = make ( [ ] * dnstype . Resolver , len ( src . Resolvers ) )
for i := range dst . Resolvers {
2024-07-08 15:11:00 +00:00
if src . Resolvers [ i ] == nil {
dst . Resolvers [ i ] = nil
} else {
dst . Resolvers [ i ] = src . Resolvers [ i ] . Clone ( )
}
2023-09-30 01:15:53 +00:00
}
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
}
}
2023-09-30 01:15:53 +00:00
if src . FallbackResolvers != nil {
dst . FallbackResolvers = make ( [ ] * dnstype . Resolver , len ( src . FallbackResolvers ) )
for i := range dst . FallbackResolvers {
2024-07-08 15:11:00 +00:00
if src . FallbackResolvers [ i ] == nil {
dst . FallbackResolvers [ i ] = nil
} else {
dst . FallbackResolvers [ i ] = src . FallbackResolvers [ i ] . Clone ( )
}
2023-09-30 01:15:53 +00:00
}
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
2023-08-16 22:27:33 +00:00
TempCorpIssue13969 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
} { } )
2023-08-20 03:14:32 +00:00
// Clone makes a deep copy of RegisterResponseAuth.
// The result aliases no memory with the original.
func ( src * RegisterResponseAuth ) Clone ( ) * RegisterResponseAuth {
if src == nil {
return nil
}
dst := new ( RegisterResponseAuth )
* dst = * src
if dst . Oauth2Token != nil {
2023-08-20 17:16:06 +00:00
dst . Oauth2Token = ptr . To ( * src . Oauth2Token )
2023-08-20 03:14:32 +00:00
}
return dst
}
// A compilation failure here means this code must be regenerated, with the command at the top of this file.
var _RegisterResponseAuthCloneNeedsRegeneration = RegisterResponseAuth ( struct {
_ structs . Incomparable
Oauth2Token * Oauth2Token
AuthKey string
} { } )
// Clone makes a deep copy of RegisterRequest.
// The result aliases no memory with the original.
func ( src * RegisterRequest ) Clone ( ) * RegisterRequest {
if src == nil {
return nil
}
dst := new ( RegisterRequest )
* dst = * src
2024-04-20 17:04:04 +00:00
dst . Auth = src . Auth . Clone ( )
2023-08-20 03:14:32 +00:00
dst . Hostinfo = src . Hostinfo . Clone ( )
dst . NodeKeySignature = append ( src . NodeKeySignature [ : 0 : 0 ] , src . NodeKeySignature ... )
if dst . Timestamp != nil {
2023-08-20 17:16:06 +00:00
dst . Timestamp = ptr . To ( * src . Timestamp )
2023-08-20 03:14:32 +00:00
}
dst . DeviceCert = append ( src . DeviceCert [ : 0 : 0 ] , src . DeviceCert ... )
dst . Signature = append ( src . Signature [ : 0 : 0 ] , src . Signature ... )
return dst
}
// A compilation failure here means this code must be regenerated, with the command at the top of this file.
var _RegisterRequestCloneNeedsRegeneration = RegisterRequest ( struct {
_ structs . Incomparable
Version CapabilityVersion
NodeKey key . NodePublic
OldNodeKey key . NodePublic
NLKey key . NLPublic
2024-04-20 17:04:04 +00:00
Auth * RegisterResponseAuth
2023-08-20 03:14:32 +00:00
Expiry time . Time
Followup string
Hostinfo * Hostinfo
Ephemeral bool
NodeKeySignature tkatype . MarshaledSignature
SignatureType SignatureType
Timestamp * time . Time
DeviceCert [ ] byte
Signature [ ] byte
2023-10-13 18:13:41 +00:00
Tailnet string
2023-08-20 03:14:32 +00:00
} { } )
2023-07-12 18:45:46 +00:00
// Clone makes a deep copy of DERPHomeParams.
// The result aliases no memory with the original.
func ( src * DERPHomeParams ) Clone ( ) * DERPHomeParams {
if src == nil {
return nil
}
dst := new ( DERPHomeParams )
* dst = * src
2023-08-20 17:16:06 +00:00
dst . RegionScore = maps . Clone ( src . RegionScore )
2023-07-12 18:45:46 +00:00
return dst
}
// A compilation failure here means this code must be regenerated, with the command at the top of this file.
var _DERPHomeParamsCloneNeedsRegeneration = DERPHomeParams ( struct {
RegionScore map [ int ] float64
} { } )
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
2023-09-30 01:15:53 +00:00
if src . Nodes != nil {
dst . Nodes = make ( [ ] * DERPNode , len ( src . Nodes ) )
for i := range dst . Nodes {
2024-07-08 15:11:00 +00:00
if src . Nodes [ i ] == nil {
dst . Nodes [ i ] = nil
} else {
dst . Nodes [ i ] = ptr . To ( * src . Nodes [ i ] )
}
2023-09-30 01:15:53 +00:00
}
2021-06-23 05:01:11 +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 _DERPRegionCloneNeedsRegeneration = DERPRegion ( struct {
2021-06-23 05:01:11 +00:00
RegionID int
RegionCode string
RegionName string
2024-02-27 20:02:06 +00:00
Latitude float64
Longitude float64
2021-06-23 05:01:11 +00:00
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
2023-07-12 18:45:46 +00:00
dst . HomeParams = src . HomeParams . Clone ( )
2021-06-23 05:01:11 +00:00
if dst . Regions != nil {
dst . Regions = map [ int ] * DERPRegion { }
for k , v := range src . Regions {
2024-07-08 15:11:00 +00:00
if v == nil {
dst . Regions [ k ] = nil
} else {
dst . Regions [ k ] = v . Clone ( )
}
2021-06-23 05:01:11 +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 _DERPMapCloneNeedsRegeneration = DERPMap ( struct {
2023-07-12 18:45:46 +00:00
HomeParams * DERPHomeParams
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
2023-04-20 14:21:46 +00:00
CanPort80 bool
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 {
2023-08-20 17:16:06 +00:00
dst . RuleExpires = ptr . To ( * src . RuleExpires )
2022-07-27 03:48:38 +00:00
}
2023-09-30 01:15:53 +00:00
if src . Principals != nil {
dst . Principals = make ( [ ] * SSHPrincipal , len ( src . Principals ) )
for i := range dst . Principals {
2024-07-08 15:11:00 +00:00
if src . Principals [ i ] == nil {
dst . Principals [ i ] = nil
} else {
dst . Principals [ i ] = src . Principals [ i ] . Clone ( )
}
2023-09-30 01:15:53 +00:00
}
2022-07-27 03:48:38 +00:00
}
2023-08-20 17:16:06 +00:00
dst . SSHUsers = maps . Clone ( src . SSHUsers )
2023-03-21 19:59:05 +00:00
dst . Action = src . Action . Clone ( )
2024-09-23 02:15:26 +00:00
dst . AcceptEnv = append ( src . AcceptEnv [ : 0 : 0 ] , src . AcceptEnv ... )
2022-07-27 03:48:38 +00:00
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
2024-09-23 02:15:26 +00:00
AcceptEnv [ ] string
2023-03-21 19:59:05 +00:00
} { } )
// Clone makes a deep copy of SSHAction.
// The result aliases no memory with the original.
func ( src * SSHAction ) Clone ( ) * SSHAction {
if src == nil {
return nil
}
dst := new ( SSHAction )
* dst = * src
dst . Recorders = append ( src . Recorders [ : 0 : 0 ] , src . Recorders ... )
2023-04-20 04:10:55 +00:00
if dst . OnRecordingFailure != nil {
2023-08-20 17:16:06 +00:00
dst . OnRecordingFailure = ptr . To ( * src . OnRecordingFailure )
2023-04-20 04:10:55 +00:00
}
2023-03-21 19:59:05 +00:00
return dst
}
// A compilation failure here means this code must be regenerated, with the command at the top of this file.
var _SSHActionCloneNeedsRegeneration = SSHAction ( struct {
2023-06-09 01:39:27 +00:00
Message string
Reject bool
Accept bool
SessionDuration time . Duration
AllowAgentForwarding bool
HoldAndDelegate string
AllowLocalPortForwarding bool
AllowRemotePortForwarding bool
Recorders [ ] netip . AddrPort
OnRecordingFailure * SSHRecorderFailureAction
2022-07-27 03:48:38 +00:00
} { } )
// 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
} { } )
2023-06-16 17:04:07 +00:00
// Clone makes a deep copy of Location.
// The result aliases no memory with the original.
func ( src * Location ) Clone ( ) * Location {
if src == nil {
return nil
}
dst := new ( Location )
* dst = * src
return dst
}
// A compilation failure here means this code must be regenerated, with the command at the top of this file.
var _LocationCloneNeedsRegeneration = Location ( struct {
Country string
CountryCode string
City string
CityCode string
2024-02-27 20:02:06 +00:00
Latitude float64
Longitude float64
2023-06-16 17:04:07 +00:00
Priority int
} { } )
2023-07-23 21:48:03 +00:00
// Clone makes a deep copy of UserProfile.
// The result aliases no memory with the original.
func ( src * UserProfile ) Clone ( ) * UserProfile {
if src == nil {
return nil
}
dst := new ( UserProfile )
* dst = * src
return dst
}
// A compilation failure here means this code must be regenerated, with the command at the top of this file.
var _UserProfileCloneNeedsRegeneration = UserProfile ( struct {
ID UserID
LoginName string
DisplayName string
ProfilePicURL string
Roles emptyStructJSONSlice
} { } )
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>,
2023-08-20 03:14:32 +00:00
// where T is one of User,Node,Hostinfo,NetInfo,Login,DNSConfig,RegisterResponse,RegisterResponseAuth,RegisterRequest,DERPHomeParams,DERPRegion,DERPMap,DERPNode,SSHRule,SSHAction,SSHPrincipal,ControlDialPlan,Location,UserProfile.
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
}
2023-08-20 03:14:32 +00:00
case * RegisterResponseAuth :
switch dst := dst . ( type ) {
case * RegisterResponseAuth :
* dst = * src . Clone ( )
return true
case * * RegisterResponseAuth :
* dst = src . Clone ( )
return true
}
case * RegisterRequest :
switch dst := dst . ( type ) {
case * RegisterRequest :
* dst = * src . Clone ( )
return true
case * * RegisterRequest :
* dst = src . Clone ( )
return true
}
2023-07-12 18:45:46 +00:00
case * DERPHomeParams :
switch dst := dst . ( type ) {
case * DERPHomeParams :
* dst = * src . Clone ( )
return true
case * * DERPHomeParams :
* 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
}
2023-03-21 19:59:05 +00:00
case * SSHAction :
switch dst := dst . ( type ) {
case * SSHAction :
* dst = * src . Clone ( )
return true
case * * SSHAction :
* dst = src . Clone ( )
return true
}
2022-07-27 03:48:38 +00:00
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
}
2023-06-16 17:04:07 +00:00
case * Location :
switch dst := dst . ( type ) {
case * Location :
* dst = * src . Clone ( )
return true
case * * Location :
* dst = src . Clone ( )
return true
}
2023-07-23 21:48:03 +00:00
case * UserProfile :
switch dst := dst . ( type ) {
case * UserProfile :
* dst = * src . Clone ( )
return true
case * * UserProfile :
* dst = src . Clone ( )
return true
}
2020-09-04 22:19:54 +00:00
}
return false
}