mirror of
https://github.com/tailscale/tailscale.git
synced 2025-04-16 03:31:39 +00:00
cmd/derpprobe: add -once flag for one-off CLI diagnostics
Updates #6478 Signed-off-by: James Tucker <james@tailscale.com>
This commit is contained in:
parent
b1441d0044
commit
dc75b7cfd1
@ -35,6 +35,7 @@ import (
|
|||||||
var (
|
var (
|
||||||
derpMapURL = flag.String("derp-map", "https://login.tailscale.com/derpmap/default", "URL to DERP map (https:// or file://)")
|
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")
|
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
|
// certReissueAfter is the time after which we expect all certs to be
|
||||||
@ -63,6 +64,20 @@ func main() {
|
|||||||
defer cancel()
|
defer cancel()
|
||||||
_, _ = getDERPMap(ctx)
|
_, _ = 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 probeLoop()
|
||||||
go slackLoop()
|
go slackLoop()
|
||||||
log.Fatal(http.ListenAndServe(*listen, http.HandlerFunc(serve)))
|
log.Fatal(http.ListenAndServe(*listen, http.HandlerFunc(serve)))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user