tailcfg: add Hostinfo.GoVersion

So next time something like #5340 happens we can identify all affected
nodes and have the control plane send them health warnings.

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
pull/5457/head
Brad Fitzpatrick 2 years ago committed by Brad Fitzpatrick
parent 214242ff62
commit f1c9812188

@ -38,6 +38,7 @@ func New() *tailcfg.Hostinfo {
Desktop: desktop(), Desktop: desktop(),
Package: packageTypeCached(), Package: packageTypeCached(),
GoArch: runtime.GOARCH, GoArch: runtime.GOARCH,
GoVersion: runtime.Version(),
DeviceModel: deviceModel(), DeviceModel: deviceModel(),
Cloud: string(cloudenv.Get()), Cloud: string(cloudenv.Get()),
} }

@ -476,6 +476,7 @@ type Hostinfo struct {
ShieldsUp bool `json:",omitempty"` // indicates whether the host is blocking incoming connections ShieldsUp bool `json:",omitempty"` // indicates whether the host is blocking incoming connections
ShareeNode bool `json:",omitempty"` // indicates this node exists in netmap because it's owned by a shared-to user ShareeNode bool `json:",omitempty"` // indicates this node exists in netmap because it's owned by a shared-to user
GoArch string `json:",omitempty"` // the host's GOARCH value (of the running binary) GoArch string `json:",omitempty"` // the host's GOARCH value (of the running binary)
GoVersion string `json:",omitempty"` // Go version binary was built with
RoutableIPs []netip.Prefix `json:",omitempty"` // set of IP ranges this client can route RoutableIPs []netip.Prefix `json:",omitempty"` // set of IP ranges this client can route
RequestTags []string `json:",omitempty"` // set of ACL tags this node wants to claim RequestTags []string `json:",omitempty"` // set of ACL tags this node wants to claim
Services []Service `json:",omitempty"` // services advertised by this machine Services []Service `json:",omitempty"` // services advertised by this machine

@ -127,6 +127,7 @@ var _HostinfoCloneNeedsRegeneration = Hostinfo(struct {
ShieldsUp bool ShieldsUp bool
ShareeNode bool ShareeNode bool
GoArch string GoArch string
GoVersion string
RoutableIPs []netip.Prefix RoutableIPs []netip.Prefix
RequestTags []string RequestTags []string
Services []Service Services []Service

@ -34,7 +34,7 @@ func TestHostinfoEqual(t *testing.T) {
"IPNVersion", "FrontendLogID", "BackendLogID", "IPNVersion", "FrontendLogID", "BackendLogID",
"OS", "OSVersion", "Desktop", "Package", "DeviceModel", "Hostname", "OS", "OSVersion", "Desktop", "Package", "DeviceModel", "Hostname",
"ShieldsUp", "ShareeNode", "ShieldsUp", "ShareeNode",
"GoArch", "GoArch", "GoVersion",
"RoutableIPs", "RequestTags", "RoutableIPs", "RequestTags",
"Services", "NetInfo", "SSH_HostKeys", "Cloud", "Services", "NetInfo", "SSH_HostKeys", "Cloud",
} }

@ -262,6 +262,7 @@ func (v HostinfoView) Hostname() string { return v.ж.Hostname }
func (v HostinfoView) ShieldsUp() bool { return v.ж.ShieldsUp } func (v HostinfoView) ShieldsUp() bool { return v.ж.ShieldsUp }
func (v HostinfoView) ShareeNode() bool { return v.ж.ShareeNode } func (v HostinfoView) ShareeNode() bool { return v.ж.ShareeNode }
func (v HostinfoView) GoArch() string { return v.ж.GoArch } func (v HostinfoView) GoArch() string { return v.ж.GoArch }
func (v HostinfoView) GoVersion() string { return v.ж.GoVersion }
func (v HostinfoView) RoutableIPs() views.IPPrefixSlice { func (v HostinfoView) RoutableIPs() views.IPPrefixSlice {
return views.IPPrefixSliceOf(v.ж.RoutableIPs) return views.IPPrefixSliceOf(v.ж.RoutableIPs)
} }
@ -286,6 +287,7 @@ var _HostinfoViewNeedsRegeneration = Hostinfo(struct {
ShieldsUp bool ShieldsUp bool
ShareeNode bool ShareeNode bool
GoArch string GoArch string
GoVersion string
RoutableIPs []netip.Prefix RoutableIPs []netip.Prefix
RequestTags []string RequestTags []string
Services []Service Services []Service

Loading…
Cancel
Save