@ -36,6 +36,7 @@ func New() *tailcfg.Hostinfo {
return & tailcfg . Hostinfo {
return & tailcfg . Hostinfo {
IPNVersion : version . Long ( ) ,
IPNVersion : version . Long ( ) ,
Hostname : hostname ,
Hostname : hostname ,
App : appTypeCached ( ) ,
OS : version . OS ( ) ,
OS : version . OS ( ) ,
OSVersion : GetOSVersion ( ) ,
OSVersion : GetOSVersion ( ) ,
Container : lazyInContainer . Get ( ) ,
Container : lazyInContainer . Get ( ) ,
@ -112,6 +113,13 @@ func GetOSVersion() string {
return ""
return ""
}
}
func appTypeCached ( ) string {
if v , ok := appType . Load ( ) . ( string ) ; ok {
return v
}
return ""
}
func packageTypeCached ( ) string {
func packageTypeCached ( ) string {
if v , _ := packagingType . Load ( ) . ( string ) ; v != "" {
if v , _ := packagingType . Load ( ) . ( string ) ; v != "" {
return v
return v
@ -159,6 +167,7 @@ var (
osVersionAtomic atomic . Value // of string
osVersionAtomic atomic . Value // of string
desktopAtomic atomic . Value // of opt.Bool
desktopAtomic atomic . Value // of opt.Bool
packagingType atomic . Value // of string
packagingType atomic . Value // of string
appType atomic . Value // of string
)
)
// SetPushDeviceToken sets the device token for use in Hostinfo updates.
// 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").
// F-Droid build) and tsnet (set to "tsnet").
func SetPackage ( v string ) { packagingType . Store ( v ) }
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 {
func deviceModel ( ) string {
s , _ := deviceModelAtomic . Load ( ) . ( string )
s , _ := deviceModelAtomic . Load ( ) . ( string )
return s
return s