cmd/tailscale: use hostinfo setters for OSVersion, DeviceModel

Stop abusing Prefs, which bit us in the iOS client. We're going to
remove the ipn.Prefs mechanism.

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
pull/21/head
Brad Fitzpatrick 3 years ago
parent 6518535039
commit a5bed46c9c

@ -29,6 +29,7 @@ import (
"github.com/tailscale/tailscale-android/jni"
"tailscale.com/client/tailscale/apitype"
"tailscale.com/hostinfo"
"tailscale.com/ipn"
"tailscale.com/ipn/ipnlocal"
"tailscale.com/net/dns"
@ -236,6 +237,16 @@ func (a *App) runBackend() error {
fatalErr(err)
}
paths.AppSharedDir.Store(appDir)
hostinfo.SetOSVersion(a.osVersion())
if !googleSignInEnabled() {
hostinfo.SetPackage("nogoogle")
}
deviceModel := a.modelName()
if a.isChromeOS() {
deviceModel = "ChromeOS: " + deviceModel
}
hostinfo.SetDeviceModel(deviceModel)
type configPair struct {
rcfg *router.Config
dcfg *dns.OSConfig
@ -327,12 +338,6 @@ func (a *App) runBackend() error {
state.updateExitNodes()
if first {
state.Prefs.Hostname = a.hostname()
state.Prefs.OSVersion = a.osVersion()
deviceModel := a.modelName()
if a.isChromeOS() {
deviceModel = "ChromeOS: " + deviceModel
}
state.Prefs.DeviceModel = deviceModel
go b.backend.SetPrefs(state.Prefs)
}
a.setPrefs(state.Prefs)
@ -666,9 +671,6 @@ func (a *App) osVersion() string {
if err != nil {
panic(err)
}
if !googleSignInEnabled() {
version += " [nogoogle]"
}
return version
}

@ -10,7 +10,7 @@ require (
golang.org/x/sys v0.0.0-20210906170528-6f6e22806c34
golang.zx2c4.com/wireguard v0.0.0-20210905140043-2ef39d47540c
inet.af/netaddr v0.0.0-20210721214506-ce7a8ad02cc1
tailscale.com v1.1.1-0.20211001231602-babd163aacf4
tailscale.com v1.1.1-0.20211005220235-67e5fabdbdba
)
require (

@ -1011,5 +1011,5 @@ sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
software.sslmate.com/src/go-pkcs12 v0.0.0-20180114231543-2291e8f0f237 h1:iAEkCBPbRaflBgZ7o9gjVUuWuvWeV4sytFWg9o+Pj2k=
software.sslmate.com/src/go-pkcs12 v0.0.0-20180114231543-2291e8f0f237/go.mod h1:/xvNRWUqm0+/ZMiF4EX00vrSCMsE4/NHb+Pt3freEeQ=
sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU=
tailscale.com v1.1.1-0.20211001231602-babd163aacf4 h1:/x69PhUMFDFLXus6eltqWaBoX8zQTyrNtWphXyZF8Is=
tailscale.com v1.1.1-0.20211001231602-babd163aacf4/go.mod h1:2ordBMiDa1Gx6r8ci5EtSS3Wl0RanS46+l8T2vwqUtI=
tailscale.com v1.1.1-0.20211005220235-67e5fabdbdba h1:szGUzQIThyKAKJDxXuL5lgUmEU4hzWUW+noas/MYD8M=
tailscale.com v1.1.1-0.20211005220235-67e5fabdbdba/go.mod h1:2ordBMiDa1Gx6r8ci5EtSS3Wl0RanS46+l8T2vwqUtI=

Loading…
Cancel
Save