return
}
+// LookupTXT returns the DNS TXT records for the given domain name.
+func LookupTXT(name string) (txt []string, err os.Error) {
+ return nil, os.NewError("net.LookupTXT is not implemented on Plan 9")
+}
+
// LookupAddr performs a reverse lookup for the given address, returning a list
// of names mapping to that address.
func LookupAddr(addr string) (name []string, err os.Error) {
}
}
+func TestGmailTXT(t *testing.T) {
+ if runtime.GOOS == "windows" || runtime.GOOS == "plan9" {
+ t.Logf("LookupTXT is not implemented on Windows or Plan 9")
+ return
+ }
+ if testing.Short() || avoidMacFirewall {
+ t.Logf("skipping test to avoid external network")
+ return
+ }
+ txt, err := LookupTXT("gmail.com")
+ if err != nil {
+ t.Errorf("failed: %s", err)
+ }
+ if len(txt) == 0 || len(txt[0]) == 0 {
+ t.Errorf("no results")
+ }
+}
+
func TestGoogleDNSAddr(t *testing.T) {
if testing.Short() || avoidMacFirewall {
t.Logf("skipping test to avoid external network")
// LookupMX returns the DNS MX records for the given domain name sorted by preference.
func LookupMX(name string) (mx []*MX, err os.Error) {
- _, rr, err := lookup(name, dnsTypeMX)
+ _, records, err := lookup(name, dnsTypeMX)
if err != nil {
return
}
- mx = make([]*MX, len(rr))
- for i := range rr {
- r := rr[i].(*dnsRR_MX)
+ mx = make([]*MX, len(records))
+ for i, rr := range records {
+ r := rr.(*dnsRR_MX)
mx[i] = &MX{r.Mx, r.Pref}
}
byPref(mx).sort()
return
}
+// LookupTXT returns the DNS TXT records for the given domain name.
+func LookupTXT(name string) (txt []string, err os.Error) {
+ _, records, err := lookup(name, dnsTypeTXT)
+ if err != nil {
+ return
+ }
+ txt = make([]string, len(records))
+ for i, r := range records {
+ txt[i] = r.(*dnsRR_TXT).Txt
+ }
+ return
+}
+
// LookupAddr performs a reverse lookup for the given address, returning a list
// of names mapping to that address.
func LookupAddr(addr string) (name []string, err os.Error) {
return mx, nil
}
+func LookupTXT(name string) (txt []string, err os.Error) {
+ return nil, os.NewError("net.LookupTXT is not implemented on Windows")
+}
+
func LookupAddr(addr string) (name []string, err os.Error) {
arpa, err := reverseaddr(addr)
if err != nil {