health

package
v0.0.0-...-ded95ce Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 14, 2022 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Overview

Package health is a registry for other packages to report & check overall health status of the node.

Index

Constants

View Source
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")

	// SysNetworkCategory is the name of the subsystem that sets
	// the Windows network adapter's "category" (public, private, domain).
	// If it's unhealthy, the Windows firewall rules won't match.
	SysNetworkCategory = Subsystem("network-category")

	// SysValidUnsignedNodes is a health check area for recording problems
	// with the unsigned nodes that the coordination server sent.
	SysValidUnsignedNodes = Subsystem("valid-unsigned-nodes")
)

Variables

View Source
var (
	ReceiveIPv4 = ReceiveFuncStats{/* contains filtered or unexported fields */}
	ReceiveIPv6 = ReceiveFuncStats{/* contains filtered or unexported fields */}
	ReceiveDERP = ReceiveFuncStats{/* contains filtered or unexported fields */}
)

Functions

func DNSHealth

func DNSHealth() error

DNSHealth returns the net/dns.Manager error state.

func DNSOSHealth

func DNSOSHealth() error

DNSOSHealth returns the net/dns.OSConfigurator error state.

func DebugHandler

func DebugHandler(typ string) http.Handler

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.

func NetworkCategoryHealth

func NetworkCategoryHealth() error

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 RegisterDebugHandler(typ string, h http.Handler)

func RegisterWatcher

func RegisterWatcher(cb func(key Subsystem, err error)) (unregister func())

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 SetDERPRegionConnectedState

func SetDERPRegionConnectedState(region int, connected bool)

func SetDERPRegionHealth

func SetDERPRegionHealth(region int, problem string)

SetDERPRegionHealth sets or clears any problem associated with the provided DERP region.

func SetDNSHealth

func SetDNSHealth(err error)

SetDNSHealth sets the state of the net/dns.Manager

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

func SetIPNState(state string, wantRunning bool)

state is an ipn.State.String() value: "Running", "Stopped", "NeedsLogin", etc.

func SetInPollNetMap

func SetInPollNetMap(v bool)

SetInPollNetMap records whether the client has an open HTTP long poll open to the control plane.

func SetMagicSockDERPHome

func SetMagicSockDERPHome(region int)

SetMagicSockDERPHome notes what magicsock's view of its home DERP is.

func SetNetworkCategoryHealth

func SetNetworkCategoryHealth(err error)

SetNetworkCategoryHealth sets the state of setting the network adaptor's category. This only applies on Windows.

func SetRouterHealth

func SetRouterHealth(err error)

SetRouterHealth sets the state of the wgengine/router.Router.

func SetUDP4Unbound

func SetUDP4Unbound(unbound bool)

SetUDP4Unbound sets whether the udp4 bind failed completely.

func SetValidUnsignedNodes

func SetValidUnsignedNodes(err error)

SetValidUnsignedNodes sets the state of the map response validation.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL