dnsutils

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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 {
		AnonymizeIP bool   `yaml:"anonymize-ip"`
		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"`
	} `yaml:"subprocessors"`

	Loggers struct {
		Stdout struct {
			Enable bool   `yaml:"enable"`
			Mode   string `yaml:"mode"`
		} `yaml:"stdout"`
		WebServer struct {
			Enable           bool   `yaml:"enable"`
			ListenIP         string `yaml:"listen-ip"`
			ListenPort       int    `yaml:"listen-port"`
			TopMaxItems      int    `yaml:"top-max-items"`
			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"`
		} `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"`
		} `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"`
		} `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"`
	} `yaml:"loggers"`
}

func GetFakeConfig

func GetFakeConfig() *Config

func LoadConfig

func LoadConfig() (*Config, error)

func (*Config) SetDefault

func (c *Config) SetDefault()

type Counters

type Counters struct {
	Pps     uint64
	Pps_max uint64
	Qps     uint64
	Qps_max uint64
	Rps     uint64
	Rps_max uint64

	Queries_prev uint64
	Replies_prev uint64

	Queries      uint64
	Queries_ipv4 uint64
	Queries_ipv6 uint64
	Queries_udp  uint64
	Queries_tcp  uint64
	Queries_doh  uint64
	Queries_dot  uint64

	Replies      uint64
	Replies_ipv4 uint64
	Replies_ipv6 uint64
	Replies_udp  uint64
	Replies_tcp  uint64
	Replies_doh  uint64
	Replies_dot  uint64

	Latency0_1      uint64
	Latency1_10     uint64
	Latency10_50    uint64
	Latency50_100   uint64
	Latency100_1000 uint64
	Latency1000_inf uint64

	Qtype_a     uint64
	Qtype_aaaa  uint64
	Qtype_cname uint64
	Qtype_txt   uint64
	Qtype_ptr   uint64
	Qtype_soa   uint64
	Qtype_ns    uint64
	Qtype_srv   uint64
	Qtype_other uint64

	Rcode_noerror  uint64
	Rcode_servfail uint64
	Rcode_nxdomain uint64
	Rcode_refused  uint64
	Rcode_other    uint64
}

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:"identiy" msgpack:"identiy"`
	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-rfc3339" msgpack:"timestamp-rfc3339"`
	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"`
}

func GetFakeDnsMessage

func GetFakeDnsMessage() DnsMessage

func (*DnsMessage) Bytes

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

func (*DnsMessage) Init

func (dm *DnsMessage) Init()

func (*DnsMessage) String

func (dm *DnsMessage) String() string

type Statistics

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

func NewStatistics

func NewStatistics(maxitems int) *Statistics

func (*Statistics) Compute

func (c *Statistics) Compute()

func (*Statistics) GetCounters

func (c *Statistics) GetCounters() (ret Counters)

func (*Statistics) GetTopClients

func (c *Statistics) GetTopClients() (ret []topmap.TopMapItem)

func (*Statistics) GetTopOperations

func (c *Statistics) GetTopOperations() (ret []topmap.TopMapItem)

func (*Statistics) GetTopQnames

func (c *Statistics) GetTopQnames() (ret []topmap.TopMapItem)

func (*Statistics) GetTopRcodes

func (c *Statistics) GetTopRcodes() (ret []topmap.TopMapItem)

func (*Statistics) GetTopRrtypes

func (c *Statistics) GetTopRrtypes() (ret []topmap.TopMapItem)

func (*Statistics) GetTotalClients

func (c *Statistics) GetTotalClients() (ret int)

func (*Statistics) GetTotalDomains

func (c *Statistics) GetTotalDomains() (ret int)

func (*Statistics) Record

func (c *Statistics) Record(dm DnsMessage)

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