mirror of
https://github.com/tailscale/tailscale.git
synced 2025-07-29 23:33:45 +00:00
cmd/lopower: add verbose-dns
This commit is contained in:
parent
c8deed69ae
commit
e83fe9a762
@ -67,6 +67,7 @@ var (
|
|||||||
printConfig = flag.Bool("print-config", true, "print the client's WireGuard configuration to stdout on startup")
|
printConfig = flag.Bool("print-config", true, "print the client's WireGuard configuration to stdout on startup")
|
||||||
includeV4 = flag.Bool("include-v4", true, "include IPv4 (CGNAT) in the WireGuard configuration; incompatible with some carriers. IPv6 is always included.")
|
includeV4 = flag.Bool("include-v4", true, "include IPv4 (CGNAT) in the WireGuard configuration; incompatible with some carriers. IPv6 is always included.")
|
||||||
verbosePackets = flag.Bool("verbose-packets", false, "log packet contents")
|
verbosePackets = flag.Bool("verbose-packets", false, "log packet contents")
|
||||||
|
verboseDNS = flag.Bool("verbose-dns", false, "log DNS queries")
|
||||||
)
|
)
|
||||||
|
|
||||||
type config struct {
|
type config struct {
|
||||||
@ -680,16 +681,21 @@ func (lp *lpServer) filteredDNSQuery(ctx context.Context, q []byte, family strin
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if *includeV4 {
|
|
||||||
return origRes, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Filter out *.ts.net A records.
|
|
||||||
|
|
||||||
var msg dnsmessage.Message
|
var msg dnsmessage.Message
|
||||||
if err := msg.Unpack(origRes); err != nil {
|
if err := msg.Unpack(origRes); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if *verboseDNS {
|
||||||
|
log.Printf("[v] DNS: %s", msg.GoString())
|
||||||
|
}
|
||||||
|
|
||||||
|
if *includeV4 {
|
||||||
|
return origRes, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Filter out *.ts.net A records.
|
||||||
newAnswers := msg.Answers[:0]
|
newAnswers := msg.Answers[:0]
|
||||||
for _, a := range msg.Answers {
|
for _, a := range msg.Answers {
|
||||||
name := a.Header.Name.String()
|
name := a.Header.Name.String()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user