mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-12 05:37:32 +00:00
ipn/localapi: rename /profile to /pprof
Avoids name collision with profiles for user switching. Signed-off-by: Mihai Parparita <mihai@tailscale.com>
This commit is contained in:

committed by
Mihai Parparita

parent
9a05cdd2b5
commit
7a07bc654b
@@ -71,7 +71,7 @@ var handler = map[string]localAPIHandler{
|
||||
"metrics": (*Handler).serveMetrics,
|
||||
"ping": (*Handler).servePing,
|
||||
"prefs": (*Handler).servePrefs,
|
||||
"profile": (*Handler).serveProfile,
|
||||
"pprof": (*Handler).servePprof,
|
||||
"set-dns": (*Handler).serveSetDNS,
|
||||
"set-expiry-sooner": (*Handler).serveSetExpirySooner,
|
||||
"status": (*Handler).serveStatus,
|
||||
@@ -437,22 +437,22 @@ func (h *Handler) serveComponentDebugLogging(w http.ResponseWriter, r *http.Requ
|
||||
json.NewEncoder(w).Encode(res)
|
||||
}
|
||||
|
||||
// serveProfileFunc is the implementation of Handler.serveProfile, after auth,
|
||||
// servePprofFunc is the implementation of Handler.servePprof, after auth,
|
||||
// for platforms where we want to link it in.
|
||||
var serveProfileFunc func(http.ResponseWriter, *http.Request)
|
||||
var servePprofFunc func(http.ResponseWriter, *http.Request)
|
||||
|
||||
func (h *Handler) serveProfile(w http.ResponseWriter, r *http.Request) {
|
||||
func (h *Handler) servePprof(w http.ResponseWriter, r *http.Request) {
|
||||
// Require write access out of paranoia that the profile dump
|
||||
// might contain something sensitive.
|
||||
if !h.PermitWrite {
|
||||
http.Error(w, "profile access denied", http.StatusForbidden)
|
||||
return
|
||||
}
|
||||
if serveProfileFunc == nil {
|
||||
if servePprofFunc == nil {
|
||||
http.Error(w, "not implemented on this platform", http.StatusServiceUnavailable)
|
||||
return
|
||||
}
|
||||
serveProfileFunc(w, r)
|
||||
servePprofFunc(w, r)
|
||||
}
|
||||
|
||||
func (h *Handler) serveCheckIPForwarding(w http.ResponseWriter, r *http.Request) {
|
||||
|
@@ -15,10 +15,10 @@ import (
|
||||
)
|
||||
|
||||
func init() {
|
||||
serveProfileFunc = serveProfile
|
||||
servePprofFunc = servePprof
|
||||
}
|
||||
|
||||
func serveProfile(w http.ResponseWriter, r *http.Request) {
|
||||
func servePprof(w http.ResponseWriter, r *http.Request) {
|
||||
name := r.FormValue("name")
|
||||
switch name {
|
||||
case "profile":
|
Reference in New Issue
Block a user