Documentation ¶
Overview ¶
Package health is a registry for other packages to report & check overall health status of the node.
Index ¶
- Constants
- Variables
- func AppendWarnableDebugFlags(base []string) []string
- func DNSHealth() error
- func DNSOSHealth() error
- func DebugHandler(typ string) http.Handler
- func GetInPollNetMap() bool
- func GotStreamedMapResponse()
- func NoteDERPRegionReceivedFrame(region int)
- func NoteMapRequestHeard(mr *tailcfg.MapRequest)
- func OverallError() error
- func RegisterDebugHandler(typ string, h http.Handler)
- func RegisterWatcher(cb func(key Subsystem, err error)) (unregister func())
- func RouterHealth() error
- func SetAnyInterfaceUp(up bool)
- func SetAuthRoutineInError(err error)
- func SetControlHealth(problems []string)
- func SetDERPRegionConnectedState(region int, connected bool)
- func SetDERPRegionHealth(region int, problem string)
- func SetDNSHealth(err error)
- func SetDNSManagerHealth(err error)
- func SetDNSOSHealth(err error)
- func SetIPNState(state string, wantRunning bool)
- func SetLocalLogConfigHealth(err error)
- func SetMagicSockDERPHome(region int)
- func SetOutOfPollNetMap()
- func SetRouterHealth(err error)
- func SetTKAHealth(err error)
- func SetTLSConnectionError(host string, err error)
- func SetUDP4Unbound(unbound bool)
- func TKAHealth() error
- type ReceiveFuncStats
- type Subsystem
- type Warnable
- type WarnableOpt
Constants ¶
const ( // SysOverall is the name representing the overall health of // the system, rather than one particular subsystem. SysOverall = Subsystem("overall") // SysRouter is the name of the wgengine/router subsystem. SysRouter = Subsystem("router") // SysDNS is the name of the net/dns subsystem. SysDNS = Subsystem("dns") // SysDNSOS is the name of the net/dns OSConfigurator subsystem. SysDNSOS = Subsystem("dns-os") // SysDNSManager is the name of the net/dns manager subsystem. SysDNSManager = Subsystem("dns-manager") // SysTKA is the name of the tailnet key authority subsystem. SysTKA = Subsystem("tailnet-lock") )
Variables ¶
var ( ReceiveIPv4 = ReceiveFuncStats{/* contains filtered or unexported fields */} ReceiveIPv6 = ReceiveFuncStats{/* contains filtered or unexported fields */} ReceiveDERP = ReceiveFuncStats{/* contains filtered or unexported fields */} )
Functions ¶
func AppendWarnableDebugFlags ¶
AppendWarnableDebugFlags appends to base any health items that are currently in failed state and were created with MapDebugFlag.
func DNSOSHealth ¶
func DNSOSHealth() error
DNSOSHealth returns the net/dns.OSConfigurator error state.
func DebugHandler ¶
func GetInPollNetMap ¶
func GetInPollNetMap() bool
GetInPollNetMap reports whether the client has an open HTTP long poll open to the control plane.
func GotStreamedMapResponse ¶
func GotStreamedMapResponse()
GotStreamedMapResponse notes that we got a tailcfg.MapResponse message in streaming mode, even if it's just a keep-alive message.
This also notes that a map poll is in progress. To unset that, call SetOutOfPollNetMap().
func NoteDERPRegionReceivedFrame ¶
func NoteDERPRegionReceivedFrame(region int)
func NoteMapRequestHeard ¶
func NoteMapRequestHeard(mr *tailcfg.MapRequest)
NoteMapRequestHeard notes whenever we successfully sent a map request to control for which we received a 200 response.
func OverallError ¶
func OverallError() error
OverallError returns a summary of the health state.
If there are multiple problems, the error will be of type multierr.Error.
func RegisterDebugHandler ¶
func RegisterWatcher ¶
RegisterWatcher adds a function that will be called if an error changes state either to unhealthy or from unhealthy. It is not called on transition from unknown to healthy. It must be non-nil and is run in its own goroutine. The returned func unregisters it.
func RouterHealth ¶
func RouterHealth() error
RouterHealth returns the wgengine/router.Router error state.
func SetAnyInterfaceUp ¶
func SetAnyInterfaceUp(up bool)
SetAnyInterfaceUp sets whether any network interface is up.
func SetAuthRoutineInError ¶
func SetAuthRoutineInError(err error)
SetAuthRoutineInError records the latest error encountered as a result of a login attempt. Providing a nil error indicates successful login, or that being logged in w/coordination is not currently desired.
func SetControlHealth ¶
func SetControlHealth(problems []string)
func SetDERPRegionHealth ¶
SetDERPRegionHealth sets or clears any problem associated with the provided DERP region.
func SetDNSManagerHealth ¶
func SetDNSManagerHealth(err error)
SetDNSManagerHealth sets the state of the Linux net/dns manager's discovery of the /etc/resolv.conf situation.
func SetDNSOSHealth ¶
func SetDNSOSHealth(err error)
SetDNSOSHealth sets the state of the net/dns.OSConfigurator
func SetIPNState ¶
state is an ipn.State.String() value: "Running", "Stopped", "NeedsLogin", etc.
func SetLocalLogConfigHealth ¶
func SetLocalLogConfigHealth(err error)
SetLocalLogConfigHealth sets the error state of this client's local log configuration.
func SetMagicSockDERPHome ¶
func SetMagicSockDERPHome(region int)
SetMagicSockDERPHome notes what magicsock's view of its home DERP is.
func SetOutOfPollNetMap ¶
func SetOutOfPollNetMap()
SetOutOfPollNetMap records that the client is no longer in an HTTP map request long poll to the control plane.
func SetRouterHealth ¶
func SetRouterHealth(err error)
SetRouterHealth sets the state of the wgengine/router.Router.
func SetTKAHealth ¶
func SetTKAHealth(err error)
SetTKAHealth sets the health of the tailnet key authority.
func SetTLSConnectionError ¶
SetTLSConnectionError sets the error state for connections to a specific host. Setting the error to nil will clear any previously-set error.
func SetUDP4Unbound ¶
func SetUDP4Unbound(unbound bool)
SetUDP4Unbound sets whether the udp4 bind failed completely.
Types ¶
type ReceiveFuncStats ¶
type ReceiveFuncStats struct {
// contains filtered or unexported fields
}
ReceiveFuncStats tracks the calls made to a wireguard-go receive func.
func (*ReceiveFuncStats) Enter ¶
func (s *ReceiveFuncStats) Enter()
func (*ReceiveFuncStats) Exit ¶
func (s *ReceiveFuncStats) Exit()
type Subsystem ¶
type Subsystem string
Subsystem is the name of a subsystem whose health can be monitored.
type Warnable ¶
type Warnable struct {
// contains filtered or unexported fields
}
Warnable is a health check item that may or may not be in a bad warning state. The caller of NewWarnable is responsible for calling Set to update the state.
func NewWarnable ¶
func NewWarnable(opts ...WarnableOpt) *Warnable
NewWarnable returns a new warnable item that the caller can mark as health or in warning state.
type WarnableOpt ¶
type WarnableOpt interface {
// contains filtered or unexported methods
}
WarnableOpt is an option passed to NewWarnable.
func WithMapDebugFlag ¶
func WithMapDebugFlag(name string) WarnableOpt
WithMapDebugFlag returns a WarnableOpt for NewWarnable that makes the returned Warnable report itself to the coordination server as broken with this string in MapRequest.DebugFlag when Set to a non-nil value.