statsdns

package
v2.0.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2019 License: Apache-2.0 Imports: 13 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"
)

Variables

View Source
var (
	StatSrv *StatisticsService
	ReqMap  *RequestMap

	StatInterval                 = time.Duration(30)
	MaximumClients               = 200
	IpNetsClient                 []*net.IPNet
	IpNetsServer                 []*net.IPNet
	IpsClient                    []string
	IpsServer                    []string
	UrlAnnouncementDeployFromBam string
	MapViewIPs                   map[int]map[string][]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 CreateCounterMetric

func CreateCounterMetric(srcIp string, dstIp 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 IncrDNSStatsRecursiveForPerClient

func IncrDNSStatsRecursiveForPerClient(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 Queries

func Queries(srcIp string, dstIp string)

func QueriesForPerView

func QueriesForPerView(srcIp string)

func ReceiveHttpRequest

func ReceiveHttpRequest(payloadString string)

func ReceivedMessage

func ReceivedMessage(msg *model.Record)

func Response

func Response(srcIp string, dstIp string)

func ResponseForPerView

func ResponseForPerView(dstIp string)

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 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