summaryrefslogtreecommitdiffhomepage
path: root/version/prop.go
blob: f13aa8ff47aca2d5b4abb132e1615a3ba4f580f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Copyright (c) 2020 Tailscale Inc & AUTHORS All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package version

import "runtime"

// IsMobile reports whether this is a mobile client build.
func IsMobile() bool {
	// Good enough heuristic for now, at least until Apple makes
	// ARM laptops...
	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
}