aboutsummaryrefslogtreecommitdiff
path: root/src/net/lookup.go
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2016-12-19 13:05:53 -0800
committerMatthew Dempsky <mdempsky@google.com>2016-12-20 17:38:29 +0000
commit2f9dee9293e68fe588ffad445efae38e33be8d59 (patch)
tree6589bf592e55d44017741ad1e45670173a8d642b /src/net/lookup.go
parent0c942e8f2c6aeedfe672fdd0c2549ac39505cd75 (diff)
downloadgo-2f9dee9293e68fe588ffad445efae38e33be8d59.tar.gz
go-2f9dee9293e68fe588ffad445efae38e33be8d59.zip
net: make LookupCNAME's native behavior match its cgo behavior
Fixes #18172. Change-Id: I4a21fb5c0753cced025a03d88a6dd1aa3ee01d05 Reviewed-on: https://go-review.googlesource.com/34650 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'src/net/lookup.go')
-rw-r--r--src/net/lookup.go24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/net/lookup.go b/src/net/lookup.go
index 8b5cab0894..cc2013e432 100644
--- a/src/net/lookup.go
+++ b/src/net/lookup.go
@@ -233,20 +233,32 @@ func (r *Resolver) LookupPort(ctx context.Context, network, service string) (por
return port, nil
}
-// LookupCNAME returns the canonical DNS host for the given name.
+// LookupCNAME returns the canonical name for the given host.
// Callers that do not care about the canonical name can call
// LookupHost or LookupIP directly; both take care of resolving
// the canonical name as part of the lookup.
-func LookupCNAME(name string) (cname string, err error) {
- return DefaultResolver.lookupCNAME(context.Background(), name)
+//
+// A canonical name is the final name after following zero
+// or more CNAME records.
+// LookupCNAME does not return an error if host does not
+// contain DNS "CNAME" records, as long as host resolves to
+// address records.
+func LookupCNAME(host string) (cname string, err error) {
+ return DefaultResolver.lookupCNAME(context.Background(), host)
}
-// LookupCNAME returns the canonical DNS host for the given name.
+// LookupCNAME returns the canonical name for the given host.
// Callers that do not care about the canonical name can call
// LookupHost or LookupIP directly; both take care of resolving
// the canonical name as part of the lookup.
-func (r *Resolver) LookupCNAME(ctx context.Context, name string) (cname string, err error) {
- return r.lookupCNAME(ctx, name)
+//
+// A canonical name is the final name after following zero
+// or more CNAME records.
+// LookupCNAME does not return an error if host does not
+// contain DNS "CNAME" records, as long as host resolves to
+// address records.
+func (r *Resolver) LookupCNAME(ctx context.Context, host string) (cname string, err error) {
+ return r.lookupCNAME(ctx, host)
}
// LookupSRV tries to resolve an SRV query of the given service,