MCPcopy
hub / github.com/tailscale/tailscale / debugMode

Function debugMode

cmd/tailscaled/debug.go:69–99  ·  view source on GitHub ↗
(args []string)

Source from the content-addressed store, hash-verified

67}
68
69func debugMode(args []string) error {
70 fs := flag.NewFlagSet("debug", flag.ExitOnError)
71 fs.BoolVar(&debugArgs.ifconfig, "ifconfig", false, "If true, print network interface state")
72 fs.BoolVar(&debugArgs.monitor, "monitor", false, "If true, run network monitor forever. Precludes all other options.")
73 fs.BoolVar(&debugArgs.portmap, "portmap", false, "If true, run portmap debugging. Precludes all other options.")
74 fs.StringVar(&debugArgs.getURL, "get-url", "", "If non-empty, fetch provided URL.")
75 fs.StringVar(&debugArgs.derpCheck, "derp", "", "if non-empty, test a DERP ping via named region code")
76 if err := fs.Parse(args); err != nil {
77 return err
78 }
79 if len(fs.Args()) > 0 {
80 return errors.New("unknown non-flag debug subcommand arguments")
81 }
82 ctx := context.Background()
83 if debugArgs.derpCheck != "" {
84 return checkDerp(ctx, debugArgs.derpCheck)
85 }
86 if debugArgs.ifconfig {
87 return runMonitor(ctx, false)
88 }
89 if debugArgs.monitor {
90 return runMonitor(ctx, true)
91 }
92 if debugArgs.portmap {
93 return debugPortmap(ctx)
94 }
95 if debugArgs.getURL != "" {
96 return getURL(ctx, debugArgs.getURL)
97 }
98 return errors.New("only --monitor is available at the moment")
99}
100
101func runMonitor(ctx context.Context, loop bool) error {
102 b := eventbus.New()

Callers

nothing calls this directly

Calls 6

checkDerpFunction · 0.85
runMonitorFunction · 0.85
getURLFunction · 0.85
debugPortmapFunction · 0.70
ParseMethod · 0.45
NewMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…