summaryrefslogtreecommitdiffhomepage
path: root/client
diff options
context:
space:
mode:
authorAndrea Gottardo <andrea@gottardo.me>2024-09-19 15:52:31 -0700
committerAndrea Gottardo <andrea@gottardo.me>2024-09-19 15:52:31 -0700
commit025ceed7354a527594c3c422ab4b9e1558326323 (patch)
treea04166e9b57b05c760e71703a42fe560736d3fa4 /client
parent7c02dcf93ad9c29d3732e189a4b445bd3fde1bf7 (diff)
downloadtailscale-angott/dns-cli-stream.tar.xz
tailscale-angott/dns-cli-stream.zip
cli: implement `tailscale dns stream`angott/dns-cli-stream
Updates tailscale/tailscale#13326 This PR adds another subcommand to `tailscale dns`, to stream queries and answers returned by the DNS forwarder as they are handled. Useful for debugging purposes, and is equivalent to setting the `TS_DEBUG_DNS_FORWARD_SEND` envknob and filtering the logs for relevant entries. This also adds a new envknob, `TS_DEBUG_DNS_INCLUDE_NAMES`, which includes the actual hostnames in the log lines (with a huge privacy warning!). This makes it easier to diagnose issues with DNS resolution.
Diffstat (limited to 'client')
-rw-r--r--client/tailscale/localclient.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/client/tailscale/localclient.go b/client/tailscale/localclient.go
index df51dc1ca..73f27d50f 100644
--- a/client/tailscale/localclient.go
+++ b/client/tailscale/localclient.go
@@ -1470,6 +1470,13 @@ func (lc *LocalClient) DebugDERPRegion(ctx context.Context, regionIDOrCode strin
return decodeJSON[*ipnstate.DebugDERPRegionReport](body)
}
+// DebugEnvknob sets a envknob for debugging purposes.
+func (lc *LocalClient) DebugEnvknob(ctx context.Context, key, value string) error {
+ v := url.Values{"key": {key}, "value": {value}}
+ _, err := lc.send(ctx, "POST", "/localapi/v0/debug-envknob?"+v.Encode(), 200, nil)
+ return err
+}
+
// DebugPacketFilterRules returns the packet filter rules for the current device.
func (lc *LocalClient) DebugPacketFilterRules(ctx context.Context) ([]tailcfg.FilterRule, error) {
body, err := lc.send(ctx, "POST", "/localapi/v0/debug-packet-filter-rules", 200, nil)