tailcfg, ipn/ipnlocal: add Hostinfo.SSH_HostKeys, send when SSH enabled
(The name SSH_HostKeys is bad but SSHHostKeys is worse.) Updates #3802 Change-Id: I2a889019c9e8b065b668dd58140db4fcab868a91 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
committed by
Brad Fitzpatrick
parent
4609096271
commit
bb93e29d5c
@@ -454,6 +454,7 @@ type Hostinfo struct {
|
||||
RequestTags []string `json:",omitempty"` // set of ACL tags this node wants to claim
|
||||
Services []Service `json:",omitempty"` // services advertised by this machine
|
||||
NetInfo *NetInfo `json:",omitempty"`
|
||||
SSH_HostKeys []string `json:"sshHostKeys,omitempty"` // if advertised
|
||||
|
||||
// NOTE: any new fields containing pointers in this type
|
||||
// require changes to Hostinfo.Equal.
|
||||
@@ -516,6 +517,10 @@ func (v HostinfoView) RequestTags() views.StringSlice {
|
||||
return views.StringSliceOf(v.ж.RequestTags)
|
||||
}
|
||||
|
||||
func (v HostinfoView) SSH_HostKeys() views.StringSlice {
|
||||
return views.StringSliceOf(v.ж.SSH_HostKeys)
|
||||
}
|
||||
|
||||
func (v HostinfoView) Services() ServiceSlice {
|
||||
return ServiceSliceOf(v.ж.Services)
|
||||
}
|
||||
|
||||
@@ -106,6 +106,7 @@ func (src *Hostinfo) Clone() *Hostinfo {
|
||||
dst.RequestTags = append(src.RequestTags[:0:0], src.RequestTags...)
|
||||
dst.Services = append(src.Services[:0:0], src.Services...)
|
||||
dst.NetInfo = src.NetInfo.Clone()
|
||||
dst.SSH_HostKeys = append(src.SSH_HostKeys[:0:0], src.SSH_HostKeys...)
|
||||
return dst
|
||||
}
|
||||
|
||||
@@ -126,6 +127,7 @@ var _HostinfoCloneNeedsRegeneration = Hostinfo(struct {
|
||||
RequestTags []string
|
||||
Services []Service
|
||||
NetInfo *NetInfo
|
||||
SSH_HostKeys []string
|
||||
}{})
|
||||
|
||||
// Clone makes a deep copy of NetInfo.
|
||||
|
||||
@@ -32,7 +32,7 @@ func TestHostinfoEqual(t *testing.T) {
|
||||
"ShieldsUp", "ShareeNode",
|
||||
"GoArch",
|
||||
"RoutableIPs", "RequestTags",
|
||||
"Services", "NetInfo",
|
||||
"Services", "NetInfo", "SSH_HostKeys",
|
||||
}
|
||||
if have := fieldsOf(reflect.TypeOf(Hostinfo{})); !reflect.DeepEqual(have, hiHandles) {
|
||||
t.Errorf("Hostinfo.Equal check might be out of sync\nfields: %q\nhandled: %q\n",
|
||||
@@ -181,6 +181,11 @@ func TestHostinfoEqual(t *testing.T) {
|
||||
&Hostinfo{},
|
||||
false,
|
||||
},
|
||||
{
|
||||
&Hostinfo{SSH_HostKeys: []string{"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO.... root@bar"}},
|
||||
&Hostinfo{},
|
||||
false,
|
||||
},
|
||||
}
|
||||
for i, tt := range tests {
|
||||
got := tt.a.Equal(tt.b)
|
||||
|
||||
Reference in New Issue
Block a user