client,cmd/tailscale,ipn/{ipnlocal,localapi}: add debug CLI command to clear netmap caches (#19213)
This is a follow-up to #19117, adding a debug CLI command allowing the operator to explicitly discard cached netmap data, as a safety and recovery measure. Updates #12639 Change-Id: I5c3c47c0204754b9c8e526a4ff8f69d6974db6d0 Signed-off-by: M. J. Fromberger <fromberger@tailscale.com>main
parent
d6b626f5bb
commit
eaa5d9df4b
@ -0,0 +1,31 @@ |
||||
// Copyright (c) Tailscale Inc & contributors
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
//go:build !ios && !ts_omit_cachenetmap
|
||||
|
||||
package cli |
||||
|
||||
import ( |
||||
"context" |
||||
"errors" |
||||
|
||||
"github.com/peterbourgon/ff/v3/ffcli" |
||||
) |
||||
|
||||
func init() { |
||||
debugClearNetmapCacheCmd = func() *ffcli.Command { |
||||
return &ffcli.Command{ |
||||
Name: "clear-netmap-cache", |
||||
ShortUsage: "tailscale debug clear-netmap-cache", |
||||
ShortHelp: "Remove and discard cached network maps (if any)", |
||||
Exec: runDebugClearNetmapCache, |
||||
} |
||||
} |
||||
} |
||||
|
||||
func runDebugClearNetmapCache(ctx context.Context, args []string) error { |
||||
if len(args) != 0 { |
||||
return errors.New("unexpected arguments") |
||||
} |
||||
return localClient.DebugAction(ctx, "clear-netmap-cache") |
||||
} |
||||
Loading…
Reference in new issue