Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrTimeout = errors.New("request timed out")
)
Functions ¶
This section is empty.
Types ¶
type AnyResolver ¶
type AnyResolver interface {
LookupAddr(ctx context.Context, addr string) (names []string, err error)
}
AnyResolver is for the net.Resolver
type RDNSCacheStats ¶
type ReverseDNS ¶
type ReverseDNS struct { Lookups []lookupEntry `toml:"lookup"` CacheTTL config.Duration `toml:"cache_ttl"` LookupTimeout config.Duration `toml:"lookup_timeout"` MaxParallelLookups int `toml:"max_parallel_lookups"` Ordered bool `toml:"ordered"` Log telegraf.Logger `toml:"-"` // contains filtered or unexported fields }
func (*ReverseDNS) Add ¶
func (r *ReverseDNS) Add(metric telegraf.Metric, _ telegraf.Accumulator) error
func (*ReverseDNS) Description ¶
func (r *ReverseDNS) Description() string
func (*ReverseDNS) SampleConfig ¶
func (r *ReverseDNS) SampleConfig() string
func (*ReverseDNS) Start ¶
func (r *ReverseDNS) Start(acc telegraf.Accumulator) error
func (*ReverseDNS) Stop ¶
func (r *ReverseDNS) Stop() error
type ReverseDNSCache ¶
type ReverseDNSCache struct { Resolver AnyResolver // contains filtered or unexported fields }
ReverseDNSCache is safe to use across multiple goroutines. if multiple goroutines request the same IP at the same time, one of the requests will trigger the lookup and the rest will wait for its response.
func NewReverseDNSCache ¶
func NewReverseDNSCache(ttl, lookupTimeout time.Duration, workerPoolSize int) *ReverseDNSCache
func (*ReverseDNSCache) Lookup ¶
func (d *ReverseDNSCache) Lookup(ip string) ([]string, error)
Lookup takes a string representing a parseable ipv4 or ipv6 IP, and blocks until it has resolved to 0-n results, or until its lookup timeout has elapsed. if the lookup timeout elapses, it returns an empty slice.
func (*ReverseDNSCache) Stats ¶
func (d *ReverseDNSCache) Stats() RDNSCacheStats
func (*ReverseDNSCache) Stop ¶
func (d *ReverseDNSCache) Stop()
Click to show internal directories.
Click to hide internal directories.