mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-11 21:27:31 +00:00
tailcfg,hostinfo: add App field to identify tsnet uses
This allows us to differentiate between the various tsnet apps that we have like `golinks` and `k8s-operator`. Signed-off-by: Maisem Ali <maisem@tailscale.com>
This commit is contained in:
@@ -522,6 +522,9 @@ type Hostinfo struct {
|
||||
DistroVersion string `json:",omitempty"` // "20.04", ...
|
||||
DistroCodeName string `json:",omitempty"` // "jammy", "bullseye", ...
|
||||
|
||||
// App is used to disambiguate Tailscale clients that run using tsnet.
|
||||
App string `json:",omitempty"` // "k8s-operator", "golinks", ...
|
||||
|
||||
Desktop opt.Bool `json:",omitempty"` // if a desktop was detected on Linux
|
||||
Package string `json:",omitempty"` // Tailscale package to disambiguate ("choco", "appstore", etc; "" for unknown)
|
||||
DeviceModel string `json:",omitempty"` // mobile phone model ("Pixel 3a", "iPhone12,3")
|
||||
|
@@ -128,6 +128,7 @@ var _HostinfoCloneNeedsRegeneration = Hostinfo(struct {
|
||||
Distro string
|
||||
DistroVersion string
|
||||
DistroCodeName string
|
||||
App string
|
||||
Desktop opt.Bool
|
||||
Package string
|
||||
DeviceModel string
|
||||
|
@@ -41,6 +41,7 @@ func TestHostinfoEqual(t *testing.T) {
|
||||
"Distro",
|
||||
"DistroVersion",
|
||||
"DistroCodeName",
|
||||
"App",
|
||||
"Desktop",
|
||||
"Package",
|
||||
"DeviceModel",
|
||||
@@ -216,6 +217,16 @@ func TestHostinfoEqual(t *testing.T) {
|
||||
&Hostinfo{},
|
||||
false,
|
||||
},
|
||||
{
|
||||
&Hostinfo{App: "golink"},
|
||||
&Hostinfo{App: "abc"},
|
||||
false,
|
||||
},
|
||||
{
|
||||
&Hostinfo{App: "golink"},
|
||||
&Hostinfo{App: "golink"},
|
||||
true,
|
||||
},
|
||||
}
|
||||
for i, tt := range tests {
|
||||
got := tt.a.Equal(tt.b)
|
||||
|
@@ -267,6 +267,7 @@ func (v HostinfoView) Env() string { return v.ж.Env }
|
||||
func (v HostinfoView) Distro() string { return v.ж.Distro }
|
||||
func (v HostinfoView) DistroVersion() string { return v.ж.DistroVersion }
|
||||
func (v HostinfoView) DistroCodeName() string { return v.ж.DistroCodeName }
|
||||
func (v HostinfoView) App() string { return v.ж.App }
|
||||
func (v HostinfoView) Desktop() opt.Bool { return v.ж.Desktop }
|
||||
func (v HostinfoView) Package() string { return v.ж.Package }
|
||||
func (v HostinfoView) DeviceModel() string { return v.ж.DeviceModel }
|
||||
@@ -305,6 +306,7 @@ var _HostinfoViewNeedsRegeneration = Hostinfo(struct {
|
||||
Distro string
|
||||
DistroVersion string
|
||||
DistroCodeName string
|
||||
App string
|
||||
Desktop opt.Bool
|
||||
Package string
|
||||
DeviceModel string
|
||||
|
Reference in New Issue
Block a user