Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
dns
✓ github.com/miekg/dns
Perform a DNS lookup
package main
import (
"fmt"
"github.com/miekg/dns"
)
func main() {
m := new(dns.Msg)
m.SetQuestion(dns.Fqdn("example.com"), dns.TypeA)
c := new(dns.Client)
r, _, err := c.Exchange(m, "8.8.8.8:53")
if err != nil {
fmt.Println(err)
return
}
for _, a := range r.Answer {
fmt.Println(a)
}
}
Debug
Known issues
No known issues recorded.
Upgrade
Version history
1.1.72latest on pkg.go.dev
Audit
Dependencies
No dependency data recorded yet.