Commit ec72f9bf authored by Corey Thomasson's avatar Corey Thomasson Committed by Russ Cox

net: add LookupMX

R=rsc
CC=golang-dev
https://golang.org/cl/1976049
parent 4d903504
......@@ -335,3 +335,22 @@ func LookupSRV(name string) (cname string, addrs []*SRV, err os.Error) {
}
return
}
type MX struct {
Host string
Pref uint16
}
func LookupMX(name string) (entries []*MX, err os.Error) {
var records []dnsRR
_, records, err = lookup(name, dnsTypeMX)
if err != nil {
return
}
entries = make([]*MX, len(records))
for i := 0; i < len(records); i++ {
r := records[i].(*dnsRR_MX)
entries[i] = &MX{r.Mx, r.Pref}
}
return
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment