dns: prefixing txt record lookup with "_grpc_config." (#2691)
This commit is contained in:
@ -47,6 +47,8 @@ const (
|
||||
defaultFreq = time.Minute * 30
|
||||
defaultDNSSvrPort = "53"
|
||||
golang = "GO"
|
||||
// txtPrefix is the prefix string to be prepended to the host name for txt record lookup.
|
||||
txtPrefix = "_grpc_config."
|
||||
// In DNS, service config is encoded in a TXT record via the mechanism
|
||||
// described in RFC-1464 using the attribute name grpc_config.
|
||||
txtAttribute = "grpc_config="
|
||||
@ -282,7 +284,7 @@ func (d *dnsResolver) lookupSRV() []resolver.Address {
|
||||
}
|
||||
|
||||
func (d *dnsResolver) lookupTXT() string {
|
||||
ss, err := d.resolver.LookupTXT(d.ctx, d.host)
|
||||
ss, err := d.resolver.LookupTXT(d.ctx, txtPrefix+d.host)
|
||||
if err != nil {
|
||||
grpclog.Infof("grpc: failed dns TXT record lookup due to %v.\n", err)
|
||||
return ""
|
||||
|
@ -574,10 +574,10 @@ var scs = []string{
|
||||
// scLookupTbl is a set, which contains targets that have service config. Target
|
||||
// not in this set should not have service config.
|
||||
var scLookupTbl = map[string]bool{
|
||||
"foo.bar.com": true,
|
||||
"srv.ipv4.single.fake": true,
|
||||
"srv.ipv4.multi.fake": true,
|
||||
"no.attribute": true,
|
||||
txtPrefix + "foo.bar.com": true,
|
||||
txtPrefix + "srv.ipv4.single.fake": true,
|
||||
txtPrefix + "srv.ipv4.multi.fake": true,
|
||||
txtPrefix + "no.attribute": true,
|
||||
}
|
||||
|
||||
// generateSCF generates a slice of strings (aggregately representing a single
|
||||
|
Reference in New Issue
Block a user