statsdns

package
v2.8.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CLIENT     = "perClient"
	AUTHSERVER = "perServer"
	VIEW       = "perView"
	NOERROR    = "NOERROR"
	NXDOMAIN   = "NXDOMAIN"
	SERVFAIL   = "SERVFAIL"
	FORMERR    = "FORMERR"
	REFUSED    = "REFUSED"
	RR_NS      = "NS"
	RQ_C_MAP   = "Incoming"
	RQ_S_MAP   = "Outgoing"
	QUERY      = "Query"
	RESPONSE   = "Response"
	RQ_ERR_MAP = "Formerr"
	NXRRSET    = "NXRRSET"
)

Variables

View Source
var (
	StatSrv *StatisticsService
	ReqMaps []*RequestMap

	StatInterval                 = time.Duration(30)
	MaximumClients               = 200
	MaximumReqMap                = 2
	IpNetsClient                 []*net.IPNet
	IpNetsServer                 []*net.IPNet
	IpsClient                    []string
	IpsServer                    []string
	UrlAnnouncementDeployFromBam string
	MapViewIPs                   map[int]map[string][]string
	QStatDNS                     *QueueStatDNS
	IsActive                     bool
	StatHTTPServerAddr           string
)

Functions

func AddRequestMsgMap

func AddRequestMsgMap(clientIP, srvIP string, reqID uint16, questions []mkdns.Question)

Store all request messages into the corresponding map for Incoming messages and Outgoing messages

func CalculateAverageTime

func CalculateAverageTime(clientIp string, responseTime float64)

func CalculateAverageTimePerView

func CalculateAverageTimePerView(clientIp string, responseTime float64, metricType string)

func CalculateRecursiveMsg

func CalculateRecursiveMsg(clientIP, srvIP string, reqID uint16, questions []mkdns.Question, dnsMsg *mkdns.Msg)

Extract the client question from the response and find it from the Outgoing messages Then find client question from the Incoming messages All found the client question, increase the recursive value for the client stat, then remove out the request from the maps

func CheckMetricType

func CheckMetricType(srcIp string, dstIp string, mode string) (statIP string, metricType string)

func CreateCounterMetric

func CreateCounterMetric(srcIp string, dstIp string, mode string) (statIP string)

Create metric for the Client/AS/Forwarder

func CreateCounterMetricPerView

func CreateCounterMetricPerView(mapViewIPs map[int]map[string][]string)

Create metric for perView

func FindClientInView

func FindClientInView(clientIP string) string

func GetConfigDNSStatistics

func GetConfigDNSStatistics()

func HandleRequestDecodeErr

func HandleRequestDecodeErr(clientIP, srvIP string)

func HandleResponseDecodeErr

func HandleResponseDecodeErr(clientIP, srvIP string, RCodeString string)

func IncrDNSStatsDuplicated

func IncrDNSStatsDuplicated(clientIp string)

func IncrDNSStatsDuplicatedForPerView

func IncrDNSStatsDuplicatedForPerView(clientIp string)

func IncrDNSStatsFormatError

func IncrDNSStatsFormatError(clientIp string)

func IncrDNSStatsFormatErrorForPerView

func IncrDNSStatsFormatErrorForPerView(clientIp string, metricType string)

func IncrDNSStatsNXDomain

func IncrDNSStatsNXDomain(clientIp string)

func IncrDNSStatsNXDomainForPerView

func IncrDNSStatsNXDomainForPerView(clientIp string, metricType string)

func IncrDNSStatsNXRRSet

func IncrDNSStatsNXRRSet(clientIp string)

func IncrDNSStatsNXRRSetForPerView

func IncrDNSStatsNXRRSetForPerView(clientIp string, metricType string)

func IncrDNSStatsOtherRCode

func IncrDNSStatsOtherRCode(clientIp string)

func IncrDNSStatsOtherRCodeForPerView

func IncrDNSStatsOtherRCodeForPerView(clientIp string, metricType string)

func IncrDNSStatsRecursive

func IncrDNSStatsRecursive(clientIp string)

func IncrDNSStatsRecursiveForPerView

func IncrDNSStatsRecursiveForPerView(clientIp string)

func IncrDNSStatsReferral

func IncrDNSStatsReferral(clientIp string)

func IncrDNSStatsReferralForPerView

func IncrDNSStatsReferralForPerView(clientIp string, metricType string)

func IncrDNSStatsRefused

func IncrDNSStatsRefused(clientIp string)

func IncrDNSStatsRefusedForPerView

func IncrDNSStatsRefusedForPerView(clientIp string, metricType string)

func IncrDNSStatsServerFail

func IncrDNSStatsServerFail(clientIp string)

func IncrDNSStatsServerFailForPerView

func IncrDNSStatsServerFailForPerView(clientIp string, metricType string)

func IncrDNSStatsSuccessful

func IncrDNSStatsSuccessful(clientIp string)

func IncrDNSStatsSuccessfulForPerView

func IncrDNSStatsSuccessfulForPerView(clientIp string, metricType string)

func IncrDNSStatsSuccessfulNoAuthAns

func IncrDNSStatsSuccessfulNoAuthAns(clientIp string)

func IncrDNSStatsSuccessfulNoAuthAnsForPerView

func IncrDNSStatsSuccessfulNoAuthAnsForPerView(clientIp string)

func IncrDNSStatsSuccessfulRecursive

func IncrDNSStatsSuccessfulRecursive(clientIp string)

func IncrDNSStatsSuccessfulRecursiveForPerView

func IncrDNSStatsSuccessfulRecursiveForPerView(clientIp string)

func IncrDNSStatsTotalQueries

func IncrDNSStatsTotalQueries(clientIp string)

func IncrDNSStatsTotalQueriesForPerView

func IncrDNSStatsTotalQueriesForPerView(clientIp string)

func IncrDNSStatsTotalResponses

func IncrDNSStatsTotalResponses(clientIp string)

func IncreaseQueryCounter

func IncreaseQueryCounter(srcIp string, dstIp string, mode string)

func IncreaseQueryCounterForPerView

func IncreaseQueryCounterForPerView(srcIp string, dstIp string, mode string)

func InitStatisticsDNS

func InitStatisticsDNS()

func IsValidInACL

func IsValidInACL(statIP string, metricType string) bool

func Queries

func Queries(srcIp string, dstIp string)

func QueriesForPerView

func QueriesForPerView(srcIp string)

func ReceivedMessage

func ReceivedMessage(msg *model.Record)

func ReloadNamedData

func ReloadNamedData()

func Response

func Response(srcIp string, dstIp string)

func ResponseForPerView

func ResponseForPerView(dstIp string)

func Stop

func Stop()

Types

type DNSMetrics

type DNSMetrics struct {
	TotalQueries        int64    `json:"total_queries"`
	TotalResponses      int64    `json:"total_responses"`
	Recursive           int64    `json:"recursive"`
	SuccessfulRecursive int64    `json:"successful_recursive"`
	SuccessfulNoAuthAns int64    `json:"successful_noauthans"`
	Duplicated          int64    `json:"duplicated"`
	AverageTime         *float64 `json:"average_time"`
	Successful          int64    `json:"successful"`
	ServerFail          int64    `json:"server_fail"`
	NXDomain            int64    `json:"nx_domain"`
	FormatError         int64    `json:"format_error"`
	NXRRSet             int64    `json:"nx_rrset"`
	Referral            int64    `json:"referral"`
	Refused             int64    `json:"refused"`
	OtherRcode          int64    `json:"other_rcode"`
}

Statistics details

type QueryDNS

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

DNS data after decode

func NewQueryDNS

func NewQueryDNS(srcIP, dstIP string, isDuplicated bool) (queryDNS *QueryDNS)

type QueueStatDNS

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

func NewQueueStatDNS

func NewQueueStatDNS() (queue *QueueStatDNS)

func (*QueueStatDNS) PopStatDNS

func (queue *QueueStatDNS) PopStatDNS()

func (*QueueStatDNS) PushQueryDNS

func (queue *QueueStatDNS) PushQueryDNS(queryDNS *QueryDNS)

func (*QueueStatDNS) PushRecordDNS

func (queue *QueueStatDNS) PushRecordDNS(record *model.Record)

func (*QueueStatDNS) PushRecursiveDNS

func (queue *QueueStatDNS) PushRecursiveDNS(recursiveDNS *RecursiveDNS)

func (*QueueStatDNS) Stop

func (queue *QueueStatDNS) Stop()

type RecursiveDNS

type RecursiveDNS struct {
	IP string
	// contains filtered or unexported fields
}

func NewRecursiveDNS

func NewRecursiveDNS(IP string, isSuccess bool) (recursiveDNS *RecursiveDNS)

type RequestMap

type RequestMap struct {
	RequestMessage map[string]map[string]string
}

Query map for recursion counting

type StatisticsDNS

type StatisticsDNS struct {
	Type       string      `json:"type"`
	DNSMetrics *DNSMetrics `json:"dnsmetrics"`
}

Statistics for a client or an AS.

type StatisticsService

type StatisticsService struct {
	Start    time.Time                 `json:"start"`
	End      time.Time                 `json:"end"`
	StatsMap map[string]*StatisticsDNS `json:"stats_map"`
}

Statistics service

Jump to

Keyboard shortcuts

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