ipn/ipnlocal: add wireguard session state metrics + publish on IPN bus
Updates #19989 Updates tailscale/corp#42874 Change-Id: I843ed95bc7b0f5cd38ba1467332c6b022901e254 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
committed by
Brad Fitzpatrick
parent
ae743642d9
commit
6596d237a3
@@ -270,8 +270,18 @@ func debugCmd() *ffcli.Command {
|
||||
FlagSet: (func() *flag.FlagSet {
|
||||
fs := newFlagSet("watch-ipn")
|
||||
fs.BoolVar(&watchIPNArgs.initial, "initial", false, "include the initial backend State and Prefs in the first message")
|
||||
fs.BoolVar(&watchIPNArgs.rateLimit, "rate-limit", true, "rate limit messages")
|
||||
fs.IntVar(&watchIPNArgs.count, "count", 0, "exit after printing this many statuses, or 0 to keep going forever")
|
||||
fs.BoolVar(&watchIPNArgs.engineUpdates, "engine-updates", false, "set NotifyWatchEngineUpdates: send Engine updates")
|
||||
fs.BoolVar(&watchIPNArgs.initialDriveShares, "initial-drive-shares", false, "set NotifyInitialDriveShares: send current Taildrive Shares in first message")
|
||||
fs.BoolVar(&watchIPNArgs.initialOutgoingFiles, "initial-outgoing-files", false, "set NotifyInitialOutgoingFiles: send current Taildrop OutgoingFiles in first message")
|
||||
fs.BoolVar(&watchIPNArgs.initialHealthState, "initial-health", false, "set NotifyInitialHealthState: send current health.State in first message")
|
||||
fs.BoolVar(&watchIPNArgs.healthActions, "health-actions", false, "set NotifyHealthActions: include PrimaryActions in health.State")
|
||||
fs.BoolVar(&watchIPNArgs.initialSuggestedExitNode, "initial-suggested-exit-node", false, "set NotifyInitialSuggestedExitNode: send current SuggestedExitNode in first message")
|
||||
fs.BoolVar(&watchIPNArgs.initialClientVersion, "initial-client-version", false, "set NotifyInitialClientVersion: send current ClientVersion in first message")
|
||||
fs.BoolVar(&watchIPNArgs.peerChanges, "peer-changes", true, "set NotifyPeerChanges: send PeersChanged and PeersRemoved updates")
|
||||
fs.BoolVar(&watchIPNArgs.initialStatus, "initial-status", false, "set NotifyInitialStatus: send current ipnstate.Status in first message")
|
||||
fs.BoolVar(&watchIPNArgs.peerPatches, "peer-patches", true, "set NotifyPeerPatches: send narrow per-field peer patches")
|
||||
fs.BoolVar(&watchIPNArgs.peerWireGuardState, "peer-wireguard-state", false, "set NotifyPeerWireGuardState: send WireGuard session state notifications")
|
||||
return fs
|
||||
})(),
|
||||
},
|
||||
@@ -632,18 +642,59 @@ func runPrefs(ctx context.Context, args []string) error {
|
||||
}
|
||||
|
||||
var watchIPNArgs struct {
|
||||
initial bool
|
||||
rateLimit bool
|
||||
count int
|
||||
initial bool
|
||||
count int
|
||||
|
||||
engineUpdates bool
|
||||
initialDriveShares bool
|
||||
initialOutgoingFiles bool
|
||||
initialHealthState bool
|
||||
healthActions bool
|
||||
initialSuggestedExitNode bool
|
||||
initialClientVersion bool
|
||||
peerChanges bool
|
||||
initialStatus bool
|
||||
peerPatches bool
|
||||
peerWireGuardState bool
|
||||
}
|
||||
|
||||
func runWatchIPN(ctx context.Context, args []string) error {
|
||||
mask := ipn.NotifyPeerChanges | ipn.NotifyPeerPatches
|
||||
mask := ipn.NotifyNoNetMap
|
||||
if watchIPNArgs.initial {
|
||||
mask |= ipn.NotifyInitialState | ipn.NotifyInitialPrefs
|
||||
}
|
||||
if watchIPNArgs.rateLimit {
|
||||
mask |= ipn.NotifyRateLimit
|
||||
if watchIPNArgs.engineUpdates {
|
||||
mask |= ipn.NotifyWatchEngineUpdates
|
||||
}
|
||||
if watchIPNArgs.initialDriveShares {
|
||||
mask |= ipn.NotifyInitialDriveShares
|
||||
}
|
||||
if watchIPNArgs.initialOutgoingFiles {
|
||||
mask |= ipn.NotifyInitialOutgoingFiles
|
||||
}
|
||||
if watchIPNArgs.initialHealthState {
|
||||
mask |= ipn.NotifyInitialHealthState
|
||||
}
|
||||
if watchIPNArgs.healthActions {
|
||||
mask |= ipn.NotifyHealthActions
|
||||
}
|
||||
if watchIPNArgs.initialSuggestedExitNode {
|
||||
mask |= ipn.NotifyInitialSuggestedExitNode
|
||||
}
|
||||
if watchIPNArgs.initialClientVersion {
|
||||
mask |= ipn.NotifyInitialClientVersion
|
||||
}
|
||||
if watchIPNArgs.peerChanges {
|
||||
mask |= ipn.NotifyPeerChanges
|
||||
}
|
||||
if watchIPNArgs.initialStatus {
|
||||
mask |= ipn.NotifyInitialStatus
|
||||
}
|
||||
if watchIPNArgs.peerPatches {
|
||||
mask |= ipn.NotifyPeerPatches
|
||||
}
|
||||
if watchIPNArgs.peerWireGuardState {
|
||||
mask |= ipn.NotifyPeerWireGuardState
|
||||
}
|
||||
watcher, err := localClient.WatchIPNBus(ctx, mask)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user