zones: add ResolvePublicAddresses() ScanOption to prevent early LookupIP calls

Signed-off-by: Alejandro Mery <amery@jpi.io>
This commit is contained in:
2023-08-28 15:42:48 +00:00
parent 216bf5aa29
commit 0989dec5e8
3 changed files with 24 additions and 5 deletions
+16 -1
View File
@@ -12,7 +12,22 @@ import (
type ScanOption func(*Zones, *ScanOptions) error
// ScanOptions contains flags used by the initial scan
type ScanOptions struct{}
type ScanOptions struct {
// DontResolvePublicAddresses indicates we shouldn't
// pre-populate Machine.PublicAddresses during the
// initial scan
DontResolvePublicAddresses bool
}
// ResolvePublicAddresses instructs the scanner to use
// the DNS resolver to get PublicAddresses of nodes.
// Default is true
func ResolvePublicAddresses(resolve bool) ScanOption {
return func(m *Zones, opt *ScanOptions) error {
opt.DontResolvePublicAddresses = !resolve
return nil
}
}
// WithLookuper specifies what resolver.Lookuper to use to
// find public addresses