A simple toy dns resolver(command line tool) to resolve domain names to IP addressess. I have used miekg/dns library to create and parse DNS packets.
go run resolve.go google.com.
The Msg
struct from the miekg/dns
library, which lists all the sections.
type Msg struct {
MsgHdr
Compress bool `json:"-"` // If true, the message will be compressed when converted to wire format.
Question []Question // Holds the RR(s) of the question section.
Answer []RR // Holds the RR(s) of the answer section.
Ns []RR // Holds the RR(s) of the authority section.
Extra []RR // Holds the RR(s) of the additional section.
}
- miekg/dns Documentation.