mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-11 13:18:53 +00:00
tailcfg, localapi: plumb device token to server
Updates tailscale/corp#8940 Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
This commit is contained in:

committed by
David Crawshaw

parent
38b32be926
commit
8cf2805cca
@@ -50,6 +50,7 @@ func New() *tailcfg.Hostinfo {
|
||||
GoVersion: runtime.Version(),
|
||||
Machine: condCall(unameMachine),
|
||||
DeviceModel: deviceModel(),
|
||||
PushDeviceToken: pushDeviceToken(),
|
||||
Cloud: string(cloudenv.Get()),
|
||||
NoLogsNoSupport: envknob.NoLogsNoSupport(),
|
||||
AllowsUpdate: envknob.AllowsRemoteUpdate(),
|
||||
@@ -153,12 +154,16 @@ func GetEnvType() EnvType {
|
||||
}
|
||||
|
||||
var (
|
||||
deviceModelAtomic atomic.Value // of string
|
||||
osVersionAtomic atomic.Value // of string
|
||||
desktopAtomic atomic.Value // of opt.Bool
|
||||
packagingType atomic.Value // of string
|
||||
pushDeviceTokenAtomic atomic.Value // of string
|
||||
deviceModelAtomic atomic.Value // of string
|
||||
osVersionAtomic atomic.Value // of string
|
||||
desktopAtomic atomic.Value // of opt.Bool
|
||||
packagingType atomic.Value // of string
|
||||
)
|
||||
|
||||
// SetPushDeviceToken sets the device token for use in Hostinfo updates.
|
||||
func SetPushDeviceToken(token string) { pushDeviceTokenAtomic.Store(token) }
|
||||
|
||||
// SetDeviceModel sets the device model for use in Hostinfo updates.
|
||||
func SetDeviceModel(model string) { deviceModelAtomic.Store(model) }
|
||||
|
||||
@@ -176,6 +181,11 @@ func deviceModel() string {
|
||||
return s
|
||||
}
|
||||
|
||||
func pushDeviceToken() string {
|
||||
s, _ := pushDeviceTokenAtomic.Load().(string)
|
||||
return s
|
||||
}
|
||||
|
||||
func desktop() (ret opt.Bool) {
|
||||
if runtime.GOOS != "linux" {
|
||||
return opt.Bool("")
|
||||
|
Reference in New Issue
Block a user