mirror of
https://github.com/tailscale/tailscale.git
synced 2024-12-01 22:15:51 +00:00
ec4feaf31c
Also use go:generate and https://golang.org/s/generatedcode header style. Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
76 lines
1.9 KiB
Go
76 lines
1.9 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 User,Node,Hostinfo,NetInfo; DO NOT EDIT.
|
|
|
|
package tailcfg
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
// 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
|
|
dst.Logins = append(src.Logins[:0:0], src.Logins...)
|
|
dst.Roles = append(src.Roles[:0:0], src.Roles...)
|
|
return dst
|
|
}
|
|
|
|
// 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
|
|
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...)
|
|
dst.Hostinfo = *src.Hostinfo.Clone()
|
|
if dst.LastSeen != nil {
|
|
dst.LastSeen = new(time.Time)
|
|
*dst.LastSeen = *src.LastSeen
|
|
}
|
|
return dst
|
|
}
|
|
|
|
// 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()
|
|
return dst
|
|
}
|
|
|
|
// 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
|
|
}
|