mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-25 19:15:34 +00:00
ipn/ipnlocal: add health warning for unstable builds
Like the macOS About dialog. Change-Id: Ic27f091e66e29d5eebe4e195eda97ed331d748fd Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
parent
a26f23d949
commit
039ea51ca6
@ -579,6 +579,9 @@ func (b *LocalBackend) updateStatus(sb *ipnstate.StatusBuilder, extraLocked func
|
|||||||
if m := b.sshOnButUnusableHealthCheckMessageLocked(); m != "" {
|
if m := b.sshOnButUnusableHealthCheckMessageLocked(); m != "" {
|
||||||
s.Health = append(s.Health, m)
|
s.Health = append(s.Health, m)
|
||||||
}
|
}
|
||||||
|
if version.IsUnstableBuild() {
|
||||||
|
s.Health = append(s.Health, "This is an unstable (development) version of Tailscale; frequent updates and bugs are likely")
|
||||||
|
}
|
||||||
if b.netMap != nil {
|
if b.netMap != nil {
|
||||||
s.CertDomains = append([]string(nil), b.netMap.DNS.CertDomains...)
|
s.CertDomains = append([]string(nil), b.netMap.DNS.CertDomains...)
|
||||||
s.MagicDNSSuffix = b.netMap.MagicDNSSuffix()
|
s.MagicDNSSuffix = b.netMap.MagicDNSSuffix()
|
||||||
|
@ -8,7 +8,9 @@
|
|||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
"sync"
|
||||||
|
|
||||||
"tailscale.com/syncs"
|
"tailscale.com/syncs"
|
||||||
)
|
)
|
||||||
@ -74,3 +76,31 @@ func IsWindowsGUI() bool {
|
|||||||
exe = filepath.Base(exe)
|
exe = filepath.Base(exe)
|
||||||
return strings.EqualFold(exe, "tailscale-ipn.exe") || strings.EqualFold(exe, "tailscale-ipn")
|
return strings.EqualFold(exe, "tailscale-ipn.exe") || strings.EqualFold(exe, "tailscale-ipn")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
isUnstableOnce sync.Once
|
||||||
|
isUnstableBuild bool
|
||||||
|
)
|
||||||
|
|
||||||
|
// IsUnstableBuild reports whether this is an unstable build.
|
||||||
|
// That is, whether its minor version number is odd.
|
||||||
|
func IsUnstableBuild() bool {
|
||||||
|
isUnstableOnce.Do(initUnstable)
|
||||||
|
return isUnstableBuild
|
||||||
|
}
|
||||||
|
|
||||||
|
func initUnstable() {
|
||||||
|
_, rest, ok := strings.Cut(Short, ".")
|
||||||
|
if !ok {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
minorStr, _, ok := strings.Cut(rest, ".")
|
||||||
|
if !ok {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
minor, err := strconv.Atoi(minorStr)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
isUnstableBuild = minor%2 == 1
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user