From f0204098d86c5b90e0d1737eef43aabe6005161a Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Thu, 28 May 2020 10:50:11 -0700 Subject: [PATCH] Revert "control/controlclient: use "getprop net.hostname" for Android hostname" This reverts commit afb9c6a6abc9fa5a26200cc36d1ffc947b8b9e89. Doesn't work. See: https://github.com/tailscale/tailscale/issues/409#issuecomment-635241550 Looks pretty dire: https://medium.com/capital-one-tech/how-to-get-an-android-device-nickname-d5eab12f4ced Updates #409 --- control/controlclient/direct.go | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/control/controlclient/direct.go b/control/controlclient/direct.go index e8dc7d614..626afab87 100644 --- a/control/controlclient/direct.go +++ b/control/controlclient/direct.go @@ -18,9 +18,7 @@ import ( "net/http" "net/url" "os" - "os/exec" "reflect" - "runtime" "strconv" "strings" "sync" @@ -161,13 +159,7 @@ func NewDirect(opts Options) (*Direct, error) { } func NewHostinfo() *tailcfg.Hostinfo { - var hostname string - if runtime.GOOS == "android" { - hostname = androidHostname() - } - if hostname == "" { - hostname, _ = os.Hostname() - } + hostname, _ := os.Hostname() return &tailcfg.Hostinfo{ IPNVersion: version.LONG, Hostname: hostname, @@ -175,20 +167,6 @@ func NewHostinfo() *tailcfg.Hostinfo { } } -var androidHostnameOnce struct { - _ structs.Incomparable - sync.Once - v string -} - -func androidHostname() string { - androidHostnameOnce.Do(func() { - out, _ := exec.Command("getprop", "net.hostname").Output() - androidHostnameOnce.v = strings.TrimSpace(string(out)) - }) - return androidHostnameOnce.v -} - // SetHostinfo clones the provided Hostinfo and remembers it for the // next update. It reports whether the Hostinfo has changed. func (c *Direct) SetHostinfo(hi *tailcfg.Hostinfo) bool {