cmd/tailscale: add debug -env

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
pull/2941/head
Brad Fitzpatrick 3 years ago
parent 5bc6d17f87
commit ec2249b6f2

@ -34,6 +34,7 @@ var debugCmd = &ffcli.Command{
fs.BoolVar(&debugArgs.derpMap, "derp", false, "If true, dump DERP map")
fs.BoolVar(&debugArgs.pretty, "pretty", false, "If true, pretty-print output (for --prefs)")
fs.BoolVar(&debugArgs.netMap, "netmap", true, "whether to include netmap in --ipn mode")
fs.BoolVar(&debugArgs.env, "env", false, "dump environment")
fs.BoolVar(&debugArgs.localCreds, "local-creds", false, "print how to connect to local tailscaled")
fs.StringVar(&debugArgs.file, "file", "", "get, delete:NAME, or NAME")
fs.StringVar(&debugArgs.cpuFile, "cpu-profile", "", "if non-empty, grab a CPU profile for --profile-sec seconds and write it to this file; - for stdout")
@ -44,6 +45,7 @@ var debugCmd = &ffcli.Command{
}
var debugArgs struct {
env bool
localCreds bool
goroutines bool
ipn bool
@ -79,6 +81,12 @@ func runDebug(ctx context.Context, args []string) error {
if len(args) > 0 {
return errors.New("unknown arguments")
}
if debugArgs.env {
for _, e := range os.Environ() {
fmt.Println(e)
}
return nil
}
if debugArgs.localCreds {
port, token, err := safesocket.LocalTCPPortAndToken()
if err == nil {

Loading…
Cancel
Save