mirror of
https://github.com/tailscale/tailscale.git
synced 2025-10-09 16:11:23 +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:
@@ -36,6 +36,7 @@ func New() *tailcfg.Hostinfo {
|
||||
return &tailcfg.Hostinfo{
|
||||
IPNVersion: version.Long(),
|
||||
Hostname: hostname,
|
||||
App: appTypeCached(),
|
||||
OS: version.OS(),
|
||||
OSVersion: GetOSVersion(),
|
||||
Container: lazyInContainer.Get(),
|
||||
@@ -112,6 +113,13 @@ func GetOSVersion() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func appTypeCached() string {
|
||||
if v, ok := appType.Load().(string); ok {
|
||||
return v
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func packageTypeCached() string {
|
||||
if v, _ := packagingType.Load().(string); v != "" {
|
||||
return v
|
||||
@@ -159,6 +167,7 @@ var (
|
||||
osVersionAtomic atomic.Value // of string
|
||||
desktopAtomic atomic.Value // of opt.Bool
|
||||
packagingType atomic.Value // of string
|
||||
appType atomic.Value // of string
|
||||
)
|
||||
|
||||
// SetPushDeviceToken sets the device token for use in Hostinfo updates.
|
||||
@@ -176,6 +185,11 @@ func SetOSVersion(v string) { osVersionAtomic.Store(v) }
|
||||
// F-Droid build) and tsnet (set to "tsnet").
|
||||
func SetPackage(v string) { packagingType.Store(v) }
|
||||
|
||||
// SetApp sets the app type for the app.
|
||||
// It is used by tsnet to specify what app is using it such as "golinks"
|
||||
// and "k8s-operator".
|
||||
func SetApp(v string) { appType.Store(v) }
|
||||
|
||||
func deviceModel() string {
|
||||
s, _ := deviceModelAtomic.Load().(string)
|
||||
return s
|
||||
|
Reference in New Issue
Block a user