|
|
@ -36,6 +36,7 @@ import (
|
|
|
|
"tailscale.com/net/interfaces"
|
|
|
|
"tailscale.com/net/interfaces"
|
|
|
|
"tailscale.com/syncs"
|
|
|
|
"tailscale.com/syncs"
|
|
|
|
"tailscale.com/tailcfg"
|
|
|
|
"tailscale.com/tailcfg"
|
|
|
|
|
|
|
|
"tailscale.com/util/clientmetric"
|
|
|
|
"tailscale.com/wgengine"
|
|
|
|
"tailscale.com/wgengine"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
@ -502,13 +503,16 @@ func (h *peerAPIHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|
|
|
h.handlePeerPut(w, r)
|
|
|
|
h.handlePeerPut(w, r)
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if r.URL.Path == "/v0/goroutines" {
|
|
|
|
switch r.URL.Path {
|
|
|
|
|
|
|
|
case "/v0/goroutines":
|
|
|
|
h.handleServeGoroutines(w, r)
|
|
|
|
h.handleServeGoroutines(w, r)
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
case "/v0/env":
|
|
|
|
if r.URL.Path == "/v0/env" {
|
|
|
|
|
|
|
|
h.handleServeEnv(w, r)
|
|
|
|
h.handleServeEnv(w, r)
|
|
|
|
return
|
|
|
|
return
|
|
|
|
|
|
|
|
case "/v0/metrics":
|
|
|
|
|
|
|
|
h.handleServeMetrics(w, r)
|
|
|
|
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
who := h.peerUser.DisplayName
|
|
|
|
who := h.peerUser.DisplayName
|
|
|
|
fmt.Fprintf(w, `<html>
|
|
|
|
fmt.Fprintf(w, `<html>
|
|
|
@ -736,3 +740,12 @@ func (h *peerAPIHandler) handleServeEnv(w http.ResponseWriter, r *http.Request)
|
|
|
|
w.Header().Set("Content-Type", "application/json")
|
|
|
|
w.Header().Set("Content-Type", "application/json")
|
|
|
|
json.NewEncoder(w).Encode(data)
|
|
|
|
json.NewEncoder(w).Encode(data)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (h *peerAPIHandler) handleServeMetrics(w http.ResponseWriter, r *http.Request) {
|
|
|
|
|
|
|
|
if !h.isSelf {
|
|
|
|
|
|
|
|
http.Error(w, "not owner", http.StatusForbidden)
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
w.Header().Set("Content-Type", "text/plain")
|
|
|
|
|
|
|
|
clientmetric.WritePrometheusExpositionFormat(w)
|
|
|
|
|
|
|
|
}
|
|
|
|