mirror of https://github.com/tailscale/tailscale/
ipn: use cmd/cloner for Prefs.Clone
Also, make cmd/cloner's top-level "func Clone" generation opt-in. Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>reviewable/pr836/r1
parent
6cc6e251a9
commit
7c8ca28c74
@ -0,0 +1,51 @@
|
|||||||
|
// 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 Prefs; DO NOT EDIT.
|
||||||
|
|
||||||
|
package ipn
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/tailscale/wireguard-go/wgcfg"
|
||||||
|
"tailscale.com/control/controlclient"
|
||||||
|
"tailscale.com/wgengine/router"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Clone makes a deep copy of Prefs.
|
||||||
|
// The result aliases no memory with the original.
|
||||||
|
func (src *Prefs) Clone() *Prefs {
|
||||||
|
if src == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
dst := new(Prefs)
|
||||||
|
*dst = *src
|
||||||
|
dst.AdvertiseTags = append(src.AdvertiseTags[:0:0], src.AdvertiseTags...)
|
||||||
|
dst.AdvertiseRoutes = append(src.AdvertiseRoutes[:0:0], src.AdvertiseRoutes...)
|
||||||
|
if dst.Persist != nil {
|
||||||
|
dst.Persist = new(controlclient.Persist)
|
||||||
|
*dst.Persist = *src.Persist
|
||||||
|
}
|
||||||
|
return dst
|
||||||
|
}
|
||||||
|
|
||||||
|
// A compilation failure here means this code must be regenerated, with command:
|
||||||
|
// tailscale.com/cmd/cloner -type Prefs
|
||||||
|
var _PrefsNeedsRegeneration = Prefs(struct {
|
||||||
|
ControlURL string
|
||||||
|
RouteAll bool
|
||||||
|
AllowSingleHosts bool
|
||||||
|
CorpDNS bool
|
||||||
|
WantRunning bool
|
||||||
|
ShieldsUp bool
|
||||||
|
AdvertiseTags []string
|
||||||
|
Hostname string
|
||||||
|
OSVersion string
|
||||||
|
DeviceModel string
|
||||||
|
NotepadURLs bool
|
||||||
|
ForceDaemon bool
|
||||||
|
AdvertiseRoutes []wgcfg.CIDR
|
||||||
|
NoSNAT bool
|
||||||
|
NetfilterMode router.NetfilterMode
|
||||||
|
Persist *controlclient.Persist
|
||||||
|
}{})
|
Loading…
Reference in New Issue