A simple DNS lookup tool similar to Linux dig command, implemented in Go.
go build -o dig main.go
dig example.com # Query A record using system DNS
dig example.com A # Explicitly query A record
dig example.com AAAA # Query AAAA record
dig example.com MX # Query MX record
dig example.com NS # Query NS record
dig example.com TXT # Query TXT record
dig @8.8.8.8 example.com # Use Google's DNS
dig @1.1.1.1 example.com A # Use Cloudflare's DNS
dig @8.8.8.8:53 example.com A # Specify custom port
dig +short example.com # Show only IP addresses
dig +short example.com MX # Show MX records in short format
dig +short example.com TXT # Show TXT records in short format
dig -x 8.8.8.8 # Find hostname for IP
dig @8.8.8.8 -x 8.8.8.8 # Reverse lookup using specific DNS
When no DNS server is specified, go-dig will:
/etc/resolv.conf, Windows: Get-DnsClientServerAddress)119.29.29.29 (Chinese public DNS) if system DNS is unavailableShows detailed DNS response including:
Shows only the essential record data:
This project is licensed under the MIT License - see the LICENSE file for details.
This is a simple educational project demonstrating DNS query implementation using miekg/dns library.