Commit 494227d9 authored by Miek Gieben's avatar Miek Gieben

Name things slightly better

Signed-off-by: default avatarMiek Gieben <miek@miek.nl>
parent cca578a4
package traffic package traffic
import "github.com/miekg/dns" import (
"github.com/miekg/dns"
)
// See https://github.com/grpc/grpc/blob/master/doc/service_config.md for the fields in this proto. // See https://github.com/grpc/grpc/blob/master/doc/service_config.md for the fields in this proto.
// We encode it as json and return it in a TXT field. // We encode it as json and return it in a TXT field.
var lbTXTxds = `grpc_config=[{"serviceConfig":{"loadBalancingConfig":[{"xds_experimental":{"lrs_load_reporting_server_name":""}}]}}]` var lbTXT = `grpc_config=[{"serviceConfig":{"loadBalancingConfig":[{"eds_experimental":{"LrsLoadReportingServerName":"","Cluster": "xds"}}]}}]`
// Current impl. that will be removed in favor of xds
var lbTXTgrpc = `grpc_config=[{"serviceConfig":{"loadBalancingConfig":[{"grpclb":{}}]}}]`
func txt(z string) []dns.RR { func txt(z string) []dns.RR {
return []dns.RR{&dns.TXT{ return []dns.RR{&dns.TXT{
Hdr: dns.RR_Header{Name: z, Rrtype: dns.TypeTXT, Class: dns.ClassINET, Ttl: 5}, Hdr: dns.RR_Header{Name: z, Rrtype: dns.TypeTXT, Class: dns.ClassINET, Ttl: 5},
Txt: []string{lbTXTgrpc}, Txt: []string{lbTXT},
}} }}
} }
...@@ -15,7 +15,7 @@ func TestSetup(t *testing.T) { ...@@ -15,7 +15,7 @@ func TestSetup(t *testing.T) {
} }
func TestLBTxt(t *testing.T) { func TestLBTxt(t *testing.T) {
for _, txt := range []string{lbTXTxds, lbTXTgrpc} { for _, txt := range []string{lbTXT} {
if _, err := json.Marshal(txt); err != nil { if _, err := json.Marshal(txt); err != nil {
t.Errorf("Failed to marshal grpc serverConfig: %s", err) t.Errorf("Failed to marshal grpc serverConfig: %s", err)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment