From 03b2c44a21201e036dcbb2f232f0a69237e0af4f Mon Sep 17 00:00:00 2001 From: Mihai Parparita Date: Mon, 10 Apr 2023 14:25:22 -0700 Subject: [PATCH] ipn/ipnlocal: more explicitly say if sockstats are not available Makes it more apparent in the PeerAPI endpoint that the client was not built with the appropriate toolchain or build tags. Updates tailscale/corp#9230 Signed-off-by: Mihai Parparita --- ipn/ipnlocal/peerapi.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ipn/ipnlocal/peerapi.go b/ipn/ipnlocal/peerapi.go index 196d0db5b..fcacad0c9 100644 --- a/ipn/ipnlocal/peerapi.go +++ b/ipn/ipnlocal/peerapi.go @@ -865,6 +865,11 @@ func (h *peerAPIHandler) handleServeSockStats(w http.ResponseWriter, r *http.Req w.Header().Set("Content-Type", "text/html; charset=utf-8") fmt.Fprintln(w, "

Socket Stats

") + if !sockstats.IsAvailable { + fmt.Fprintln(w, "Socket stats are not available for this client") + return + } + stats, interfaceStats, validation := sockstats.Get(), sockstats.GetInterfaces(), sockstats.GetValidation() if stats == nil { fmt.Fprintln(w, "No socket stats available")