aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryongqijia <YongqiJia520@gmail.com>2026-02-09 02:43:54 +0000
committerNicholas Husin <nsh@golang.org>2026-04-08 12:25:07 -0700
commit7c5ab4118014acd1e7c0fc67028186a4985c0a28 (patch)
tree9a4790bd1001dd93737e4a01abda18835e3b1c29
parent5d6aa23e5b6151d25955a512532383c28c745e18 (diff)
downloadgo-7c5ab4118014acd1e7c0fc67028186a4985c0a28.tar.xz
net: document LookupSRV cname return value
Document that the first return value of LookupSRV is the canonical name of the DNS target that was looked up, which may differ from the input name due to CNAME records. Fixes #49982 Change-Id: I574e0f5cdc381d3d9b11b5bd7a5acbea2c9e185d GitHub-Last-Rev: 9c756d48d55587f373c7cf273aa64c960a7a94a8 GitHub-Pull-Request: golang/go#77475 Reviewed-on: https://go-review.googlesource.com/c/go/+/742660 Reviewed-by: Nicholas Husin <husin@google.com> Reviewed-by: Nicholas Husin <nsh@golang.org> Reviewed-by: Damien Neil <dneil@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
-rw-r--r--src/net/lookup.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/net/lookup.go b/src/net/lookup.go
index d4be8eaa0e..06e14dfdda 100644
--- a/src/net/lookup.go
+++ b/src/net/lookup.go
@@ -487,6 +487,11 @@ func (r *Resolver) LookupCNAME(ctx context.Context, host string) (string, error)
// publishing SRV records under non-standard names, if both service
// and proto are empty strings, LookupSRV looks up name directly.
//
+// The returned cname is the owner name from the first SRV answer
+// record, which is typically the constructed DNS name
+// (_service._proto.name) but may differ if CNAME records redirect
+// the query to another name.
+//
// The returned service names are validated to be properly
// formatted presentation-format domain names. If the response contains
// invalid names, those records are filtered out and an error
@@ -505,6 +510,11 @@ func LookupSRV(service, proto, name string) (cname string, addrs []*SRV, err err
// publishing SRV records under non-standard names, if both service
// and proto are empty strings, LookupSRV looks up name directly.
//
+// The returned cname is the owner name from the first SRV answer
+// record, which is typically the constructed DNS name
+// (_service._proto.name) but may differ if CNAME records redirect
+// the query to another name.
+//
// The returned service names are validated to be properly
// formatted presentation-format domain names. If the response contains
// invalid names, those records are filtered out and an error