|
@@ -32,6 +32,7 @@ import (
|
|
|
"golang.org/x/net/dns/dnsmessage"
|
|
"golang.org/x/net/dns/dnsmessage"
|
|
|
"inet.af/netaddr"
|
|
"inet.af/netaddr"
|
|
|
"tailscale.com/client/tailscale/apitype"
|
|
"tailscale.com/client/tailscale/apitype"
|
|
|
|
|
+ "tailscale.com/health"
|
|
|
"tailscale.com/hostinfo"
|
|
"tailscale.com/hostinfo"
|
|
|
"tailscale.com/ipn"
|
|
"tailscale.com/ipn"
|
|
|
"tailscale.com/logtail/backoff"
|
|
"tailscale.com/logtail/backoff"
|
|
@@ -556,6 +557,9 @@ func (h *peerAPIHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|
|
case "/v0/magicsock":
|
|
case "/v0/magicsock":
|
|
|
h.handleServeMagicsock(w, r)
|
|
h.handleServeMagicsock(w, r)
|
|
|
return
|
|
return
|
|
|
|
|
+ case "/v0/dnsfwd":
|
|
|
|
|
+ h.handleServeDNSFwd(w, r)
|
|
|
|
|
+ return
|
|
|
}
|
|
}
|
|
|
who := h.peerUser.DisplayName
|
|
who := h.peerUser.DisplayName
|
|
|
fmt.Fprintf(w, `<html>
|
|
fmt.Fprintf(w, `<html>
|
|
@@ -808,6 +812,19 @@ func (h *peerAPIHandler) handleServeMetrics(w http.ResponseWriter, r *http.Reque
|
|
|
clientmetric.WritePrometheusExpositionFormat(w)
|
|
clientmetric.WritePrometheusExpositionFormat(w)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+func (h *peerAPIHandler) handleServeDNSFwd(w http.ResponseWriter, r *http.Request) {
|
|
|
|
|
+ if !h.isSelf {
|
|
|
|
|
+ http.Error(w, "not owner", http.StatusForbidden)
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ dh := health.DebugHandler("dnsfwd")
|
|
|
|
|
+ if dh == nil {
|
|
|
|
|
+ http.Error(w, "not wired up", 500)
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ dh.ServeHTTP(w, r)
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
func (h *peerAPIHandler) replyToDNSQueries() bool {
|
|
func (h *peerAPIHandler) replyToDNSQueries() bool {
|
|
|
if h.isSelf {
|
|
if h.isSelf {
|
|
|
// If the peer is owned by the same user, just allow it
|
|
// If the peer is owned by the same user, just allow it
|