main: just get the A records from our resolver
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
parent
0f61a07c76
commit
5a145eb34c
1 changed files with 10 additions and 7 deletions
17
main.go
17
main.go
|
@ -8,23 +8,26 @@ import (
|
|||
|
||||
func main() {
|
||||
domains := []string{"google.com", "twitter.com"}
|
||||
types := []dns.QueryType{dns.TypeA, dns.TypeNS, dns.TypeMX, dns.TypeTXT}
|
||||
//types := []dns.QueryType{dns.TypeA, dns.TypeNS, dns.TypeMX, dns.TypeTXT}
|
||||
types := []dns.QueryType{dns.TypeA}
|
||||
|
||||
// Set timeout and retry times
|
||||
dns.Config.SetTimeout(uint(2))
|
||||
dns.Config.RetryTimes = uint(4)
|
||||
|
||||
// Simple usage
|
||||
if results, err := dns.Exchange("google.com", "119.29.29.29", dns.TypeA); err == nil {
|
||||
for _, r := range results {
|
||||
log.Println(r.Record, r.Type, r.Ttl, r.Priority, r.Content)
|
||||
_ = func() {
|
||||
if results, err := dns.Exchange("google.com", "119.29.29.29:53", dns.TypeA); err == nil {
|
||||
for _, r := range results {
|
||||
log.Println(r.Record, r.Type, r.Ttl, r.Priority, r.Content)
|
||||
}
|
||||
} else {
|
||||
log.Fatal(err)
|
||||
}
|
||||
} else {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
// Create and setup resolver with domains and types
|
||||
resolver := dns.NewResolver("119.29.29.29")
|
||||
resolver := dns.NewResolver("10.0.30.1")
|
||||
resolver.Targets(domains...).Types(types...)
|
||||
// Lookup
|
||||
res := resolver.Lookup()
|
||||
|
|
Loading…
Reference in a new issue