cmd/tailscale: allow serve|funnel off to delete an entire port

This PR allows you to do "tailscale serve -bg -https:4545 off" and it
will delete all handlers under it. It will also prompt you for a y/n in case
you wanted to delete a single port.

Updates #8489

Signed-off-by: Marwan Sulaiman <marwan@tailscale.com>
This commit is contained in:
Marwan Sulaiman
2023-10-23 12:22:50 -04:00
committed by Marwan Sulaiman
parent e561f1ce61
commit 60e768fd14
4 changed files with 74 additions and 5 deletions
+8 -1
View File
@@ -82,7 +82,14 @@ func confirmUpdate(ver string) bool {
return false
}
fmt.Printf("This will update Tailscale from %v to %v. Continue? [y/n] ", version.Short(), ver)
msg := fmt.Sprintf("This will update Tailscale from %v to %v. Continue?", version.Short(), ver)
return promptYesNo(msg)
}
// PromptYesNo takes a question and prompts the user to answer the
// question with a yes or no. It appends a [y/n] to the message.
func promptYesNo(msg string) bool {
fmt.Print(msg + " [y/n] ")
var resp string
fmt.Scanln(&resp)
resp = strings.ToLower(resp)