cmd/derpprobe: add -once flag for one-off CLI diagnostics

Updates #6478

Signed-off-by: James Tucker <james@tailscale.com>
pull/6476/head
James Tucker 2 years ago committed by James Tucker
parent b1441d0044
commit dc75b7cfd1

@ -35,6 +35,7 @@ import (
var (
derpMapURL = flag.String("derp-map", "https://login.tailscale.com/derpmap/default", "URL to DERP map (https:// or file://)")
listen = flag.String("listen", ":8030", "HTTP listen address")
probeOnce = flag.Bool("once", false, "probe once and print results, then exit; ignores the listen flag")
)
// certReissueAfter is the time after which we expect all certs to be
@ -63,6 +64,20 @@ func main() {
defer cancel()
_, _ = getDERPMap(ctx)
if *probeOnce {
log.Printf("Starting probe (may take up to 1m)")
probe()
log.Printf("Probe results:")
st := getOverallStatus()
for _, s := range st.good {
log.Printf("good: %s", s)
}
for _, s := range st.bad {
log.Printf("bad: %s", s)
}
return
}
go probeLoop()
go slackLoop()
log.Fatal(http.ListenAndServe(*listen, http.HandlerFunc(serve)))

Loading…
Cancel
Save