Update dependencies
This commit is contained in:
39
vendor/tailscale.com/health/args.go
generated
vendored
Normal file
39
vendor/tailscale.com/health/args.go
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
// Copyright (c) Tailscale Inc & AUTHORS
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
package health
|
||||
|
||||
// Arg is a type for the key to be used in the Args of a Warnable.
|
||||
type Arg string
|
||||
|
||||
const (
|
||||
// ArgAvailableVersion provides an update notification Warnable with the available version of the Tailscale client.
|
||||
ArgAvailableVersion Arg = "available-version"
|
||||
|
||||
// ArgCurrentVersion provides an update notification Warnable with the current version of the Tailscale client.
|
||||
ArgCurrentVersion Arg = "current-version"
|
||||
|
||||
// ArgDuration provides a Warnable with how long the Warnable has been in an unhealthy state.
|
||||
ArgDuration Arg = "duration"
|
||||
|
||||
// ArgError provides a Warnable with the underlying error behind an unhealthy state.
|
||||
ArgError Arg = "error"
|
||||
|
||||
// ArgMagicsockFunctionName provides a Warnable with the name of the Magicsock function that caused the unhealthy state.
|
||||
ArgMagicsockFunctionName Arg = "magicsock-function-name"
|
||||
|
||||
// ArgDERPRegionID provides a Warnable with the ID of a DERP server involved in the unhealthy state.
|
||||
ArgDERPRegionID Arg = "derp-region-id"
|
||||
|
||||
// ArgDERPRegionName provides a Warnable with the name of a DERP server involved in the unhealthy state.
|
||||
// It is used to show a more friendly message like "the Seattle relay server failed to connect" versus
|
||||
// "relay server 10 failed to connect".
|
||||
ArgDERPRegionName Arg = "derp-region-name"
|
||||
|
||||
// ArgServerName provides a Warnable with the hostname of a server involved in the unhealthy state.
|
||||
ArgServerName Arg = "server-name"
|
||||
|
||||
// ArgServerName provides a Warnable with comma delimited list of the hostname of the servers involved in the unhealthy state.
|
||||
// If no nameservers were available to query, this will be an empty string.
|
||||
ArgDNSServers Arg = "dns-servers"
|
||||
)
|
||||
1298
vendor/tailscale.com/health/health.go
generated
vendored
Normal file
1298
vendor/tailscale.com/health/health.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
15
vendor/tailscale.com/health/healthmsg/healthmsg.go
generated
vendored
Normal file
15
vendor/tailscale.com/health/healthmsg/healthmsg.go
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
// Copyright (c) Tailscale Inc & AUTHORS
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
// Package healthmsg contains some constants for health messages.
|
||||
//
|
||||
// It's a leaf so both the server and CLI can depend on it without bringing too
|
||||
// much in to the CLI binary.
|
||||
package healthmsg
|
||||
|
||||
const (
|
||||
WarnAcceptRoutesOff = "Some peers are advertising routes but --accept-routes is false"
|
||||
TailscaleSSHOnBut = "Tailscale SSH enabled, but " // + ... something from caller
|
||||
LockedOut = "this node is locked out; it will not have connectivity until it is signed. For more info, see https://tailscale.com/s/locked-out"
|
||||
WarnExitNodeUsage = "The following issues on your machine will likely make usage of exit nodes impossible"
|
||||
)
|
||||
99
vendor/tailscale.com/health/state.go
generated
vendored
Normal file
99
vendor/tailscale.com/health/state.go
generated
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
// Copyright (c) Tailscale Inc & AUTHORS
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
package health
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// State contains the health status of the backend, and is
|
||||
// provided to the client UI via LocalAPI through ipn.Notify.
|
||||
type State struct {
|
||||
// Each key-value pair in Warnings represents a Warnable that is currently
|
||||
// unhealthy. If a Warnable is healthy, it will not be present in this map.
|
||||
// When a Warnable is unhealthy and becomes healthy, its key-value pair
|
||||
// disappears in the next issued State. Observers should treat the absence of
|
||||
// a WarnableCode in this map as an indication that the Warnable became healthy,
|
||||
// and may use that to clear any notifications that were previously shown to the user.
|
||||
// If Warnings is nil, all Warnables are healthy and the backend is overall healthy.
|
||||
Warnings map[WarnableCode]UnhealthyState
|
||||
}
|
||||
|
||||
// UnhealthyState contains information to be shown to the user to inform them
|
||||
// that a Warnable is currently unhealthy.
|
||||
type UnhealthyState struct {
|
||||
WarnableCode WarnableCode
|
||||
Severity Severity
|
||||
Title string
|
||||
Text string
|
||||
BrokenSince *time.Time `json:",omitempty"`
|
||||
Args Args `json:",omitempty"`
|
||||
DependsOn []WarnableCode `json:",omitempty"`
|
||||
ImpactsConnectivity bool `json:",omitempty"`
|
||||
}
|
||||
|
||||
// unhealthyState returns a unhealthyState of the Warnable given its current warningState.
|
||||
func (w *Warnable) unhealthyState(ws *warningState) *UnhealthyState {
|
||||
var text string
|
||||
if ws.Args != nil {
|
||||
text = w.Text(ws.Args)
|
||||
} else {
|
||||
text = w.Text(Args{})
|
||||
}
|
||||
|
||||
dependsOnWarnableCodes := make([]WarnableCode, len(w.DependsOn), len(w.DependsOn)+1)
|
||||
for i, d := range w.DependsOn {
|
||||
dependsOnWarnableCodes[i] = d.Code
|
||||
}
|
||||
|
||||
if w != warmingUpWarnable {
|
||||
// Here we tell the frontend that all Warnables depend on warmingUpWarnable. GUIs will silence all warnings until all
|
||||
// their dependencies are healthy. This is a special case to prevent the GUI from showing a bunch of warnings when
|
||||
// the backend is still warming up.
|
||||
dependsOnWarnableCodes = append(dependsOnWarnableCodes, warmingUpWarnable.Code)
|
||||
}
|
||||
|
||||
return &UnhealthyState{
|
||||
WarnableCode: w.Code,
|
||||
Severity: w.Severity,
|
||||
Title: w.Title,
|
||||
Text: text,
|
||||
BrokenSince: &ws.BrokenSince,
|
||||
Args: ws.Args,
|
||||
DependsOn: dependsOnWarnableCodes,
|
||||
ImpactsConnectivity: w.ImpactsConnectivity,
|
||||
}
|
||||
}
|
||||
|
||||
// CurrentState returns a snapshot of the current health status of the backend.
|
||||
// It returns a State with nil Warnings if the backend is healthy (all Warnables
|
||||
// have no issues).
|
||||
// The returned State is a snapshot of shared memory, and the caller should not
|
||||
// mutate the returned value.
|
||||
func (t *Tracker) CurrentState() *State {
|
||||
if t.nil() {
|
||||
return &State{}
|
||||
}
|
||||
|
||||
t.mu.Lock()
|
||||
defer t.mu.Unlock()
|
||||
|
||||
if t.warnableVal == nil || len(t.warnableVal) == 0 {
|
||||
return &State{}
|
||||
}
|
||||
|
||||
wm := map[WarnableCode]UnhealthyState{}
|
||||
|
||||
for w, ws := range t.warnableVal {
|
||||
if !w.IsVisible(ws) {
|
||||
// Skip invisible Warnables.
|
||||
continue
|
||||
}
|
||||
wm[w.Code] = *w.unhealthyState(ws)
|
||||
}
|
||||
|
||||
return &State{
|
||||
Warnings: wm,
|
||||
}
|
||||
}
|
||||
263
vendor/tailscale.com/health/warnings.go
generated
vendored
Normal file
263
vendor/tailscale.com/health/warnings.go
generated
vendored
Normal file
@@ -0,0 +1,263 @@
|
||||
// Copyright (c) Tailscale Inc & AUTHORS
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
package health
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
"tailscale.com/version"
|
||||
)
|
||||
|
||||
/**
|
||||
This file contains definitions for the Warnables maintained within this `health` package.
|
||||
*/
|
||||
|
||||
// updateAvailableWarnable is a Warnable that warns the user that an update is available.
|
||||
var updateAvailableWarnable = Register(&Warnable{
|
||||
Code: "update-available",
|
||||
Title: "Update available",
|
||||
Severity: SeverityLow,
|
||||
Text: func(args Args) string {
|
||||
if version.IsMacAppStore() || version.IsAppleTV() || version.IsMacSys() || version.IsWindowsGUI() || runtime.GOOS == "android" {
|
||||
return fmt.Sprintf("An update from version %s to %s is available.", args[ArgCurrentVersion], args[ArgAvailableVersion])
|
||||
} else {
|
||||
return fmt.Sprintf("An update from version %s to %s is available. Run `tailscale update` or `tailscale set --auto-update` to update now.", args[ArgCurrentVersion], args[ArgAvailableVersion])
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
// securityUpdateAvailableWarnable is a Warnable that warns the user that an important security update is available.
|
||||
var securityUpdateAvailableWarnable = Register(&Warnable{
|
||||
Code: "security-update-available",
|
||||
Title: "Security update available",
|
||||
Severity: SeverityMedium,
|
||||
Text: func(args Args) string {
|
||||
if version.IsMacAppStore() || version.IsAppleTV() || version.IsMacSys() || version.IsWindowsGUI() || runtime.GOOS == "android" {
|
||||
return fmt.Sprintf("A security update from version %s to %s is available.", args[ArgCurrentVersion], args[ArgAvailableVersion])
|
||||
} else {
|
||||
return fmt.Sprintf("A security update from version %s to %s is available. Run `tailscale update` or `tailscale set --auto-update` to update now.", args[ArgCurrentVersion], args[ArgAvailableVersion])
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
// unstableWarnable is a Warnable that warns the user that they are using an unstable version of Tailscale
|
||||
// so they won't be surprised by all the issues that may arise.
|
||||
var unstableWarnable = Register(&Warnable{
|
||||
Code: "is-using-unstable-version",
|
||||
Title: "Using an unstable version",
|
||||
Severity: SeverityLow,
|
||||
Text: StaticMessage("This is an unstable version of Tailscale meant for testing and development purposes. Please report any issues to Tailscale."),
|
||||
})
|
||||
|
||||
// NetworkStatusWarnable is a Warnable that warns the user that the network is down.
|
||||
var NetworkStatusWarnable = Register(&Warnable{
|
||||
Code: "network-status",
|
||||
Title: "Network down",
|
||||
Severity: SeverityMedium,
|
||||
Text: StaticMessage("Tailscale cannot connect because the network is down. Check your Internet connection."),
|
||||
ImpactsConnectivity: true,
|
||||
TimeToVisible: 5 * time.Second,
|
||||
})
|
||||
|
||||
// IPNStateWarnable is a Warnable that warns the user that Tailscale is stopped.
|
||||
var IPNStateWarnable = Register(&Warnable{
|
||||
Code: "wantrunning-false",
|
||||
Title: "Tailscale off",
|
||||
Severity: SeverityLow,
|
||||
Text: StaticMessage("Tailscale is stopped."),
|
||||
})
|
||||
|
||||
// localLogWarnable is a Warnable that warns the user that the local log is misconfigured.
|
||||
var localLogWarnable = Register(&Warnable{
|
||||
Code: "local-log-config-error",
|
||||
Title: "Local log misconfiguration",
|
||||
Severity: SeverityLow,
|
||||
Text: func(args Args) string {
|
||||
return fmt.Sprintf("The local log is misconfigured: %v", args[ArgError])
|
||||
},
|
||||
})
|
||||
|
||||
// LoginStateWarnable is a Warnable that warns the user that they are logged out,
|
||||
// and provides the last login error if available.
|
||||
var LoginStateWarnable = Register(&Warnable{
|
||||
Code: "login-state",
|
||||
Title: "Logged out",
|
||||
Severity: SeverityMedium,
|
||||
Text: func(args Args) string {
|
||||
if args[ArgError] != "" {
|
||||
return fmt.Sprintf("You are logged out. The last login error was: %v", args[ArgError])
|
||||
} else {
|
||||
return "You are logged out."
|
||||
}
|
||||
},
|
||||
DependsOn: []*Warnable{IPNStateWarnable},
|
||||
})
|
||||
|
||||
// notInMapPollWarnable is a Warnable that warns the user that we are using a stale network map.
|
||||
var notInMapPollWarnable = Register(&Warnable{
|
||||
Code: "not-in-map-poll",
|
||||
Title: "Out of sync",
|
||||
Severity: SeverityMedium,
|
||||
DependsOn: []*Warnable{NetworkStatusWarnable, IPNStateWarnable},
|
||||
Text: StaticMessage("Unable to connect to the Tailscale coordination server to synchronize the state of your tailnet. Peer reachability might degrade over time."),
|
||||
// 8 minutes reflects a maximum maintenance window for the coordination server.
|
||||
TimeToVisible: 8 * time.Minute,
|
||||
})
|
||||
|
||||
// noDERPHomeWarnable is a Warnable that warns the user that Tailscale doesn't have a home DERP.
|
||||
var noDERPHomeWarnable = Register(&Warnable{
|
||||
Code: "no-derp-home",
|
||||
Title: "No home relay server",
|
||||
Severity: SeverityMedium,
|
||||
DependsOn: []*Warnable{NetworkStatusWarnable},
|
||||
Text: StaticMessage("Tailscale could not connect to any relay server. Check your Internet connection."),
|
||||
ImpactsConnectivity: true,
|
||||
TimeToVisible: 10 * time.Second,
|
||||
})
|
||||
|
||||
// noDERPConnectionWarnable is a Warnable that warns the user that Tailscale couldn't connect to a specific DERP server.
|
||||
var noDERPConnectionWarnable = Register(&Warnable{
|
||||
Code: "no-derp-connection",
|
||||
Title: "Relay server unavailable",
|
||||
Severity: SeverityMedium,
|
||||
DependsOn: []*Warnable{
|
||||
NetworkStatusWarnable,
|
||||
|
||||
// Technically noDERPConnectionWarnable could be used to warn about
|
||||
// failure to connect to a specific DERP server (e.g. your home is derp1
|
||||
// but you're trying to connect to a peer's derp4 and are unable) but as
|
||||
// of 2024-09-25 we only use this for connecting to your home DERP, so
|
||||
// we depend on noDERPHomeWarnable which is the ability to figure out
|
||||
// what your DERP home even is.
|
||||
noDERPHomeWarnable,
|
||||
},
|
||||
Text: func(args Args) string {
|
||||
if n := args[ArgDERPRegionName]; n != "" {
|
||||
return fmt.Sprintf("Tailscale could not connect to the '%s' relay server. Your Internet connection might be down, or the server might be temporarily unavailable.", n)
|
||||
} else {
|
||||
return fmt.Sprintf("Tailscale could not connect to the relay server with ID '%s'. Your Internet connection might be down, or the server might be temporarily unavailable.", args[ArgDERPRegionID])
|
||||
}
|
||||
},
|
||||
ImpactsConnectivity: true,
|
||||
TimeToVisible: 10 * time.Second,
|
||||
})
|
||||
|
||||
// derpTimeoutWarnable is a Warnable that warns the user that Tailscale hasn't
|
||||
// heard from the home DERP region for a while.
|
||||
var derpTimeoutWarnable = Register(&Warnable{
|
||||
Code: "derp-timed-out",
|
||||
Title: "Relay server timed out",
|
||||
Severity: SeverityMedium,
|
||||
DependsOn: []*Warnable{
|
||||
NetworkStatusWarnable,
|
||||
noDERPConnectionWarnable, // don't warn about it being stalled if we're not connected
|
||||
noDERPHomeWarnable, // same reason as noDERPConnectionWarnable's dependency
|
||||
},
|
||||
Text: func(args Args) string {
|
||||
if n := args[ArgDERPRegionName]; n != "" {
|
||||
return fmt.Sprintf("Tailscale hasn't heard from the '%s' relay server in %v. The server might be temporarily unavailable, or your Internet connection might be down.", n, args[ArgDuration])
|
||||
} else {
|
||||
return fmt.Sprintf("Tailscale hasn't heard from the home relay server (region ID '%v') in %v. The server might be temporarily unavailable, or your Internet connection might be down.", args[ArgDERPRegionID], args[ArgDuration])
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
// derpRegionErrorWarnable is a Warnable that warns the user that a DERP region is reporting an issue.
|
||||
var derpRegionErrorWarnable = Register(&Warnable{
|
||||
Code: "derp-region-error",
|
||||
Title: "Relay server error",
|
||||
Severity: SeverityLow,
|
||||
DependsOn: []*Warnable{NetworkStatusWarnable},
|
||||
Text: func(args Args) string {
|
||||
return fmt.Sprintf("The relay server #%v is reporting an issue: %v", args[ArgDERPRegionID], args[ArgError])
|
||||
},
|
||||
})
|
||||
|
||||
// noUDP4BindWarnable is a Warnable that warns the user that Tailscale couldn't listen for incoming UDP connections.
|
||||
var noUDP4BindWarnable = Register(&Warnable{
|
||||
Code: "no-udp4-bind",
|
||||
Title: "NAT traversal setup failure",
|
||||
Severity: SeverityMedium,
|
||||
DependsOn: []*Warnable{NetworkStatusWarnable, IPNStateWarnable},
|
||||
Text: StaticMessage("Tailscale couldn't listen for incoming UDP connections."),
|
||||
ImpactsConnectivity: true,
|
||||
})
|
||||
|
||||
// mapResponseTimeoutWarnable is a Warnable that warns the user that Tailscale hasn't received a network map from the coordination server in a while.
|
||||
var mapResponseTimeoutWarnable = Register(&Warnable{
|
||||
Code: "mapresponse-timeout",
|
||||
Title: "Network map response timeout",
|
||||
Severity: SeverityMedium,
|
||||
DependsOn: []*Warnable{NetworkStatusWarnable, IPNStateWarnable},
|
||||
Text: func(args Args) string {
|
||||
return fmt.Sprintf("Tailscale hasn't received a network map from the coordination server in %s.", args[ArgDuration])
|
||||
},
|
||||
})
|
||||
|
||||
// tlsConnectionFailedWarnable is a Warnable that warns the user that Tailscale could not establish an encrypted connection with a server.
|
||||
var tlsConnectionFailedWarnable = Register(&Warnable{
|
||||
Code: "tls-connection-failed",
|
||||
Title: "Encrypted connection failed",
|
||||
Severity: SeverityMedium,
|
||||
DependsOn: []*Warnable{NetworkStatusWarnable},
|
||||
Text: func(args Args) string {
|
||||
return fmt.Sprintf("Tailscale could not establish an encrypted connection with '%q': %v", args[ArgServerName], args[ArgError])
|
||||
},
|
||||
})
|
||||
|
||||
// magicsockReceiveFuncWarnable is a Warnable that warns the user that one of the Magicsock functions is not running.
|
||||
var magicsockReceiveFuncWarnable = Register(&Warnable{
|
||||
Code: "magicsock-receive-func-error",
|
||||
Title: "MagicSock function not running",
|
||||
Severity: SeverityMedium,
|
||||
Text: func(args Args) string {
|
||||
return fmt.Sprintf("The MagicSock function %s is not running. You might experience connectivity issues.", args[ArgMagicsockFunctionName])
|
||||
},
|
||||
})
|
||||
|
||||
// testWarnable is a Warnable that is used within this package for testing purposes only.
|
||||
var testWarnable = Register(&Warnable{
|
||||
Code: "test-warnable",
|
||||
Title: "Test warnable",
|
||||
Severity: SeverityLow,
|
||||
Text: func(args Args) string {
|
||||
return args[ArgError]
|
||||
},
|
||||
})
|
||||
|
||||
// applyDiskConfigWarnable is a Warnable that warns the user that there was an error applying the envknob config stored on disk.
|
||||
var applyDiskConfigWarnable = Register(&Warnable{
|
||||
Code: "apply-disk-config",
|
||||
Title: "Could not apply configuration",
|
||||
Severity: SeverityMedium,
|
||||
Text: func(args Args) string {
|
||||
return fmt.Sprintf("An error occurred applying the Tailscale envknob configuration stored on disk: %v", args[ArgError])
|
||||
},
|
||||
})
|
||||
|
||||
// controlHealthWarnable is a Warnable that warns the user that the coordination server is reporting an health issue.
|
||||
var controlHealthWarnable = Register(&Warnable{
|
||||
Code: "control-health",
|
||||
Title: "Coordination server reports an issue",
|
||||
Severity: SeverityMedium,
|
||||
Text: func(args Args) string {
|
||||
return fmt.Sprintf("The coordination server is reporting an health issue: %v", args[ArgError])
|
||||
},
|
||||
})
|
||||
|
||||
// warmingUpWarnableDuration is the duration for which the warmingUpWarnable is reported by the backend after the user
|
||||
// has changed ipnWantRunning to true from false.
|
||||
const warmingUpWarnableDuration = 5 * time.Second
|
||||
|
||||
// warmingUpWarnable is a Warnable that is reported by the backend when it is starting up, for a maximum time of
|
||||
// warmingUpWarnableDuration. The GUIs use the presence of this Warnable to prevent showing any other warnings until
|
||||
// the backend is fully started.
|
||||
var warmingUpWarnable = Register(&Warnable{
|
||||
Code: "warming-up",
|
||||
Title: "Tailscale is starting",
|
||||
Severity: SeverityLow,
|
||||
Text: StaticMessage("Tailscale is starting. Please wait."),
|
||||
})
|
||||
Reference in New Issue
Block a user