From adfe8cf41d0f010cdfc104113eb5a41dd6af20ba Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Thu, 20 May 2021 14:33:49 +0200 Subject: [PATCH] paths: generalize IOSSharedDir to cover Android Also fix an error message while here. Signed-off-by: Elias Naur --- ipn/ipnlocal/local.go | 7 ++++--- paths/paths.go | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ipn/ipnlocal/local.go b/ipn/ipnlocal/local.go index 9b6c565ed..da4600ba3 100644 --- a/ipn/ipnlocal/local.go +++ b/ipn/ipnlocal/local.go @@ -1821,8 +1821,9 @@ func parseResolver(cfg tailcfg.DNSResolver) (netaddr.IPPort, error) { // tailscaleVarRoot returns the root directory of Tailscale's writable // storage area. (e.g. "/var/lib/tailscale") func tailscaleVarRoot() string { - if runtime.GOOS == "ios" { - dir, _ := paths.IOSSharedDir.Load().(string) + switch runtime.GOOS { + case "ios", "android": + dir, _ := paths.AppSharedDir.Load().(string) return dir } stateFile := paths.DefaultTailscaledStateFile() @@ -1926,7 +1927,7 @@ func (b *LocalBackend) initPeerAPIListener() { // ("peerAPIListeners too low"). continue } - b.logf("[unexpected] peerapi listen(%q) error: %v", a.IP, err) + b.logf("[unexpected] peerapi listen(%q) error: %v", a.IP(), err) continue } } diff --git a/paths/paths.go b/paths/paths.go index 677b8f8d3..8e437a4f0 100644 --- a/paths/paths.go +++ b/paths/paths.go @@ -13,9 +13,9 @@ import ( "sync/atomic" ) -// IOSSharedDir is a string set by the iOS app on start +// AppSharedDir is a string set by the iOS or Android app on start // containing a directory we can read/write in. -var IOSSharedDir atomic.Value +var AppSharedDir atomic.Value // DefaultTailscaledSocket returns the path to the tailscaled Unix socket // or the empty string if there's no reasonable default.