Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
ec72f9bf
Commit
ec72f9bf
authored
Aug 26, 2010
by
Corey Thomasson
Committed by
Russ Cox
Aug 26, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
net: add LookupMX
R=rsc CC=golang-dev
https://golang.org/cl/1976049
parent
4d903504
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
+19
-0
dnsclient.go
src/pkg/net/dnsclient.go
+19
-0
No files found.
src/pkg/net/dnsclient.go
View file @
ec72f9bf
...
...
@@ -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
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment