@ -47,7 +47,8 @@ import (
var debugCmd = & ffcli . Command {
Name : "debug" ,
Exec : runDebug ,
LongHelp : ` "tailscale debug" contains misc debug facilities; it is not a stable interface. ` ,
ShortUsage : "tailscale debug <debug-flags | subcommand>" ,
LongHelp : ` HIDDEN: "tailscale debug" contains misc debug facilities; it is not a stable interface. ` ,
FlagSet : ( func ( ) * flag . FlagSet {
fs := newFlagSet ( "debug" )
fs . StringVar ( & debugArgs . file , "file" , "" , "get, delete:NAME, or NAME" )
@ -59,14 +60,15 @@ var debugCmd = &ffcli.Command{
Subcommands : [ ] * ffcli . Command {
{
Name : "derp-map" ,
ShortUsage : "tailscale debug derp-map" ,
Exec : runDERPMap ,
ShortHelp : "p rint DERP map",
ShortHelp : "P rint DERP map",
} ,
{
Name : "component-logs" ,
Exec : runDebugComponentLogs ,
ShortHelp : "enable/disable debug logs for a component" ,
ShortUsage : "tailscale debug component-logs [" + strings . Join ( ipn . DebuggableComponents , "|" ) + "]" ,
Exec : runDebugComponentLogs ,
ShortHelp : "Enable/disable debug logs for a component" ,
FlagSet : ( func ( ) * flag . FlagSet {
fs := newFlagSet ( "component-logs" )
fs . DurationVar ( & debugComponentLogsArgs . forDur , "for" , time . Hour , "how long to enable debug logs for; zero or negative means to disable" )
@ -75,13 +77,15 @@ var debugCmd = &ffcli.Command{
} ,
{
Name : "daemon-goroutines" ,
ShortUsage : "tailscale debug daemon-goroutines" ,
Exec : runDaemonGoroutines ,
ShortHelp : "p rint tailscaled's goroutines",
ShortHelp : "P rint tailscaled's goroutines",
} ,
{
Name : "daemon-logs" ,
ShortUsage : "tailscale debug daemon-logs" ,
Exec : runDaemonLogs ,
ShortHelp : "w atch tailscaled's server logs",
ShortHelp : "W atch tailscaled's server logs",
FlagSet : ( func ( ) * flag . FlagSet {
fs := newFlagSet ( "daemon-logs" )
fs . IntVar ( & daemonLogsArgs . verbose , "verbose" , 0 , "verbosity level" )
@ -91,8 +95,9 @@ var debugCmd = &ffcli.Command{
} ,
{
Name : "metrics" ,
ShortUsage : "tailscale debug metrics" ,
Exec : runDaemonMetrics ,
ShortHelp : "p rint tailscaled's metrics",
ShortHelp : "P rint tailscaled's metrics",
FlagSet : ( func ( ) * flag . FlagSet {
fs := newFlagSet ( "metrics" )
fs . BoolVar ( & metricsArgs . watch , "watch" , false , "print JSON dump of delta values" )
@ -101,79 +106,94 @@ var debugCmd = &ffcli.Command{
} ,
{
Name : "env" ,
ShortUsage : "tailscale debug env" ,
Exec : runEnv ,
ShortHelp : "p rint cmd/tailscale environment",
ShortHelp : "P rint cmd/tailscale environment",
} ,
{
Name : "stat" ,
ShortUsage : "tailscale debug stat <files...>" ,
Exec : runStat ,
ShortHelp : "s tat a file",
ShortHelp : "S tat a file",
} ,
{
Name : "hostinfo" ,
ShortUsage : "tailscale debug hostinfo" ,
Exec : runHostinfo ,
ShortHelp : "p rint hostinfo",
ShortHelp : "P rint hostinfo",
} ,
{
Name : "local-creds" ,
ShortUsage : "tailscale debug local-creds" ,
Exec : runLocalCreds ,
ShortHelp : "p rint how to access Tailscale LocalAPI",
ShortHelp : "P rint how to access Tailscale LocalAPI",
} ,
{
Name : "restun" ,
ShortUsage : "tailscale debug restun" ,
Exec : localAPIAction ( "restun" ) ,
ShortHelp : "f orce a magicsock restun",
ShortHelp : "F orce a magicsock restun",
} ,
{
Name : "rebind" ,
ShortUsage : "tailscale debug rebind" ,
Exec : localAPIAction ( "rebind" ) ,
ShortHelp : "f orce a magicsock rebind",
ShortHelp : "F orce a magicsock rebind",
} ,
{
Name : "derp-set-on-demand" ,
ShortUsage : "tailscale debug derp-set-on-demand" ,
Exec : localAPIAction ( "derp-set-homeless" ) ,
ShortHelp : "e nable DERP on-demand mode (breaks reachability)",
ShortHelp : "E nable DERP on-demand mode (breaks reachability)",
} ,
{
Name : "derp-unset-on-demand" ,
ShortUsage : "tailscale debug derp-unset-on-demand" ,
Exec : localAPIAction ( "derp-unset-homeless" ) ,
ShortHelp : "d isable DERP on-demand mode",
ShortHelp : "D isable DERP on-demand mode",
} ,
{
Name : "break-tcp-conns" ,
ShortUsage : "tailscale debug break-tcp-conns" ,
Exec : localAPIAction ( "break-tcp-conns" ) ,
ShortHelp : "b reak any open TCP connections from the daemon",
ShortHelp : "B reak any open TCP connections from the daemon",
} ,
{
Name : "break-derp-conns" ,
ShortUsage : "tailscale debug break-derp-conns" ,
Exec : localAPIAction ( "break-derp-conns" ) ,
ShortHelp : "b reak any open DERP connections from the daemon",
ShortHelp : "B reak any open DERP connections from the daemon",
} ,
{
Name : "pick-new-derp" ,
ShortUsage : "tailscale debug pick-new-derp" ,
Exec : localAPIAction ( "pick-new-derp" ) ,
ShortHelp : "s witch to some other random DERP home region for a short time",
ShortHelp : "S witch to some other random DERP home region for a short time",
} ,
{
Name : "force-netmap-update" ,
ShortUsage : "tailscale debug force-netmap-update" ,
Exec : localAPIAction ( "force-netmap-update" ) ,
ShortHelp : "f orce a full no-op netmap update (for load testing)",
ShortHelp : "F orce a full no-op netmap update (for load testing)",
} ,
{
// TODO(bradfitz,maisem): eventually promote this out of debug
Name : "reload-config" ,
ShortUsage : "tailscale debug reload-config" ,
Exec : reloadConfig ,
ShortHelp : "r eload config",
ShortHelp : "R eload config",
} ,
{
Name : "control-knobs" ,
ShortUsage : "tailscale debug control-knobs" ,
Exec : debugControlKnobs ,
ShortHelp : "s ee current control knobs",
ShortHelp : "S ee current control knobs",
} ,
{
Name : "prefs" ,
ShortUsage : "tailscale debug prefs" ,
Exec : runPrefs ,
ShortHelp : "p rint prefs",
ShortHelp : "P rint prefs",
FlagSet : ( func ( ) * flag . FlagSet {
fs := newFlagSet ( "prefs" )
fs . BoolVar ( & prefsArgs . pretty , "pretty" , false , "If true, pretty-print output" )
@ -182,8 +202,9 @@ var debugCmd = &ffcli.Command{
} ,
{
Name : "watch-ipn" ,
ShortUsage : "tailscale debug watch-ipn" ,
Exec : runWatchIPN ,
ShortHelp : "s ubscribe to IPN message bus",
ShortHelp : "S ubscribe to IPN message bus",
FlagSet : ( func ( ) * flag . FlagSet {
fs := newFlagSet ( "watch-ipn" )
fs . BoolVar ( & watchIPNArgs . netmap , "netmap" , true , "include netmap in messages" )
@ -195,8 +216,9 @@ var debugCmd = &ffcli.Command{
} ,
{
Name : "netmap" ,
ShortUsage : "tailscale debug netmap" ,
Exec : runNetmap ,
ShortHelp : "p rint the current network map",
ShortHelp : "P rint the current network map",
FlagSet : ( func ( ) * flag . FlagSet {
fs := newFlagSet ( "netmap" )
fs . BoolVar ( & netmapArgs . showPrivateKey , "show-private-key" , false , "include node private key in printed netmap" )
@ -205,13 +227,16 @@ var debugCmd = &ffcli.Command{
} ,
{
Name : "via" ,
ShortUsage : "tailscale via <site-id> <v4-cidr>\n" +
"tailscale via <v6-route>" ,
Exec : runVia ,
ShortHelp : "convert between site-specific IPv4 CIDRs and IPv6 'via' routes" ,
ShortHelp : " C onvert between site-specific IPv4 CIDRs and IPv6 'via' routes",
} ,
{
Name : "ts2021" ,
ShortUsage : "tailscale debug ts2021" ,
Exec : runTS2021 ,
ShortHelp : "d ebug ts2021 protocol connectivity",
ShortHelp : "D ebug ts2021 protocol connectivity",
FlagSet : ( func ( ) * flag . FlagSet {
fs := newFlagSet ( "ts2021" )
fs . StringVar ( & ts2021Args . host , "host" , "controlplane.tailscale.com" , "hostname of control plane" )
@ -222,8 +247,9 @@ var debugCmd = &ffcli.Command{
} ,
{
Name : "set-expire" ,
ShortUsage : "tailscale debug set-expire --in=1m" ,
Exec : runSetExpire ,
ShortHelp : "m anipulate node key expiry for testing",
ShortHelp : "M anipulate node key expiry for testing",
FlagSet : ( func ( ) * flag . FlagSet {
fs := newFlagSet ( "set-expire" )
fs . DurationVar ( & setExpireArgs . in , "in" , 0 , "if non-zero, set node key to expire this duration from now" )
@ -232,8 +258,9 @@ var debugCmd = &ffcli.Command{
} ,
{
Name : "dev-store-set" ,
ShortUsage : "tailscale debug dev-store-set" ,
Exec : runDevStoreSet ,
ShortHelp : "s et a key/value pair during development",
ShortHelp : "S et a key/value pair during development",
FlagSet : ( func ( ) * flag . FlagSet {
fs := newFlagSet ( "store-set" )
fs . BoolVar ( & devStoreSetArgs . danger , "danger" , false , "accept danger" )
@ -242,13 +269,15 @@ var debugCmd = &ffcli.Command{
} ,
{
Name : "derp" ,
ShortUsage : "tailscale debug derp" ,
Exec : runDebugDERP ,
ShortHelp : "t est a DERP configuration",
ShortHelp : "T est a DERP configuration",
} ,
{
Name : "capture" ,
ShortUsage : "tailscale debug capture" ,
Exec : runCapture ,
ShortHelp : "s treams pcaps for debugging",
ShortHelp : "S treams pcaps for debugging",
FlagSet : ( func ( ) * flag . FlagSet {
fs := newFlagSet ( "capture" )
fs . StringVar ( & captureArgs . outFile , "o" , "" , "path to stream the pcap (or - for stdout), leave empty to start wireshark" )
@ -257,8 +286,9 @@ var debugCmd = &ffcli.Command{
} ,
{
Name : "portmap" ,
ShortUsage : "tailscale debug portmap" ,
Exec : debugPortmap ,
ShortHelp : "r un portmap debugging",
ShortHelp : "R un portmap debugging",
FlagSet : ( func ( ) * flag . FlagSet {
fs := newFlagSet ( "portmap" )
fs . DurationVar ( & debugPortmapArgs . duration , "duration" , 5 * time . Second , "timeout for port mapping" )
@ -271,13 +301,15 @@ var debugCmd = &ffcli.Command{
} ,
{
Name : "peer-endpoint-changes" ,
ShortUsage : "tailscale debug peer-endpoint-changes <hostname-or-IP>" ,
Exec : runPeerEndpointChanges ,
ShortHelp : "p rints debug information about a peer's endpoint changes",
ShortHelp : "P rints debug information about a peer's endpoint changes",
} ,
{
Name : "dial-types" ,
ShortUsage : "tailscale debug dial-types <hostname-or-IP> <port>" ,
Exec : runDebugDialTypes ,
ShortHelp : "p rints debug information about connecting to a given host or IP",
ShortHelp : "P rints debug information about connecting to a given host or IP",
FlagSet : ( func ( ) * flag . FlagSet {
fs := newFlagSet ( "dial-types" )
fs . StringVar ( & debugDialTypesArgs . network , "network" , "tcp" , ` network type to dial ("tcp", "udp", etc.) ` )
@ -867,7 +899,7 @@ var setExpireArgs struct {
func runSetExpire ( ctx context . Context , args [ ] string ) error {
if len ( args ) != 0 || setExpireArgs . in == 0 {
return errors . New ( "usage --in=<duration>")
return errors . New ( "usage : tailscale debug set-expire --in=<duration>")
}
return localClient . DebugSetExpireIn ( ctx , setExpireArgs . in )
}
@ -966,7 +998,7 @@ func runPeerEndpointChanges(ctx context.Context, args []string) error {
}
if len ( args ) != 1 || args [ 0 ] == "" {
return errors . New ( "usage: peer-statu s <hostname-or-IP>")
return errors . New ( "usage: tailscale debug peer-endpoint-change s <hostname-or-IP>")
}
var ip string
@ -1042,7 +1074,7 @@ func runDebugDialTypes(ctx context.Context, args []string) error {
}
if len ( args ) != 2 || args [ 0 ] == "" || args [ 1 ] == "" {
return errors . New ( "usage: dial-types <hostname-or-IP> <port>")
return errors . New ( "usage: tailscale debug dial-types <hostname-or-IP> <port>")
}
port , err := strconv . ParseUint ( args [ 1 ] , 10 , 16 )