|
|
@ -27,7 +27,7 @@ type ScanOptions struct { |
|
|
|
// the DNS resolver to get PublicAddresses of nodes.
|
|
|
|
// the DNS resolver to get PublicAddresses of nodes.
|
|
|
|
// Default is true
|
|
|
|
// Default is true
|
|
|
|
func ResolvePublicAddresses(resolve bool) ScanOption { |
|
|
|
func ResolvePublicAddresses(resolve bool) ScanOption { |
|
|
|
return func(m *Cluster, opt *ScanOptions) error { |
|
|
|
return func(_ *Cluster, opt *ScanOptions) error { |
|
|
|
opt.DontResolvePublicAddresses = !resolve |
|
|
|
opt.DontResolvePublicAddresses = !resolve |
|
|
|
return nil |
|
|
|
return nil |
|
|
|
} |
|
|
|
} |
|
|
@ -36,7 +36,7 @@ func ResolvePublicAddresses(resolve bool) ScanOption { |
|
|
|
// WithLookuper specifies what resolver.Lookuper to use to
|
|
|
|
// WithLookuper specifies what resolver.Lookuper to use to
|
|
|
|
// find public addresses
|
|
|
|
// find public addresses
|
|
|
|
func WithLookuper(h resolver.Lookuper) ScanOption { |
|
|
|
func WithLookuper(h resolver.Lookuper) ScanOption { |
|
|
|
return func(m *Cluster, opt *ScanOptions) error { |
|
|
|
return func(m *Cluster, _ *ScanOptions) error { |
|
|
|
if h == nil { |
|
|
|
if h == nil { |
|
|
|
return fs.ErrInvalid |
|
|
|
return fs.ErrInvalid |
|
|
|
} |
|
|
|
} |
|
|
@ -49,7 +49,7 @@ func WithLookuper(h resolver.Lookuper) ScanOption { |
|
|
|
// public addresses. if nil is passed, the [net.Resolver] will be used.
|
|
|
|
// public addresses. if nil is passed, the [net.Resolver] will be used.
|
|
|
|
// The default is using Cloudflare's 1.1.1.1.
|
|
|
|
// The default is using Cloudflare's 1.1.1.1.
|
|
|
|
func WithResolver(h resolver.Resolver) ScanOption { |
|
|
|
func WithResolver(h resolver.Resolver) ScanOption { |
|
|
|
return func(m *Cluster, opt *ScanOptions) error { |
|
|
|
return func(m *Cluster, _ *ScanOptions) error { |
|
|
|
if h == nil { |
|
|
|
if h == nil { |
|
|
|
h = resolver.SystemResolver(true) |
|
|
|
h = resolver.SystemResolver(true) |
|
|
|
} |
|
|
|
} |
|
|
|