src/balancer/consul/random.go
func NewRandomDNSBalancer(environment string, consulAddr string, cacheTTL time.Duration) (balancer.DNS, error) {
	config := api.DefaultConfig()
	config.Address = consulAddr
	consul, err := api.NewClient(config)
	if err != nil {
		return nil, fmt.Errorf("Could not connect to consul: %v", err)
	}

	r := randomBalancer{}
	r.cache = make(map[string]cachedServiceLocation)
	r.environment = environment
	r.ttl = cacheTTL
	r.consulCatalog = consul.Health()
	return &r, nil
}
func NewRandomDNSBalancer(environment string, consulAddr string, cacheTTL time.Duration) (balancer.DNS, error) {
	config := api.DefaultConfig()
	config.Address = consulAddr
	consul, err := api.NewClient(config)
	if err != nil {
		return nil, fmt.Errorf("Could not connect to consul: %v", err)
	}

	r := randomBalancer{}
	r.cache = make(map[string]cachedServiceLocation)
	r.environment = environment
	r.ttl = cacheTTL
	r.consulCatalog = consul.Health()
	return &r, nil
}
func NewRandomDNSBalancer ( environment string , consulAddr string , cacheTTL time . Duration ) ( balancer . DNS , error ) { config := api . DefaultConfig ( ) config . Address = consulAddr consul , err := api . NewClient ( config ) if err != nil { return nil , fmt . Errorf ( " " , err ) } r := randomBalancer { } r . cache = make ( map [ string ] cachedServiceLocation ) r . environment = environment r . ttl = cacheTTL r . consulCatalog = consul . Health ( ) return & r , nil }
// NewRandomDNSBalancer will return a random balancer.DNS that looks up dns in consul.
NewRandomDNSBalancer will return a random balancer . DNS that looks up dns in consul .