version: move runtime.OS to tailscale OS mapping func to version

So other code can use this without duplicating the policy.
This commit is contained in:
Brad Fitzpatrick
2020-04-01 08:49:25 -07:00
parent c14bc028ac
commit 4524dcf51e
2 changed files with 13 additions and 16 deletions
+12
View File
@@ -13,3 +13,15 @@ func IsMobile() bool {
return runtime.GOOS == "android" ||
(runtime.GOOS == "darwin" && (runtime.GOARCH == "arm" || runtime.GOARCH == "arm64"))
}
// OS returns runtime.GOOS, except instead of returning "darwin" it
// returns "iOS" or "macOS".
func OS() string {
if runtime.GOOS == "darwin" {
if IsMobile() {
return "iOS"
}
return "macOS"
}
return runtime.GOOS
}