This is a basic example showing how to use trace/dns package to trace DNS requests on the host.
$ go build .
Start the tracer in a terminal.
$ sudo ./dns
Then, perform some DNS requests:
$ nslookup -querytype=a microsoft.com.
$ nslookup -querytype=a google.com.
The first terminal will print information about the DNS requests:
$ sudo ./dns
A new "A" dns request about microsoft.com. was observed
A new "A" dns request about microsoft.com. was observed
A new "A" dns response about microsoft.com. was observed
A new "A" dns response about microsoft.com. was observed
A new "A" dns request about google.com. was observed
A new "A" dns request about google.com. was observed
A new "A" dns response about google.com. was observed
A new "A" dns response about google.com. was observed