You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
package main
import (
"fmt"
"github.com/miekg/dns"
)
func main() {
c := new(dns.Client)
m := new(dns.Msg)
m.SetQuestion(dns.Fqdn("example.com"), dns.TypeA) // Replace "example.com" with your domain
m.RecursionDesired = true
r, _, err := c.Exchange(m, "8.8.8.8:53") // Replace "8.8.8.8:53" with your DNS server
if err != nil {
fmt.Println(err)
return
}
if r.Rcode != dns.RcodeSuccess {
fmt.Println("Failed to get an answer:\n", r)
return
}
for _, ans := range r.Answer {
Arecord := ans.(*dns.A)
fmt.Printf("Name: %s \n", Arecord.Hdr.Name)
fmt.Printf("A record IP: %s \n", Arecord.A)
}
}
Possibly with the use of: https://github.com/0xRyuk/IPX
The text was updated successfully, but these errors were encountered: