tailcfg: add views for ControlDialPlan (#5843)
This commit is contained in:
@@ -398,9 +398,26 @@ var _SSHPrincipalCloneNeedsRegeneration = SSHPrincipal(struct {
|
||||
PubKeys []string
|
||||
}{})
|
||||
|
||||
// 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
|
||||
}{})
|
||||
|
||||
// Clone duplicates src into dst and reports whether it succeeded.
|
||||
// To succeed, <src, dst> must be of types <*T, *T> or <*T, **T>,
|
||||
// where T is one of User,Node,Hostinfo,NetInfo,Login,DNSConfig,RegisterResponse,DERPRegion,DERPMap,DERPNode,SSHRule,SSHPrincipal.
|
||||
// where T is one of User,Node,Hostinfo,NetInfo,Login,DNSConfig,RegisterResponse,DERPRegion,DERPMap,DERPNode,SSHRule,SSHPrincipal,ControlDialPlan.
|
||||
func Clone(dst, src any) bool {
|
||||
switch src := src.(type) {
|
||||
case *User:
|
||||
@@ -511,6 +528,15 @@ func Clone(dst, src any) bool {
|
||||
*dst = src.Clone()
|
||||
return true
|
||||
}
|
||||
case *ControlDialPlan:
|
||||
switch dst := dst.(type) {
|
||||
case *ControlDialPlan:
|
||||
*dst = *src.Clone()
|
||||
return true
|
||||
case **ControlDialPlan:
|
||||
*dst = src.Clone()
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user