cli/set: add printout when web client started

Prints a helpful message with the web UI's address when running
tailscale set --webclient.

Updates tailscale/corp#16345

Signed-off-by: Sonia Appasamy <sonia@tailscale.com>
This commit is contained in:
Sonia Appasamy 2024-01-09 17:01:43 -05:00 committed by Sonia Appasamy
parent 4ce33c9758
commit ea9c7f991a

View File

@ -12,6 +12,7 @@ import (
"os/exec" "os/exec"
"github.com/peterbourgon/ff/v3/ffcli" "github.com/peterbourgon/ff/v3/ffcli"
"tailscale.com/client/web"
"tailscale.com/clientupdate" "tailscale.com/clientupdate"
"tailscale.com/ipn" "tailscale.com/ipn"
"tailscale.com/net/netutil" "tailscale.com/net/netutil"
@ -193,9 +194,17 @@ func runSet(ctx context.Context, args []string) (retErr error) {
} }
_, err = localClient.EditPrefs(ctx, maskedPrefs) _, err = localClient.EditPrefs(ctx, maskedPrefs)
if err != nil {
return err return err
} }
if setArgs.runWebClient && len(st.TailscaleIPs) > 0 {
printf("\nWeb interface now running at %s:%d", st.TailscaleIPs[0], web.ListenPort)
}
return nil
}
// calcAdvertiseRoutesForSet returns the new value for Prefs.AdvertiseRoutes based on the // calcAdvertiseRoutesForSet returns the new value for Prefs.AdvertiseRoutes based on the
// current value, the flags passed to "tailscale set". // current value, the flags passed to "tailscale set".
// advertiseExitNodeSet is whether the --advertise-exit-node flag was set. // advertiseExitNodeSet is whether the --advertise-exit-node flag was set.