dnsutils

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsValidMode added in v0.11.0

func IsValidMode(mode string) bool

Types

type Config

type Config struct {
	Trace struct {
		Verbose    bool   `yaml:"verbose"`
		Filename   string `yaml:"filename"`
		MaxSize    int    `yaml:"max-size"`
		MaxBackups int    `yaml:"max-backups"`
	} `yaml:"trace"`

	Collectors struct {
		Tail struct {
			Enable       bool   `yaml:"enable"`
			TimeLayout   string `yaml:"time-layout"`
			PatternQuery string `yaml:"pattern-query"`
			PatternReply string `yaml:"pattern-reply"`
			FilePath     string `yaml:"file-path"`
		} `yaml:"tail"`
		Dnstap struct {
			Enable     bool   `yaml:"enable"`
			ListenIP   string `yaml:"listen-ip"`
			ListenPort int    `yaml:"listen-port"`
			SockPath   string `yaml:"sock-path"`
			TlsSupport bool   `yaml:"tls-support"`
			CertFile   string `yaml:"cert-file"`
			KeyFile    string `yaml:"key-file"`
		} `yaml:"dnstap"`
		DnsSniffer struct {
			Enable            bool   `yaml:"enable"`
			Port              int    `yaml:"port"`
			Device            string `yaml:"device"`
			CaptureDnsQueries bool   `yaml:"capture-dns-queries"`
			CaptureDnsReplies bool   `yaml:"capture-dns-replies"`
		} `yaml:"dns-sniffer"`
	} `yaml:"collectors"`

	Subprocessors struct {
		Statistics struct {
			TopMaxItems        int      `yaml:"top-max-items"`
			ThresholdQnameLen  int      `yaml:"threshold-qname-len"`
			ThresholdPacketLen int      `yaml:"threshold-packet-len"`
			ThresholdSlow      float64  `yaml:"threshold-slow"`
			CommonQtypes       []string `yaml:"common-qtypes,flow"`
		} `yaml:"statistics"`
		AnonymizeIP    bool   `yaml:"anonymize-ip"`
		QnameLowerCase bool   `yaml:"qname-lowercase"`
		CacheTtl       int    `yaml:"cache-ttl"`
		ServerId       string `yaml:"server-id"`
		Filtering      struct {
			IgnoreQname string `yaml:"ignore-qname"`
			LogQueries  bool   `yaml:"log-queries"`
			LogReplies  bool   `yaml:"log-replies"`
		} `yaml:"filtering"`
		GeoIP struct {
			DbFile string `yaml:"db-file"`
		} `yaml:"geoip"`
		TextFormat string `yaml:"text-format"`
	} `yaml:"subprocessors"`

	Loggers struct {
		Stdout struct {
			Enable     bool   `yaml:"enable"`
			Mode       string `yaml:"mode"`
			TextFormat string `yaml:"text-format"`
		} `yaml:"stdout"`
		WebServer struct {
			Enable           bool   `yaml:"enable"`
			ListenIP         string `yaml:"listen-ip"`
			ListenPort       int    `yaml:"listen-port"`
			BasicAuthLogin   string `yaml:"basic-auth-login"`
			BasicAuthPwd     string `yaml:"basic-auth-pwd"`
			TlsSupport       bool   `yaml:"tls-support"`
			CertFile         string `yaml:"cert-file"`
			KeyFile          string `yaml:"key-file"`
			PrometheusSuffix string `yaml:"prometheus-suffix"`
		} `yaml:"webserver"`
		LogFile struct {
			Enable            bool   `yaml:"enable"`
			FilePath          string `yaml:"file-path"`
			MaxSize           int    `yaml:"max-size"`
			MaxFiles          int    `yaml:"max-files"`
			FlushInterval     int    `yaml:"flush-interval"`
			Compress          bool   `yaml:"compress"`
			CompressInterval  int    `yaml:"compress-interval"`
			Mode              string `yaml:"mode"`
			PostRotateCommand string `yaml:"postrotate-command"`
			PostRotateDelete  bool   `yaml:"postrotate-delete-success"`
			TextFormat        string `yaml:"text-format"`
		} `yaml:"logfile"`
		Dnstap struct {
			Enable        bool   `yaml:"enable"`
			RemoteAddress string `yaml:"remote-address"`
			RemotePort    int    `yaml:"remote-port"`
			SockPath      string `yaml:"sock-path"`
			RetryInterval int    `yaml:"retry-interval"`
			TlsSupport    bool   `yaml:"tls-support"`
			TlsInsecure   bool   `yaml:"tls-insecure"`
		} `yaml:"dnstap"`
		TcpClient struct {
			Enable        bool   `yaml:"enable"`
			RemoteAddress string `yaml:"remote-address"`
			RemotePort    int    `yaml:"remote-port"`
			SockPath      string `yaml:"sock-path"`
			RetryInterval int    `yaml:"retry-interval"`
			Transport     string `yaml:"transport"`
			TlsSupport    bool   `yaml:"tls-support"`
			TlsInsecure   bool   `yaml:"tls-insecure"`
			Mode          string `yaml:"mode"`
			TextFormat    string `yaml:"text-format"`
		} `yaml:"tcpclient"`
		Syslog struct {
			Enable        bool   `yaml:"enable"`
			Severity      string `yaml:"severity"`
			Facility      string `yaml:"facility"`
			Transport     string `yaml:"transport"`
			RemoteAddress string `yaml:"remote-address"`
			TextFormat    string `yaml:"text-format"`
			Mode          string `yaml:"mode"`
			TlsSupport    bool   `yaml:"tls-support"`
			TlsInsecure   bool   `yaml:"tls-insecure"`
		} `yaml:"syslog"`
		Fluentd struct {
			Enable        bool   `yaml:"enable"`
			RemoteAddress string `yaml:"remote-address"`
			RemotePort    int    `yaml:"remote-port"`
			SockPath      string `yaml:"sock-path"`
			RetryInterval int    `yaml:"retry-interval"`
			Transport     string `yaml:"transport"`
			TlsSupport    bool   `yaml:"tls-support"`
			TlsInsecure   bool   `yaml:"tls-insecure"`
			Tag           string `yaml:"tag"`
		} `yaml:"fluentd"`
		PcapFile struct {
			Enable            bool   `yaml:"enable"`
			FilePath          string `yaml:"file-path"`
			MaxSize           int    `yaml:"max-size"`
			MaxFiles          int    `yaml:"max-files"`
			Compress          bool   `yaml:"compress"`
			CompressInterval  int    `yaml:"compress-interval"`
			PostRotateCommand string `yaml:"postrotate-command"`
			PostRotateDelete  bool   `yaml:"postrotate-delete-success"`
		} `yaml:"pcapfile"`
		InfluxDB struct {
			Enable       bool   `yaml:"enable"`
			ServerURL    string `yaml:"server-url"`
			AuthToken    string `yaml:"auth-token"`
			TlsSupport   bool   `yaml:"tls-support"`
			TlsInsecure  bool   `yaml:"tls-insecure"`
			Bucket       string `yaml:"bucket"`
			Organization string `yaml:"organization"`
		} `yaml:"influxdb"`
		LokiClient struct {
			Enable        bool   `yaml:"enable"`
			ServerURL     string `yaml:"server-url"`
			JobName       string `yaml:"job-name"`
			FlushInterval int    `yaml:"flush-interval"`
			BufferSize    int    `yaml:"buffer-size"`
			RetryInterval int    `yaml:"retry-interval"`
			TextFormat    string `yaml:"text-format"`
		} `yaml:"lokiclient"`
	} `yaml:"loggers"`
}

func GetFakeConfig

func GetFakeConfig() *Config

func LoadConfig

func LoadConfig(configPath string) (*Config, error)

func (*Config) SetDefault

func (c *Config) SetDefault()

type DnsAnswer

type DnsAnswer struct {
	Name      string `json:"name" msgpack:"name"`
	Rdatatype string `json:"rdatatype" msgpack:"rdatatype"`
	Class     int    `json:"-" msgpack:"-"`
	Ttl       int    `json:"ttl" msgpack:"ttl"`
	Rdata     string `json:"rdata" msgpack:"rdata"`
}

type DnsMessage

type DnsMessage struct {
	Operation        string      `json:"operation" msgpack:"operation"`
	Identity         string      `json:"identity" msgpack:"identity"`
	Family           string      `json:"family" msgpack:"family"`
	Protocol         string      `json:"protocol" msgpack:"protocol"`
	QueryIp          string      `json:"query-ip" msgpack:"query-ip"`
	QueryPort        string      `json:"query-port" msgpack:"query-port"`
	ResponseIp       string      `json:"response-ip" msgpack:"response-ip"`
	ResponsePort     string      `json:"response-port" msgpack:"response-port"`
	Type             string      `json:"-" msgpack:"-"`
	Payload          []byte      `json:"-" msgpack:"-"`
	Length           int         `json:"length" msgpack:"-"`
	Id               int         `json:"-" msgpack:"-"`
	Rcode            string      `json:"rcode" msgpack:"rcode"`
	Qname            string      `json:"qname" msgpack:"qname"`
	Qtype            string      `json:"qtype" msgpack:"qtype"`
	Latency          float64     `json:"-" msgpack:"-"`
	LatencySec       string      `json:"latency" msgpack:"latency"`
	TimestampRFC3339 string      `json:"timestamp-rfc3339ns" msgpack:"timestamp-rfc3339ns"`
	Timestamp        float64     `json:"-" msgpack:"-"`
	TimeSec          int         `json:"-" msgpack:"-"`
	TimeNsec         int         `json:"-" msgpack:"-"`
	Answers          []DnsAnswer `json:"answers" msgpack:"answers"`
	CountryIsoCode   string      `json:"country-isocode" msgpack:"country-isocode"`
	MalformedPacket  bool        `json:"malformed-packet" msgpack:"malformed-packet"`
}

func GetFakeDnsMessage

func GetFakeDnsMessage() DnsMessage

func (*DnsMessage) Bytes

func (dm *DnsMessage) Bytes(format []string) []byte

func (*DnsMessage) Init

func (dm *DnsMessage) Init()

func (*DnsMessage) String

func (dm *DnsMessage) String(format []string) string

type Worker

type Worker interface {
	Stop()
	Run()
	Channel() chan DnsMessage
}

Jump to

Keyboard shortcuts

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