func getAddress(svcName string) (string, error) { c := clb.NewClb("127.0.0.1", "8600", clb.Random) srvRecord := svcName + ".service.consul" address, err := c.GetAddress(srvRecord) if err != nil { return "", err } return address.String(), nil }
func dnsLb() (c clb.LoadBalancer) { dnsHost := os.Getenv("DNS_HOST") if dnsHost != "" { dnsPort := os.Getenv("DNS_PORT") if dnsPort == "" { dnsPort = "53" } c = clb.NewClb(dnsHost, dnsPort, clb.RoundRobin) } else { c = clb.NewDefaultClb(clb.RoundRobin) } return c }