Permalink
Browse files

Add LookupNS

  • Loading branch information...
1 parent 2e55bd3 commit a2320873f7d2d7bf936b2b3324c9cd9adf4a4aa8 @miekg committed Jun 23, 2013
Showing with 12 additions and 0 deletions.
  1. +12 −0 lookup.go
View
@@ -92,6 +92,18 @@ func (u *Unbound) LookupMX(name string) (mx []*dns.MX, err error) {
return
}
+// LookupNS returns the DNS NS records for the given domain name.
+func (u *Unbound) LookupNS(name string) (ns []*dns.NS, err error) {
+ r, err := u.Resolve(name, dns.TypeNS, dns.ClassINET)
+ if err != nil {
+ return nil, err
+ }
+ for _, rr := range r.Rr {
+ ns = append(ns, rr.(*dns.NS))
+ }
+ return
+}
+
// LookupSRV tries to resolve an SRV query of the given service, protocol,
// and domain name. The proto is "tcp" or "udp". The returned records are
// sorted by priority and randomized by weight within a priority.

0 comments on commit a232087

Please sign in to comment.