2021-04-30 22:34:03 +00:00
|
|
|
// Copyright (c) 2020 Tailscale Inc & AUTHORS All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
2021-10-14 19:51:28 +00:00
|
|
|
// Code generated by tailscale.com/cmd/cloner; DO NOT EDIT.
|
|
|
|
//go:generate go run tailscale.com/cmd/cloner -type=Config,Peer -output=clone.go
|
2021-04-30 22:34:03 +00:00
|
|
|
|
|
|
|
package wgcfg
|
|
|
|
|
|
|
|
import (
|
|
|
|
"inet.af/netaddr"
|
2021-04-30 23:45:36 +00:00
|
|
|
"tailscale.com/tailcfg"
|
2021-10-28 00:42:33 +00:00
|
|
|
"tailscale.com/types/key"
|
2021-04-30 22:34:03 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// Clone makes a deep copy of Config.
|
|
|
|
// The result aliases no memory with the original.
|
|
|
|
func (src *Config) Clone() *Config {
|
|
|
|
if src == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
dst := new(Config)
|
|
|
|
*dst = *src
|
|
|
|
dst.Addresses = append(src.Addresses[:0:0], src.Addresses...)
|
|
|
|
dst.DNS = append(src.DNS[:0:0], src.DNS...)
|
|
|
|
dst.Peers = make([]Peer, len(src.Peers))
|
|
|
|
for i := range dst.Peers {
|
|
|
|
dst.Peers[i] = *src.Peers[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 _ConfigCloneNeedsRegeneration = Config(struct {
|
2021-04-30 22:34:03 +00:00
|
|
|
Name string
|
2021-10-28 00:42:33 +00:00
|
|
|
PrivateKey key.NodePrivate
|
2021-04-30 22:34:03 +00:00
|
|
|
Addresses []netaddr.IPPrefix
|
|
|
|
MTU uint16
|
|
|
|
DNS []netaddr.IP
|
|
|
|
Peers []Peer
|
|
|
|
}{})
|
|
|
|
|
|
|
|
// Clone makes a deep copy of Peer.
|
|
|
|
// The result aliases no memory with the original.
|
|
|
|
func (src *Peer) Clone() *Peer {
|
|
|
|
if src == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
dst := new(Peer)
|
|
|
|
*dst = *src
|
|
|
|
dst.AllowedIPs = append(src.AllowedIPs[:0:0], src.AllowedIPs...)
|
|
|
|
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 _PeerCloneNeedsRegeneration = Peer(struct {
|
2021-10-28 00:42:33 +00:00
|
|
|
PublicKey key.NodePublic
|
2021-09-01 05:37:23 +00:00
|
|
|
DiscoKey tailcfg.DiscoKey
|
2021-04-30 22:34:03 +00:00
|
|
|
AllowedIPs []netaddr.IPPrefix
|
|
|
|
PersistentKeepalive uint16
|
|
|
|
}{})
|