Update dependencies

This commit is contained in:
bluepython508
2025-04-09 01:00:12 +01:00
parent f0641ffd6e
commit 5a9cfc022c
882 changed files with 68930 additions and 24201 deletions

View File

@@ -6,13 +6,12 @@ package distro
import (
"bytes"
"io"
"os"
"runtime"
"strconv"
"tailscale.com/types/lazy"
"tailscale.com/util/lineread"
"tailscale.com/util/lineiter"
)
type Distro string
@@ -31,6 +30,7 @@ const (
WDMyCloud = Distro("wdmycloud")
Unraid = Distro("unraid")
Alpine = Distro("alpine")
UBNT = Distro("ubnt") // Ubiquiti Networks
)
var distro lazy.SyncValue[Distro]
@@ -76,6 +76,12 @@ func linuxDistro() Distro {
case have("/usr/local/bin/freenas-debug"):
// TrueNAS Scale runs on debian
return TrueNAS
case have("/usr/bin/ubnt-device-info"):
// UBNT runs on Debian-based systems. This MUST be checked before Debian.
//
// Currently supported product families:
// - UDM (UniFi Dream Machine, UDM-Pro)
return UBNT
case have("/etc/debian_version"):
return Debian
case have("/etc/arch-release"):
@@ -132,18 +138,19 @@ func DSMVersion() int {
return v
}
// But when run from the command line, we have to read it from the file:
lineread.File("/etc/VERSION", func(line []byte) error {
for lr := range lineiter.File("/etc/VERSION") {
line, err := lr.Value()
if err != nil {
break // but otherwise ignore
}
line = bytes.TrimSpace(line)
if string(line) == `majorversion="7"` {
v = 7
return io.EOF
return 7
}
if string(line) == `majorversion="6"` {
v = 6
return io.EOF
return 6
}
return nil
})
return v
}
return 0
})
}

View File

@@ -7,11 +7,10 @@ import (
"fmt"
"runtime"
"strings"
"tailscale.com/types/lazy"
"sync"
)
var stringLazy = lazy.SyncFunc(func() string {
var stringLazy = sync.OnceValue(func() string {
var ret strings.Builder
ret.WriteString(Short())
ret.WriteByte('\n')

45
vendor/tailscale.com/version/prop.go generated vendored
View File

@@ -9,6 +9,7 @@ import (
"runtime"
"strconv"
"strings"
"sync"
"tailscale.com/tailcfg"
"tailscale.com/types/lazy"
@@ -61,26 +62,21 @@ func IsSandboxedMacOS() bool {
// Tailscale for macOS, either the main GUI process (non-sandboxed) or the
// system extension (sandboxed).
func IsMacSys() bool {
return IsMacSysExt() || IsMacSysApp()
return IsMacSysExt() || IsMacSysGUI()
}
var isMacSysApp lazy.SyncValue[bool]
// IsMacSysApp reports whether this process is the main, non-sandboxed GUI process
// IsMacSysGUI reports whether this process is the main, non-sandboxed GUI process
// that ships with the Standalone variant of Tailscale for macOS.
func IsMacSysApp() bool {
func IsMacSysGUI() bool {
if runtime.GOOS != "darwin" {
return false
}
return isMacSysApp.Get(func() bool {
exe, err := os.Executable()
if err != nil {
return false
}
// Check that this is the GUI binary, and it is not sandboxed. The GUI binary
// shipped in the App Store will always have the App Sandbox enabled.
return strings.HasSuffix(exe, "/Contents/MacOS/Tailscale") && !IsMacAppStore()
return strings.Contains(os.Getenv("HOME"), "/Containers/io.tailscale.ipn.macsys/") ||
strings.Contains(os.Getenv("XPC_SERVICE_NAME"), "io.tailscale.ipn.macsys")
})
}
@@ -94,10 +90,6 @@ func IsMacSysExt() bool {
return false
}
return isMacSysExt.Get(func() bool {
if strings.Contains(os.Getenv("HOME"), "/Containers/io.tailscale.ipn.macsys/") ||
strings.Contains(os.Getenv("XPC_SERVICE_NAME"), "io.tailscale.ipn.macsys") {
return true
}
exe, err := os.Executable()
if err != nil {
return false
@@ -108,8 +100,8 @@ func IsMacSysExt() bool {
var isMacAppStore lazy.SyncValue[bool]
// IsMacAppStore whether this binary is from the App Store version of Tailscale
// for macOS.
// IsMacAppStore returns whether this binary is from the App Store version of Tailscale
// for macOS. Returns true for both the network extension and the GUI app.
func IsMacAppStore() bool {
if runtime.GOOS != "darwin" {
return false
@@ -123,6 +115,25 @@ func IsMacAppStore() bool {
})
}
var isMacAppStoreGUI lazy.SyncValue[bool]
// IsMacAppStoreGUI reports whether this binary is the GUI app from the App Store
// version of Tailscale for macOS.
func IsMacAppStoreGUI() bool {
if runtime.GOOS != "darwin" {
return false
}
return isMacAppStoreGUI.Get(func() bool {
exe, err := os.Executable()
if err != nil {
return false
}
// Check that this is the GUI binary, and it is not sandboxed. The GUI binary
// shipped in the App Store will always have the App Sandbox enabled.
return strings.Contains(exe, "/Tailscale") && !IsMacSysGUI()
})
}
var isAppleTV lazy.SyncValue[bool]
// IsAppleTV reports whether this binary is part of the Tailscale network extension for tvOS.
@@ -174,7 +185,7 @@ func IsUnstableBuild() bool {
})
}
var isDev = lazy.SyncFunc(func() bool {
var isDev = sync.OnceValue(func() bool {
return strings.Contains(Short(), "-dev")
})

View File

@@ -7,7 +7,9 @@ package version
import (
"fmt"
"runtime/debug"
"strconv"
"strings"
"sync"
tailscaleroot "tailscale.com"
"tailscale.com/types/lazy"
@@ -116,7 +118,7 @@ func (i embeddedInfo) commitAbbrev() string {
return i.commit
}
var getEmbeddedInfo = lazy.SyncFunc(func() embeddedInfo {
var getEmbeddedInfo = sync.OnceValue(func() embeddedInfo {
bi, ok := debug.ReadBuildInfo()
if !ok {
return embeddedInfo{}
@@ -169,3 +171,42 @@ func majorMinorPatch() string {
ret, _, _ := strings.Cut(Short(), "-")
return ret
}
func isValidLongWithTwoRepos(v string) bool {
s := strings.Split(v, "-")
if len(s) != 3 {
return false
}
hexChunk := func(s string) bool {
if len(s) < 6 {
return false
}
for i := range len(s) {
b := s[i]
if (b < '0' || b > '9') && (b < 'a' || b > 'f') {
return false
}
}
return true
}
v, t, g := s[0], s[1], s[2]
if !strings.HasPrefix(t, "t") || !strings.HasPrefix(g, "g") ||
!hexChunk(t[1:]) || !hexChunk(g[1:]) {
return false
}
nums := strings.Split(v, ".")
if len(nums) != 3 {
return false
}
for i, n := range nums {
bits := 8
if i == 2 {
bits = 16
}
if _, err := strconv.ParseUint(n, 10, bits); err != nil {
return false
}
}
return true
}

17
vendor/tailscale.com/version/version_checkformat.go generated vendored Normal file
View File

@@ -0,0 +1,17 @@
// Copyright (c) Tailscale Inc & AUTHORS
// SPDX-License-Identifier: BSD-3-Clause
//go:build tailscale_go && android
package version
import "fmt"
func init() {
// For official Android builds using the tailscale_go toolchain,
// panic if the builder is screwed up and we fail to stamp a valid
// version string.
if !isValidLongWithTwoRepos(Long()) {
panic(fmt.Sprintf("malformed version.Long value %q", Long()))
}
}