Documentation ¶
Overview ¶
Package socket captures active sockets and the processes that own them.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
ReverseLookup *ReverseLookupConfig `config:"socket.reverse_lookup"`
}
Config is the configuration specific to the socket MetricSet.
type Direction ¶
type Direction uint8
Direction indicates how a socket was initiated.
const ( // Incoming indicates a connection was established from the outside to // listening socket on this host. Incoming Direction // Outgoing indicates a connection was established from this socket to an // external listening socket. Outgoing // Listening indicates a socket that is listening. Listening )
type ListenerTable ¶
type ListenerTable struct {
// contains filtered or unexported fields
}
ListenerTable tracks sockets that are listening. It can then be used to identify if a socket is listening, incoming, or outgoing.
func NewListenerTable ¶
func NewListenerTable() *ListenerTable
NewListenerTable returns a new ListenerTable.
func (*ListenerTable) Direction ¶
func (t *ListenerTable) Direction( proto uint8, localIP net.IP, localPort int, remoteIP net.IP, remotePort int, ) Direction
Direction returns whether the connection was incoming or outgoing based on the protocol and local address. It compares the given local address to the listeners in the table for the protocol and returns Incoming if there is a match. If remotePort is 0 then Listening is returned.
type MetricSet ¶
type MetricSet struct { mb.BaseMetricSet // contains filtered or unexported fields }
type ProcTable ¶
type ProcTable struct {
// contains filtered or unexported fields
}
ProcTable contains all of the active processes (if the current user is root).
func NewProcTable ¶
NewProcTable returns a new ProcTable that reads data from the /proc directory by default. An alternative proc filesystem mountpoint can be specified through the mountpoint parameter.
func (*ProcTable) ProcessBySocketInode ¶
ProcessBySocketInode returns the Proc associated with the given socket inode.
type ReverseLookupCache ¶
type ReverseLookupCache struct {
// contains filtered or unexported fields
}
ReverseLookupCache is a cache for storing and retrieving the results of reverse DNS queries. It caches the results of queries regardless of their outcome (success or failure). The result is cached for the amount of time specified by parameters and not based on the TTL from the PTR record.
func NewReverseLookupCache ¶
func NewReverseLookupCache(successTTL, failureTTL time.Duration) *ReverseLookupCache
NewReverseLookupCache returns a new cache.
func (*ReverseLookupCache) Cleanup ¶
func (c *ReverseLookupCache) Cleanup()
Cleanup removes expired entries from the cache.
type ReverseLookupConfig ¶
type ReverseLookupConfig struct { Enabled *bool `config:"enabled"` SuccessTTL time.Duration `config:"success_ttl"` FailureTTL time.Duration `config:"failure_ttl"` }
ReverseLookupConfig contains the configuration that controls the reverse DNS lookup behavior.
func (*ReverseLookupConfig) IsEnabled ¶
func (c *ReverseLookupConfig) IsEnabled() bool
IsEnabled returns true if reverse_lookup is defined and 'enabled' is either not set or set to true.