mirror of
https://github.com/golang/go
synced 2024-11-21 23:04:39 -07:00
parent
4d903504b3
commit
ec72f9bf18
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user