From e921e1b02d75435ee327fd967c58a4733e7abf1a Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Sun, 20 Feb 2022 07:59:26 -0800 Subject: [PATCH] cmd/tailscale: add "tailscale debug hostinfo" subcommand Change-Id: Ifa09364d42e0516fdf80feddaf33c95880228049 Signed-off-by: Brad Fitzpatrick --- cmd/tailscale/cli/debug.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/cmd/tailscale/cli/debug.go b/cmd/tailscale/cli/debug.go index 8d585168f..0d11e165a 100644 --- a/cmd/tailscale/cli/debug.go +++ b/cmd/tailscale/cli/debug.go @@ -22,6 +22,7 @@ import ( "github.com/peterbourgon/ff/v3/ffcli" "tailscale.com/client/tailscale" + "tailscale.com/hostinfo" "tailscale.com/ipn" "tailscale.com/paths" "tailscale.com/safesocket" @@ -65,6 +66,11 @@ var debugCmd = &ffcli.Command{ Exec: runEnv, ShortHelp: "print cmd/tailscale environment", }, + { + Name: "hostinfo", + Exec: runHostinfo, + ShortHelp: "print hostinfo", + }, { Name: "local-creds", Exec: runLocalCreds, @@ -270,6 +276,13 @@ func runEnv(ctx context.Context, args []string) error { return nil } +func runHostinfo(ctx context.Context, args []string) error { + hi := hostinfo.New() + j, _ := json.MarshalIndent(hi, "", " ") + os.Stdout.Write(j) + return nil +} + func runDaemonGoroutines(ctx context.Context, args []string) error { goroutines, err := tailscale.Goroutines(ctx) if err != nil {