workers

package
v0.44.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 9, 2024 License: MIT Imports: 73 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExpectedQname         = "dnscollector.dev"
	ExpectedQname2        = "dns.collector"
	ExpectedBufferMsg511  = ".*buffer is full, 511.*"
	ExpectedBufferMsg1023 = ".*buffer is full, 1023.*"
	ExpectedIdentity      = "powerdnspb"
)
View Source
const (
	SeverityFinest scalyrSeverity = iota
	SeverityFiner
	SeverityFine
	SeverityInfo
	SeverityWarning
	SeverityError
	SeverityFatal
)

Variables

View Source
var (
	ProtobufPowerDNSToDNSTap = map[string]string{
		"DNSQueryType":            "CLIENT_QUERY",
		"DNSResponseType":         "CLIENT_RESPONSE",
		"DNSOutgoingQueryType":    "RESOLVER_QUERY",
		"DNSIncomingResponseType": "RESOLVER_RESPONSE",
	}
)

Functions

func GetFakeDNSTap

func GetFakeDNSTap(dnsquery []byte) *dnstap.Dnstap

func GetPriority

func GetPriority(facility string) (syslog.Priority, error)

func GetResolverIP

func GetResolverIP(dm *dnsutils.DNSMessage) string

func GetStreamGlobal

func GetStreamGlobal(dm *dnsutils.DNSMessage) string

Selectors

func GetStreamID

func GetStreamID(dm *dnsutils.DNSMessage) string

func IsStdoutValidMode

func IsStdoutValidMode(mode string) bool

func IsValid

func IsValid(mode string) bool

func IsValidMode

func IsValidMode(mode string) bool

func SanitizeMetricName

func SanitizeMetricName(metricName string) string

OpenMetrics and the Prometheus exposition format require the metric name to consist only of alphanumericals and "_", ":" and they must not start with digits.

Types

type AfpacketSniffer

type AfpacketSniffer struct {
	*pkgutils.GenericWorker
	// contains filtered or unexported fields
}

func NewAfpacketSniffer

func NewAfpacketSniffer(next []pkgutils.Worker, config *pkgconfig.Config, logger *logger.Logger, name string) *AfpacketSniffer

func (*AfpacketSniffer) Listen

func (w *AfpacketSniffer) Listen() error

func (*AfpacketSniffer) StartCollect

func (w *AfpacketSniffer) StartCollect()

type ClickhouseClient

type ClickhouseClient struct {
	*pkgutils.GenericWorker
}

func NewClickhouseClient

func NewClickhouseClient(config *pkgconfig.Config, console *logger.Logger, name string) *ClickhouseClient

func (*ClickhouseClient) StartCollect

func (w *ClickhouseClient) StartCollect()

func (*ClickhouseClient) StartLogging

func (w *ClickhouseClient) StartLogging()

type ClickhouseData

type ClickhouseData struct {
	Identity  string `json:"identity"`
	QueryIP   string `json:"query_ip"`
	QName     string `json:"q_name"`
	Operation string `json:"operation"`
	Family    string `json:"family"`
	Protocol  string `json:"protocol"`
	QType     string `json:"q_type"`
	RCode     string `json:"r_code"`
	TimeNSec  string `json:"timensec"`
	TimeStamp string `json:"timestamp"`
}

type DNSMessage

type DNSMessage struct {
	*pkgutils.GenericWorker
	// contains filtered or unexported fields
}

func NewDNSMessage

func NewDNSMessage(next []pkgutils.Worker, config *pkgconfig.Config, logger *logger.Logger, name string) *DNSMessage

func (*DNSMessage) GetInputChannel

func (w *DNSMessage) GetInputChannel() chan dnsutils.DNSMessage

func (*DNSMessage) LoadData

func (w *DNSMessage) LoadData(matchSource string, srcKind string) (MatchSource, error)

func (*DNSMessage) LoadFromFile

func (w *DNSMessage) LoadFromFile(filePath string, srcKind string) (MatchSource, error)

func (*DNSMessage) LoadFromURL

func (w *DNSMessage) LoadFromURL(matchSource string, srcKind string) (MatchSource, error)

func (*DNSMessage) ReadConfig

func (w *DNSMessage) ReadConfig()

func (*DNSMessage) ReadConfigMatching

func (w *DNSMessage) ReadConfigMatching(value interface{})

func (*DNSMessage) StartCollect

func (w *DNSMessage) StartCollect()

type DNSProcessor

type DNSProcessor struct {
	ConfigChan chan *pkgconfig.Config

	RoutingHandler pkgutils.RoutingHandler
	// contains filtered or unexported fields
}

func NewDNSProcessor

func NewDNSProcessor(config *pkgconfig.Config, logger *logger.Logger, name string, size int) DNSProcessor

func (*DNSProcessor) GetChannel

func (d *DNSProcessor) GetChannel() chan dnsutils.DNSMessage

func (*DNSProcessor) GetChannelList

func (d *DNSProcessor) GetChannelList() []chan dnsutils.DNSMessage

func (*DNSProcessor) LogError

func (d *DNSProcessor) LogError(msg string, v ...interface{})

func (*DNSProcessor) LogInfo

func (d *DNSProcessor) LogInfo(msg string, v ...interface{})

func (*DNSProcessor) MonitorLoggers

func (d *DNSProcessor) MonitorLoggers()

func (*DNSProcessor) Run

func (d *DNSProcessor) Run(defaultWorkers []pkgutils.Worker, droppedworkers []pkgutils.Worker)

func (*DNSProcessor) Stop

func (d *DNSProcessor) Stop()

type DNSTapProcessor

type DNSTapProcessor struct {
	ConnID   int
	PeerName string

	ConfigChan chan *pkgconfig.Config

	RoutingHandler pkgutils.RoutingHandler
	// contains filtered or unexported fields
}

func NewDNSTapProcessor

func NewDNSTapProcessor(connID int, peerName string, config *pkgconfig.Config, logger *logger.Logger, name string, size int) DNSTapProcessor

func (*DNSTapProcessor) GetChannel

func (d *DNSTapProcessor) GetChannel() chan []byte

func (*DNSTapProcessor) LogError

func (d *DNSTapProcessor) LogError(msg string, v ...interface{})

func (*DNSTapProcessor) LogInfo

func (d *DNSTapProcessor) LogInfo(msg string, v ...interface{})

func (*DNSTapProcessor) MonitorLoggers

func (d *DNSTapProcessor) MonitorLoggers()

func (*DNSTapProcessor) Run

func (d *DNSTapProcessor) Run(defaultWorkers []pkgutils.Worker, droppedworkers []pkgutils.Worker)

func (*DNSTapProcessor) Stop

func (d *DNSTapProcessor) Stop()

type DevNull

type DevNull struct {
	*pkgutils.GenericWorker
}

func NewDevNull

func NewDevNull(config *pkgconfig.Config, console *logger.Logger, name string) *DevNull

func (*DevNull) StartCollect

func (w *DevNull) StartCollect()

func (*DevNull) StartLogging

func (w *DevNull) StartLogging()

type DnstapProxifier

type DnstapProxifier struct {
	*pkgutils.GenericWorker
	// contains filtered or unexported fields
}

func NewDnstapProxifier

func NewDnstapProxifier(next []pkgutils.Worker, config *pkgconfig.Config, logger *logger.Logger, name string) *DnstapProxifier

func (*DnstapProxifier) CheckConfig

func (w *DnstapProxifier) CheckConfig()

func (*DnstapProxifier) HandleConn

func (w *DnstapProxifier) HandleConn(conn net.Conn, connID uint64, forceClose chan bool, wg *sync.WaitGroup)

func (*DnstapProxifier) HandleFrame

func (w *DnstapProxifier) HandleFrame(recvFrom chan []byte, sendTo []chan dnsutils.DNSMessage)

func (*DnstapProxifier) StartCollect

func (w *DnstapProxifier) StartCollect()

type DnstapSender

type DnstapSender struct {
	*pkgutils.GenericWorker
	// contains filtered or unexported fields
}

func NewDnstapSender

func NewDnstapSender(config *pkgconfig.Config, logger *logger.Logger, name string) *DnstapSender

func (*DnstapSender) ConnectToRemote

func (w *DnstapSender) ConnectToRemote()

func (*DnstapSender) Disconnect

func (w *DnstapSender) Disconnect()

func (*DnstapSender) FlushBuffer

func (w *DnstapSender) FlushBuffer(buf *[]dnsutils.DNSMessage)

func (*DnstapSender) ReadConfig

func (w *DnstapSender) ReadConfig()

func (*DnstapSender) StartCollect

func (w *DnstapSender) StartCollect()

func (*DnstapSender) StartLogging

func (w *DnstapSender) StartLogging()

type DnstapServer

type DnstapServer struct {
	*pkgutils.GenericWorker
	// contains filtered or unexported fields
}

func NewDnstapServer

func NewDnstapServer(next []pkgutils.Worker, config *pkgconfig.Config, logger *logger.Logger, name string) *DnstapServer

func (*DnstapServer) CheckConfig

func (w *DnstapServer) CheckConfig()

func (*DnstapServer) HandleConn

func (w *DnstapServer) HandleConn(conn net.Conn, connID uint64, forceClose chan bool, wg *sync.WaitGroup)

func (*DnstapServer) StartCollect

func (w *DnstapServer) StartCollect()

type ElasticSearchClient

type ElasticSearchClient struct {
	*pkgutils.GenericWorker
	// contains filtered or unexported fields
}

func NewElasticSearchClient

func NewElasticSearchClient(config *pkgconfig.Config, console *logger.Logger, name string) *ElasticSearchClient

func (*ElasticSearchClient) ReadConfig

func (w *ElasticSearchClient) ReadConfig()

func (*ElasticSearchClient) StartCollect

func (w *ElasticSearchClient) StartCollect()

func (*ElasticSearchClient) StartLogging

func (w *ElasticSearchClient) StartLogging()

type EpsCounters

type EpsCounters struct {
	Eps, EpsMax                  uint64
	TotalEvents, TotalEventsPrev uint64

	TotalRcodes, TotalQtypes                       map[string]float64
	TotalIPVersion, TotalIPProtocol                map[string]float64
	TotalDNSMessages                               float64
	TotalQueries, TotalReplies                     int
	TotalBytes, TotalBytesSent, TotalBytesReceived int

	TotalTC, TotalAA, TotalRA, TotalAD               float64
	TotalMalformed, TotalFragmented, TotalReasembled float64
}

EpsCounters (Events Per Second) - is a set of metrics we calculate on per-second basis. For others we rely on averaging by collector

type FalcoClient

type FalcoClient struct {
	*pkgutils.GenericWorker
}

func NewFalcoClient

func NewFalcoClient(config *pkgconfig.Config, console *logger.Logger, name string) *FalcoClient

func (*FalcoClient) StartCollect

func (w *FalcoClient) StartCollect()

func (*FalcoClient) StartLogging

func (w *FalcoClient) StartLogging()

type FileIngestor

type FileIngestor struct {
	*pkgutils.GenericWorker
	// contains filtered or unexported fields
}

func NewFileIngestor

func NewFileIngestor(next []pkgutils.Worker, config *pkgconfig.Config, logger *logger.Logger, name string) *FileIngestor

func (*FileIngestor) CheckConfig

func (w *FileIngestor) CheckConfig()

func (*FileIngestor) ProcessDnstap

func (w *FileIngestor) ProcessDnstap(filePath string) error

func (*FileIngestor) ProcessFile

func (w *FileIngestor) ProcessFile(filePath string)

func (*FileIngestor) ProcessPcap

func (w *FileIngestor) ProcessPcap(filePath string)

func (*FileIngestor) RegisterEvent

func (w *FileIngestor) RegisterEvent(filePath string)

func (*FileIngestor) RemoveEvent

func (w *FileIngestor) RemoveEvent(filePath string)

func (*FileIngestor) StartCollect

func (w *FileIngestor) StartCollect()

type FluentdClient

type FluentdClient struct {
	*pkgutils.GenericWorker
	// contains filtered or unexported fields
}

func NewFluentdClient

func NewFluentdClient(config *pkgconfig.Config, logger *logger.Logger, name string) *FluentdClient

func (*FluentdClient) ConnectToRemote

func (w *FluentdClient) ConnectToRemote()

func (*FluentdClient) Disconnect

func (w *FluentdClient) Disconnect()

func (*FluentdClient) FlushBuffer

func (w *FluentdClient) FlushBuffer(buf *[]dnsutils.DNSMessage)

func (*FluentdClient) ReadConfig

func (w *FluentdClient) ReadConfig()

func (*FluentdClient) StartCollect

func (w *FluentdClient) StartCollect()

func (*FluentdClient) StartLogging

func (w *FluentdClient) StartLogging()

type HitsRecord

type HitsRecord struct {
	TotalHits int            `json:"total-hits"`
	Hits      map[string]int `json:"hits"`
}

type HitsStream

type HitsStream struct {
	Streams map[string]SearchBy
}

type HitsUniq

type HitsUniq struct {
	Clients        map[string]int
	Domains        map[string]int
	NxDomains      map[string]int
	SfDomains      map[string]int
	PublicSuffixes map[string]int
	Suspicious     map[string]*dnsutils.TransformSuspicious
}

type InfluxDBClient

type InfluxDBClient struct {
	*pkgutils.GenericWorker
	// contains filtered or unexported fields
}

func NewInfluxDBClient

func NewInfluxDBClient(config *pkgconfig.Config, logger *logger.Logger, name string) *InfluxDBClient

func (*InfluxDBClient) StartCollect

func (w *InfluxDBClient) StartCollect()

func (*InfluxDBClient) StartLogging

func (w *InfluxDBClient) StartLogging()

type KafkaProducer

type KafkaProducer struct {
	*pkgutils.GenericWorker
	// contains filtered or unexported fields
}

func NewKafkaProducer

func NewKafkaProducer(config *pkgconfig.Config, logger *logger.Logger, name string) *KafkaProducer

func (*KafkaProducer) ConnectToKafka

func (w *KafkaProducer) ConnectToKafka(ctx context.Context, readyTimer *time.Timer)

func (*KafkaProducer) Disconnect

func (w *KafkaProducer) Disconnect()

func (*KafkaProducer) FlushBuffer

func (w *KafkaProducer) FlushBuffer(buf *[]dnsutils.DNSMessage)

func (*KafkaProducer) ReadConfig

func (w *KafkaProducer) ReadConfig()

func (*KafkaProducer) StartCollect

func (w *KafkaProducer) StartCollect()

func (*KafkaProducer) StartLogging

func (w *KafkaProducer) StartLogging()

type KeyHit

type KeyHit struct {
	Key string `json:"key"`
	Hit int    `json:"hit"`
}

type LogFile

type LogFile struct {
	*pkgutils.GenericWorker
	// contains filtered or unexported fields
}

func NewLogFile

func NewLogFile(config *pkgconfig.Config, logger *logger.Logger, name string) *LogFile

func (*LogFile) Cleanup

func (w *LogFile) Cleanup() error

func (*LogFile) CompressFile

func (w *LogFile) CompressFile()

func (*LogFile) CompressPostRotateCommand

func (w *LogFile) CompressPostRotateCommand(filename string)

func (*LogFile) FlushWriters

func (w *LogFile) FlushWriters()

func (*LogFile) GetMaxSize

func (w *LogFile) GetMaxSize() int64

func (*LogFile) OpenFile

func (w *LogFile) OpenFile() error

func (*LogFile) PostRotateCommand

func (w *LogFile) PostRotateCommand(filename string)

func (*LogFile) ReadConfig

func (w *LogFile) ReadConfig()

func (*LogFile) RotateFile

func (w *LogFile) RotateFile() error

func (*LogFile) StartCollect

func (w *LogFile) StartCollect()

func (*LogFile) StartLogging

func (w *LogFile) StartLogging()

func (*LogFile) WriteToDnstap

func (w *LogFile) WriteToDnstap(data []byte)

func (*LogFile) WriteToPcap

func (w *LogFile) WriteToPcap(dm dnsutils.DNSMessage, pkt []gopacket.SerializableLayer)

func (*LogFile) WriteToPlain

func (w *LogFile) WriteToPlain(data []byte)

type LokiClient

type LokiClient struct {
	*pkgutils.GenericWorker
	// contains filtered or unexported fields
}

func NewLokiClient

func NewLokiClient(config *pkgconfig.Config, logger *logger.Logger, name string) *LokiClient

func (*LokiClient) ReadConfig

func (w *LokiClient) ReadConfig()

func (*LokiClient) SendEntries

func (w *LokiClient) SendEntries(buf []byte)

func (*LokiClient) StartCollect

func (w *LokiClient) StartCollect()

func (*LokiClient) StartLogging

func (w *LokiClient) StartLogging()

type LokiStream

type LokiStream struct {
	// contains filtered or unexported fields
}

func (*LokiStream) Encode2Proto

func (w *LokiStream) Encode2Proto() ([]byte, error)

func (*LokiStream) Init

func (w *LokiStream) Init()

func (*LokiStream) ResetEntries

func (w *LokiStream) ResetEntries()

type MatchSource

type MatchSource struct {
	// contains filtered or unexported fields
}

type PdnsProcessor

type PdnsProcessor struct {
	ConnID   int
	PeerName string

	ConfigChan chan *pkgconfig.Config

	RoutingHandler pkgutils.RoutingHandler
	// contains filtered or unexported fields
}

func NewPdnsProcessor

func NewPdnsProcessor(connID int, peerName string, config *pkgconfig.Config, logger *logger.Logger, name string, size int) PdnsProcessor

func (*PdnsProcessor) GetChannel

func (p *PdnsProcessor) GetChannel() chan []byte

func (*PdnsProcessor) LogError

func (p *PdnsProcessor) LogError(msg string, v ...interface{})

func (*PdnsProcessor) LogInfo

func (p *PdnsProcessor) LogInfo(msg string, v ...interface{})

func (*PdnsProcessor) MonitorLoggers

func (p *PdnsProcessor) MonitorLoggers()

func (*PdnsProcessor) Run

func (p *PdnsProcessor) Run(defaultWorkers []pkgutils.Worker, droppedworkers []pkgutils.Worker)

func (*PdnsProcessor) Stop

func (p *PdnsProcessor) Stop()

type PdnsServer

type PdnsServer struct {
	*pkgutils.GenericWorker
	// contains filtered or unexported fields
}

func NewPdnsServer

func NewPdnsServer(next []pkgutils.Worker, config *pkgconfig.Config, logger *logger.Logger, name string) *PdnsServer

func (*PdnsServer) CheckConfig

func (w *PdnsServer) CheckConfig()

func (*PdnsServer) HandleConn

func (w *PdnsServer) HandleConn(conn net.Conn, connID uint64, forceClose chan bool, wg *sync.WaitGroup)

func (*PdnsServer) StartCollect

func (w *PdnsServer) StartCollect()

type PromCounterCatalogueContainer

type PromCounterCatalogueContainer struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

PromCounterCatalogueContainer is the implementation of PrometheusCountersCatalogue interface That maps a single label into other Containers or CounterSet The 'chain' of nested Containers keep track of labelNames requested by the config to figure out whether nested Container should be created, or, if all labels but the last one already considered at the upper levels, it is time to create individual CounterSet

func CreateSystemCatalogue

func CreateSystemCatalogue(w *Prometheus) ([]string, *PromCounterCatalogueContainer)

This function checks the configuration, to determine which label dimensions were requested by configuration, and returns correct implementation of Catalogue.

func NewPromCounterCatalogueContainer

func NewPromCounterCatalogueContainer(w *Prometheus, selLabels []string, l map[string]string) *PromCounterCatalogueContainer

func (*PromCounterCatalogueContainer) GetAllCounterSets

func (w *PromCounterCatalogueContainer) GetAllCounterSets() []*PrometheusCountersSet

Returns a slice of all PrometheusCountersSet in a Container

func (*PromCounterCatalogueContainer) GetCountersSet

Searches for an existing element for a label value, creating one if not found

type Prometheus

type Prometheus struct {
	*pkgutils.GenericWorker

	sync.Mutex
	// contains filtered or unexported fields
}

func NewPrometheus

func NewPrometheus(config *pkgconfig.Config, logger *logger.Logger, name string) *Prometheus

func (*Prometheus) ComputeEventsPerSecond

func (w *Prometheus) ComputeEventsPerSecond()

func (*Prometheus) InitProm

func (w *Prometheus) InitProm()

func (*Prometheus) ListenAndServe

func (w *Prometheus) ListenAndServe()

func (*Prometheus) ReadConfig

func (w *Prometheus) ReadConfig()

func (*Prometheus) Record

func (w *Prometheus) Record(dm dnsutils.DNSMessage)

func (*Prometheus) StartCollect

func (w *Prometheus) StartCollect()

func (*Prometheus) StartLogging

func (w *Prometheus) StartLogging()

type PrometheusCountersCatalogue

type PrometheusCountersCatalogue interface {
	// Prometheus logger encapsulates stats counters (PrometheusCounterSet) inside
	// PromCounterCatalogueContainer's. For each label the logger creates a nested level
	// of containers.
	// Containers and CounterSets must implemnent PrometheusCountersCatalogue interface
	// to allow fetching a CounterSet by the list of metric/values by fetching values from
	// the DNS message it logs.
	// There is a schematic sample layout when there are 2 labels considered at the end of this file
	GetCountersSet(*dnsutils.DNSMessage) PrometheusCountersCatalogue
}

type PrometheusCountersSet

type PrometheusCountersSet struct {
	sync.Mutex // Each PrometheusCountersSet locks independently
	// contains filtered or unexported fields
}

This type represents a set of counters for a unique set of label name=value pairs. By default, we create a set per setream_id for backward compatibility However, we can allow slicing and dicing data using more dimensions. Each CounterSet is registered with Prometheus collection independently (wrapping label values)

func (*PrometheusCountersSet) Collect

func (w *PrometheusCountersSet) Collect(ch chan<- prometheus.Metric)

func (*PrometheusCountersSet) ComputeEventsPerSecond

func (w *PrometheusCountersSet) ComputeEventsPerSecond()

func (*PrometheusCountersSet) Describe

func (w *PrometheusCountersSet) Describe(ch chan<- *prometheus.Desc)

each CounterSet has the same list of timeseries descriptors, so it uses descriptros from the Prometheus instance the set belongs to.

func (*PrometheusCountersSet) GetCountersSet

func (*PrometheusCountersSet) Record

Updates all counters for a specific set of labelName=labelValue

type RedisPub

type RedisPub struct {
	*pkgutils.GenericWorker
	// contains filtered or unexported fields
}

func NewRedisPub

func NewRedisPub(config *pkgconfig.Config, logger *logger.Logger, name string) *RedisPub

func (*RedisPub) ConnectToRemote

func (w *RedisPub) ConnectToRemote()

func (*RedisPub) Disconnect

func (w *RedisPub) Disconnect()

func (*RedisPub) FlushBuffer

func (w *RedisPub) FlushBuffer(buf *[]dnsutils.DNSMessage)

func (*RedisPub) ReadConfig

func (w *RedisPub) ReadConfig()

func (*RedisPub) ReadFromConnection

func (w *RedisPub) ReadFromConnection()

func (*RedisPub) StartCollect

func (w *RedisPub) StartCollect()

func (*RedisPub) StartLogging

func (w *RedisPub) StartLogging()

type RestAPI

type RestAPI struct {
	*pkgutils.GenericWorker

	HitsStream HitsStream
	HitsUniq   HitsUniq

	Streams map[string]int `json:"streams"`

	TopQnames      *topmap.TopMap
	TopClients     *topmap.TopMap
	TopTLDs        *topmap.TopMap
	TopNonExistent *topmap.TopMap
	TopServFail    *topmap.TopMap

	sync.RWMutex
	// contains filtered or unexported fields
}

func NewRestAPI

func NewRestAPI(config *pkgconfig.Config, logger *logger.Logger, name string) *RestAPI

func (*RestAPI) BasicAuth

func (w *RestAPI) BasicAuth(httpWriter http.ResponseWriter, r *http.Request) bool

func (*RestAPI) DeleteResetHandler

func (w *RestAPI) DeleteResetHandler(httpWriter http.ResponseWriter, r *http.Request)

func (*RestAPI) GetClientsHandler

func (w *RestAPI) GetClientsHandler(httpWriter http.ResponseWriter, r *http.Request)

func (*RestAPI) GetDomainsHandler

func (w *RestAPI) GetDomainsHandler(httpWriter http.ResponseWriter, r *http.Request)

func (*RestAPI) GetNxDomainsHandler

func (w *RestAPI) GetNxDomainsHandler(httpWriter http.ResponseWriter, r *http.Request)

func (*RestAPI) GetSearchHandler

func (w *RestAPI) GetSearchHandler(httpWriter http.ResponseWriter, r *http.Request)

func (*RestAPI) GetSfDomainsHandler

func (w *RestAPI) GetSfDomainsHandler(httpWriter http.ResponseWriter, r *http.Request)

func (*RestAPI) GetStreamsHandler

func (w *RestAPI) GetStreamsHandler(httpWriter http.ResponseWriter, r *http.Request)

func (*RestAPI) GetSuspiciousHandler

func (w *RestAPI) GetSuspiciousHandler(httpWriter http.ResponseWriter, r *http.Request)

func (*RestAPI) GetTLDsHandler

func (w *RestAPI) GetTLDsHandler(httpWriter http.ResponseWriter, r *http.Request)

func (*RestAPI) GetTopClientsHandler

func (w *RestAPI) GetTopClientsHandler(httpWriter http.ResponseWriter, r *http.Request)

func (*RestAPI) GetTopDomainsHandler

func (w *RestAPI) GetTopDomainsHandler(httpWriter http.ResponseWriter, r *http.Request)

func (*RestAPI) GetTopNxDomainsHandler

func (w *RestAPI) GetTopNxDomainsHandler(httpWriter http.ResponseWriter, r *http.Request)

func (*RestAPI) GetTopSfDomainsHandler

func (w *RestAPI) GetTopSfDomainsHandler(httpWriter http.ResponseWriter, r *http.Request)

func (*RestAPI) GetTopTLDsHandler

func (w *RestAPI) GetTopTLDsHandler(httpWriter http.ResponseWriter, r *http.Request)

func (*RestAPI) ListenAndServe

func (w *RestAPI) ListenAndServe()

func (*RestAPI) ReadConfig

func (w *RestAPI) ReadConfig()

func (*RestAPI) RecordDNSMessage

func (w *RestAPI) RecordDNSMessage(dm dnsutils.DNSMessage)

func (*RestAPI) StartCollect

func (w *RestAPI) StartCollect()

func (*RestAPI) StartLogging

func (w *RestAPI) StartLogging()

type ScalyrClient

type ScalyrClient struct {
	*pkgutils.GenericWorker
	// contains filtered or unexported fields
}

ScalyrClient is a client for Scalyr(https://www.dataset.com/) This client is using the addEvents endpoint, described here: https://app.scalyr.com/help/api#addEvents

func NewScalyrClient

func NewScalyrClient(config *pkgconfig.Config, console *logger.Logger, name string) *ScalyrClient

func (*ScalyrClient) ReadConfig

func (w *ScalyrClient) ReadConfig()

func (*ScalyrClient) StartCollect

func (w *ScalyrClient) StartCollect()

func (*ScalyrClient) StartLogging

func (w *ScalyrClient) StartLogging()

type SearchBy

type SearchBy struct {
	Clients map[string]*HitsRecord
	Domains map[string]*HitsRecord
}

type StatsPerStream

type StatsPerStream struct {
	TotalPackets       int
	TotalSentBytes     int
	TotalReceivedBytes int

	Clients   map[string]int
	Domains   map[string]int
	Nxdomains map[string]int

	RRtypes    map[string]int
	Rcodes     map[string]int
	Operations map[string]int
	Transports map[string]int
	IPproto    map[string]int

	TopRcodes     *topmap.TopMap
	TopOperations *topmap.TopMap
	TopIPproto    *topmap.TopMap
	TopTransport  *topmap.TopMap
	TopRRtypes    *topmap.TopMap
}

type StatsdClient

type StatsdClient struct {
	*pkgutils.GenericWorker
	Stats StreamStats
	sync.RWMutex
}

func NewStatsdClient

func NewStatsdClient(config *pkgconfig.Config, logger *logger.Logger, name string) *StatsdClient

func (*StatsdClient) ReadConfig

func (w *StatsdClient) ReadConfig()

func (*StatsdClient) RecordDNSMessage

func (w *StatsdClient) RecordDNSMessage(dm dnsutils.DNSMessage)

func (*StatsdClient) StartCollect

func (w *StatsdClient) StartCollect()

func (*StatsdClient) StartLogging

func (w *StatsdClient) StartLogging()

type StdOut

type StdOut struct {
	*pkgutils.GenericWorker
	// contains filtered or unexported fields
}

func NewStdOut

func NewStdOut(config *pkgconfig.Config, console *logger.Logger, name string) *StdOut

func (*StdOut) ReadConfig

func (w *StdOut) ReadConfig()

func (*StdOut) SetPcapWriter

func (w *StdOut) SetPcapWriter(pcapWriter io.Writer)

func (*StdOut) SetTextWriter

func (w *StdOut) SetTextWriter(b *bytes.Buffer)

func (*StdOut) StartCollect

func (w *StdOut) StartCollect()

func (*StdOut) StartLogging

func (w *StdOut) StartLogging()

type StreamStats

type StreamStats struct {
	Streams map[string]*StatsPerStream
}

type Syslog

type Syslog struct {
	*pkgutils.GenericWorker
	// contains filtered or unexported fields
}

func NewSyslog

func NewSyslog(config *pkgconfig.Config, console *logger.Logger, name string) *Syslog

func (*Syslog) ConnectToRemote

func (w *Syslog) ConnectToRemote()

func (*Syslog) FlushBuffer

func (w *Syslog) FlushBuffer(buf *[]dnsutils.DNSMessage)

func (*Syslog) ReadConfig

func (w *Syslog) ReadConfig()

func (*Syslog) StartCollect

func (w *Syslog) StartCollect()

func (*Syslog) StartLogging

func (w *Syslog) StartLogging()

type TCPClient

type TCPClient struct {
	*pkgutils.GenericWorker
	// contains filtered or unexported fields
}

func NewTCPClient

func NewTCPClient(config *pkgconfig.Config, logger *logger.Logger, name string) *TCPClient

func (*TCPClient) ConnectToRemote

func (w *TCPClient) ConnectToRemote()

func (*TCPClient) Disconnect

func (w *TCPClient) Disconnect()

func (*TCPClient) FlushBuffer

func (w *TCPClient) FlushBuffer(buf *[]dnsutils.DNSMessage)

func (*TCPClient) ReadConfig

func (w *TCPClient) ReadConfig()

func (*TCPClient) ReadFromConnection

func (w *TCPClient) ReadFromConnection()

func (*TCPClient) StartCollect

func (w *TCPClient) StartCollect()

func (*TCPClient) StartLogging

func (w *TCPClient) StartLogging()

type TZSPSniffer

type TZSPSniffer struct {
	*pkgutils.GenericWorker
	// contains filtered or unexported fields
}

func NewTZSP

func NewTZSP(next []pkgutils.Worker, config *pkgconfig.Config, logger *logger.Logger, name string) *TZSPSniffer

func (*TZSPSniffer) Listen

func (w *TZSPSniffer) Listen() error

func (*TZSPSniffer) StartCollect

func (w *TZSPSniffer) StartCollect()

type Tail

type Tail struct {
	*pkgutils.GenericWorker
	// contains filtered or unexported fields
}

func NewTail

func NewTail(next []pkgutils.Worker, config *pkgconfig.Config, logger *logger.Logger, name string) *Tail

func (*Tail) Follow

func (w *Tail) Follow() error

func (*Tail) StartCollect

func (w *Tail) StartCollect()

type XDPSniffer

type XDPSniffer struct {
	*pkgutils.GenericWorker
}

func NewXDPSniffer

func NewXDPSniffer(next []pkgutils.Worker, config *pkgconfig.Config, logger *logger.Logger, name string) *XDPSniffer

func (*XDPSniffer) StartCollect

func (w *XDPSniffer) StartCollect()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL