dnsflow

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package dnsflow collects eBPF-network dnsflow metrics

Index

Constants

View Source
const (
	DNSTIMEOUT = time.Second * 6
)

Variables

This section is empty.

Functions

func NewTPacketDNS

func NewTPacketDNS() (*afpacket.TPacket, error)

func SetK8sNetInfo

func SetK8sNetInfo(n *k8sinfo.K8sNetInfo)

func SetLogger

func SetLogger(nl *logger.Logger)

Types

type DNSAnswerRecord

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

func NewDNSRecord

func NewDNSRecord() *DNSAnswerRecord

func (*DNSAnswerRecord) Cleanup

func (c *DNSAnswerRecord) Cleanup()

func (*DNSAnswerRecord) LookupAddr

func (c *DNSAnswerRecord) LookupAddr(ip string) string

type DNSFlowTracer

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

func NewDNSFlowTracer

func NewDNSFlowTracer() *DNSFlowTracer

func (*DNSFlowTracer) Run

func (tracer *DNSFlowTracer) Run(ctx context.Context, tp *afpacket.TPacket, gTag map[string]string,
	dnsRecord *DNSAnswerRecord, feedAddr string,
)

type DNSPacketInfo

type DNSPacketInfo struct {
	Key     DNSQAKey
	QR      bool // query(false) response(true)
	RCODE   uint8
	TS      time.Time
	Answers []layers.DNSResourceRecord
}

func ReadPacketInfoFromDNSParser

func ReadPacketInfoFromDNSParser(ts time.Time, dnsParser *DNSParser) (*DNSPacketInfo, error)

type DNSParser

type DNSParser struct {
	*gopacket.DecodingLayerParser
	// contains filtered or unexported fields
}

func NewDNSParse

func NewDNSParse() DNSParser

type DNSQAKey

type DNSQAKey struct {
	TransactionID uint16 // DNS transaction ID
	IsUDP         bool   // UDP(true) TCP(false)
	IsV4          bool   // IPv4(true) IPv6(false)
	ClientPort    uint16 // Client Port
	ServerPort    uint16 // Server Port
	ClientIP      [4]uint32
	ServerIP      [4]uint32
}

type DNSStats

type DNSStats struct {
	TS        time.Time
	RCODE     int
	RespTime  time.Duration
	Timeout   bool
	Responded bool
}

type FlowAgg

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

func (*FlowAgg) Append

func (agg *FlowAgg) Append(dnsKey DNSQAKey, stats DNSStats) error

func (*FlowAgg) Clean

func (agg *FlowAgg) Clean()

func (*FlowAgg) Len

func (agg *FlowAgg) Len() int

func (*FlowAgg) ToPoint

func (agg *FlowAgg) ToPoint(tags map[string]string, k8sInfo *k8sinfo.K8sNetInfo) []*client.Point

Jump to

Keyboard shortcuts

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