2019-06-13 19:53:47 -05:00
|
|
|
package main
|
|
|
|
|
|
|
|
import "log"
|
|
|
|
import "github.com/miekg/dns"
|
|
|
|
|
2021-08-09 01:28:20 -05:00
|
|
|
import "git.wit.org/jcarr/dnssecsocket"
|
2019-06-13 19:53:47 -05:00
|
|
|
|
|
|
|
import "github.com/davecgh/go-spew/spew"
|
|
|
|
// import "github.com/Showmax/go-fqdn"
|
|
|
|
|
|
|
|
func lookupAAAA(hostname string) string {
|
|
|
|
// lookup the IP address from DNS
|
|
|
|
dnsRR := dnssecsocket.Dnstrace(hostname, "AAAA")
|
|
|
|
spew.Dump(dnsRR)
|
|
|
|
if (dnsRR == nil) {
|
|
|
|
return "BROKEN"
|
|
|
|
}
|
|
|
|
ipaddr := dns.Field(dnsRR, 1)
|
|
|
|
log.Println("ipaddr", ipaddr)
|
|
|
|
return ipaddr
|
|
|
|
}
|
|
|
|
|
|
|
|
func main() {
|
2021-08-09 01:28:20 -05:00
|
|
|
hostname := "check.lab.wit.org"
|
2019-06-13 19:53:47 -05:00
|
|
|
// 2604:bbc0:2:248:5054:f0ff:fe00:156
|
|
|
|
|
|
|
|
lookupAAAA(hostname)
|
|
|
|
}
|