|
|
@ -52,7 +52,7 @@ func New() *tailcfg.Hostinfo {
|
|
|
|
GoArchVar: lazyGoArchVar.Get(),
|
|
|
|
GoArchVar: lazyGoArchVar.Get(),
|
|
|
|
GoVersion: runtime.Version(),
|
|
|
|
GoVersion: runtime.Version(),
|
|
|
|
Machine: condCall(unameMachine),
|
|
|
|
Machine: condCall(unameMachine),
|
|
|
|
DeviceModel: deviceModel(),
|
|
|
|
DeviceModel: deviceModelCached(),
|
|
|
|
Cloud: string(cloudenv.Get()),
|
|
|
|
Cloud: string(cloudenv.Get()),
|
|
|
|
NoLogsNoSupport: envknob.NoLogsNoSupport(),
|
|
|
|
NoLogsNoSupport: envknob.NoLogsNoSupport(),
|
|
|
|
AllowsUpdate: envknob.AllowsRemoteUpdate(),
|
|
|
|
AllowsUpdate: envknob.AllowsRemoteUpdate(),
|
|
|
@ -68,6 +68,7 @@ var (
|
|
|
|
distroVersion func() string
|
|
|
|
distroVersion func() string
|
|
|
|
distroCodeName func() string
|
|
|
|
distroCodeName func() string
|
|
|
|
unameMachine func() string
|
|
|
|
unameMachine func() string
|
|
|
|
|
|
|
|
deviceModel func() string
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
func condCall[T any](fn func() T) T {
|
|
|
|
func condCall[T any](fn func() T) T {
|
|
|
@ -176,6 +177,20 @@ var (
|
|
|
|
// SetDeviceModel sets the device model for use in Hostinfo updates.
|
|
|
|
// SetDeviceModel sets the device model for use in Hostinfo updates.
|
|
|
|
func SetDeviceModel(model string) { deviceModelAtomic.Store(model) }
|
|
|
|
func SetDeviceModel(model string) { deviceModelAtomic.Store(model) }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func deviceModelCached() string {
|
|
|
|
|
|
|
|
if v, _ := deviceModelAtomic.Load().(string); v != "" {
|
|
|
|
|
|
|
|
return v
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if deviceModel == nil {
|
|
|
|
|
|
|
|
return ""
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
v := deviceModel()
|
|
|
|
|
|
|
|
if v != "" {
|
|
|
|
|
|
|
|
deviceModelAtomic.Store(v)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return v
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// SetOSVersion sets the OS version.
|
|
|
|
// SetOSVersion sets the OS version.
|
|
|
|
func SetOSVersion(v string) { osVersionAtomic.Store(v) }
|
|
|
|
func SetOSVersion(v string) { osVersionAtomic.Store(v) }
|
|
|
|
|
|
|
|
|
|
|
@ -193,11 +208,6 @@ func SetPackage(v string) { packagingType.Store(v) }
|
|
|
|
// and "k8s-operator".
|
|
|
|
// and "k8s-operator".
|
|
|
|
func SetApp(v string) { appType.Store(v) }
|
|
|
|
func SetApp(v string) { appType.Store(v) }
|
|
|
|
|
|
|
|
|
|
|
|
func deviceModel() string {
|
|
|
|
|
|
|
|
s, _ := deviceModelAtomic.Load().(string)
|
|
|
|
|
|
|
|
return s
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// FirewallMode returns the firewall mode for the app.
|
|
|
|
// FirewallMode returns the firewall mode for the app.
|
|
|
|
// It is empty if unset.
|
|
|
|
// It is empty if unset.
|
|
|
|
func FirewallMode() string {
|
|
|
|
func FirewallMode() string {
|
|
|
|