mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-26 03:25:35 +00:00
97693f2e42
Instead of using the legacy codepath, teach discoEndpoint to handle peers that have a home DERP, but no disco key. We can still communicate with them, but only over DERP. Signed-off-by: David Anderson <danderson@tailscale.com>
81 lines
2.1 KiB
Go
81 lines
2.1 KiB
Go
// 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.
|
|
|
|
// Code generated by tailscale.com/cmd/cloner -type Config,Peer,Endpoints; DO NOT EDIT.
|
|
|
|
package wgcfg
|
|
|
|
import (
|
|
"inet.af/netaddr"
|
|
"tailscale.com/tailcfg"
|
|
"tailscale.com/types/wgkey"
|
|
)
|
|
|
|
// 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
|
|
}
|
|
|
|
// A compilation failure here means this code must be regenerated, with command:
|
|
// tailscale.com/cmd/cloner -type Config,Peer,Endpoints
|
|
var _ConfigNeedsRegeneration = Config(struct {
|
|
Name string
|
|
PrivateKey wgkey.Private
|
|
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
|
|
}
|
|
|
|
// A compilation failure here means this code must be regenerated, with command:
|
|
// tailscale.com/cmd/cloner -type Config,Peer,Endpoints
|
|
var _PeerNeedsRegeneration = Peer(struct {
|
|
PublicKey wgkey.Key
|
|
AllowedIPs []netaddr.IPPrefix
|
|
Endpoints Endpoints
|
|
PersistentKeepalive uint16
|
|
}{})
|
|
|
|
// Clone makes a deep copy of Endpoints.
|
|
// The result aliases no memory with the original.
|
|
func (src *Endpoints) Clone() *Endpoints {
|
|
if src == nil {
|
|
return nil
|
|
}
|
|
dst := new(Endpoints)
|
|
*dst = *src
|
|
return dst
|
|
}
|
|
|
|
// A compilation failure here means this code must be regenerated, with command:
|
|
// tailscale.com/cmd/cloner -type Config,Peer,Endpoints
|
|
var _EndpointsNeedsRegeneration = Endpoints(struct {
|
|
PublicKey wgkey.Key
|
|
DiscoKey tailcfg.DiscoKey
|
|
}{})
|