Files
tailscale/hostinfo/hostinfo_darwin.go
Brad Fitzpatrick 2a64c03c95 types/ptr: deprecate ptr.To, use Go 1.26 new
Updates #18682

Change-Id: I62f6aa0de2a15ef8c1435032c6aa74a181c25f8f
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2026-03-05 20:13:18 -08:00

38 lines
670 B
Go

// Copyright (c) Tailscale Inc & contributors
// SPDX-License-Identifier: BSD-3-Clause
//go:build darwin
package hostinfo
import (
"os"
"path/filepath"
"golang.org/x/sys/unix"
)
func init() {
osVersion = lazyOSVersion.Get
packageType = packageTypeDarwin
}
var (
lazyOSVersion = &lazyAtomicValue[string]{f: new(osVersionDarwin)}
)
func packageTypeDarwin() string {
// Using tailscaled or IPNExtension?
exe, _ := os.Executable()
return filepath.Base(exe)
}
// Returns the marketing version (e.g., "15.0.1" or "26.0.0")
func osVersionDarwin() string {
version, err := unix.Sysctl("kern.osproductversion")
if err != nil {
return ""
}
return version
}