forked from premendrasingh/beats
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.go
31 lines (25 loc) · 810 Bytes
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package socket
import "time"
// Config is the configuration specific to the socket MetricSet.
type Config struct {
ReverseLookup *ReverseLookupConfig `config:"socket.reverse_lookup"`
}
// ReverseLookupConfig contains the configuration that controls the reverse
// DNS lookup behavior.
type ReverseLookupConfig struct {
Enabled *bool `config:"enabled"`
SuccessTTL time.Duration `config:"success_ttl"`
FailureTTL time.Duration `config:"failure_ttl"`
}
// IsEnabled returns true if reverse_lookup is defined and 'enabled' is either
// not set or set to true.
func (c *ReverseLookupConfig) IsEnabled() bool {
return c != nil && (c.Enabled == nil || *c.Enabled)
}
const (
defSuccessTTL = 60 * time.Second
defFailureTTL = 60 * time.Second
)
var defaultConfig = Config{
ReverseLookup: nil,
}