discover.go
func (d *Discover) Addrs(cfg string, l *log.Logger) ([]string, error) {
	d.once.Do(d.initProviders)

	args, err := Parse(cfg)
	if err != nil {
		return nil, fmt.Errorf("discover: %s", err)
	}

	name := args["provider"]
	if name == "" {
		return nil, fmt.Errorf("discover: no provider")
	}

	providers := d.Providers
	if providers == nil {
		providers = Providers
	}

	p := providers[name]
	if p == nil {
		return nil, fmt.Errorf("discover: unknown provider " + name)
	}
	l.Printf("[DEBUG] discover: Using provider %q", name)

	if typ, ok := p.(ProviderWithUserAgent); ok {
		typ.SetUserAgent(d.userAgent)
		return p.Addrs(args, l)
	}

	return p.Addrs(args, l)
}
func (d *Discover) Addrs(cfg string, l *log.Logger) ([]string, error) {
	d.once.Do(d.initProviders)

	args, err := Parse(cfg)
	if err != nil {
		return nil, fmt.Errorf("discover: %s", err)
	}

	name := args["provider"]
	if name == "" {
		return nil, fmt.Errorf("discover: no provider")
	}

	providers := d.Providers
	if providers == nil {
		providers = Providers
	}

	p := providers[name]
	if p == nil {
		return nil, fmt.Errorf("discover: unknown provider " + name)
	}
	l.Printf("[DEBUG] discover: Using provider %q", name)

	if typ, ok := p.(ProviderWithUserAgent); ok {
		typ.SetUserAgent(d.userAgent)
		return p.Addrs(args, l)
	}

	return p.Addrs(args, l)
}
func ( d * Discover ) Addrs ( cfg string , l * log . Logger ) ( [ ] string , error ) { d . once . Do ( d . initProviders ) args , err := Parse ( cfg ) if err != nil { return nil , fmt . Errorf ( " " , err ) } name := args [ " " ] if name == " " { return nil , fmt . Errorf ( " " ) } providers := d . Providers if providers == nil { providers = Providers } p := providers [ name ] if p == nil { return nil , fmt . Errorf ( " " + name ) } l . Printf ( " " , name ) if typ , ok := p . ( ProviderWithUserAgent ) ; ok { typ . SetUserAgent ( d . userAgent ) return p . Addrs ( args , l ) } return p . Addrs ( args , l ) }
// Addrs discovers ip addresses of nodes that match the given filter criteria.
// The config string must have the format 'provider=xxx key=val key=val ...'
// where the keys and values are provider specific. The values are URL encoded.
Addrs discovers ip addresses of nodes that match the given filter criteria . The config string must have the format provider = xxx key = val key = val ... where the keys and values are provider specific . The values are URL encoded .