diff --git a/ipn/ipnlocal/peerapi.go b/ipn/ipnlocal/peerapi.go index 3337a8b6c..64017c365 100644 --- a/ipn/ipnlocal/peerapi.go +++ b/ipn/ipnlocal/peerapi.go @@ -567,6 +567,9 @@ func (h *peerAPIHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { case "/v0/wol": h.handleWakeOnLAN(w, r) return + case "/v0/interfaces": + h.handleServeInterfaces(w, r) + return } who := h.peerUser.DisplayName fmt.Fprintf(w, ` @@ -581,6 +584,40 @@ This is my Tailscale device. Your device is %v. } } +func (h *peerAPIHandler) handleServeInterfaces(w http.ResponseWriter, r *http.Request) { + if !h.canDebug() { + http.Error(w, "denied; no debug access", http.StatusForbidden) + return + } + i, err := interfaces.GetList() + if err != nil { + http.Error(w, err.Error(), 500) + } + + dr, err := interfaces.DefaultRoute() + if err != nil { + http.Error(w, err.Error(), 500) + } + w.Header().Set("Content-Type", "text/html; charset=utf-8") + fmt.Fprintln(w, "
%v | ", v) + } + fmt.Fprint(w, "
---|
%v | ", v) + } + fmt.Fprint(w, "