diff --git a/cmd/derpprobe/derpprobe.go b/cmd/derpprobe/derpprobe.go index 9175f001a..4b685f74a 100644 --- a/cmd/derpprobe/derpprobe.go +++ b/cmd/derpprobe/derpprobe.go @@ -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)))