dns

package
v0.0.0-...-c7f4f4e Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package dns traces DNS activity and caches DNS lookups for reverse DNS capability

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToString

func ToString(h Hostname) string

ToString converts a dns.Hostname to a string

Types

type Hostname

type Hostname = *intern.StringValue

Hostname represents a DNS hostname (aka domain name)

func HostnameFromBytes

func HostnameFromBytes(b []byte) Hostname

HostnameFromBytes converts a byte slice representing a hostname to a dns.Hostname

func ToHostname

func ToHostname(s string) Hostname

ToHostname converts from a string to a dns.Hostname

type Key

type Key struct {
	ServerIP   util.Address
	ClientIP   util.Address
	ClientPort uint16
	// ConnectionType will be either TCP or UDP
	Protocol uint8
}

Key is an identifier for a set of DNS connections

type QueryType

type QueryType int

QueryType is the DNS record type

const (
	TypeA     QueryType = 1   // a host address
	TypeNS    QueryType = 2   // an authoritative name server
	TypeMD    QueryType = 3   // a mail destination (Obsolete - use MX)
	TypeMF    QueryType = 4   // a mail forwarder (Obsolete - use MX)
	TypeCNAME QueryType = 5   // the canonical name for an alias
	TypeSOA   QueryType = 6   // marks the start of a zone of authority
	TypeMB    QueryType = 7   // a mailbox domain name (EXPERIMENTAL)
	TypeMG    QueryType = 8   // a mail group member (EXPERIMENTAL)
	TypeMR    QueryType = 9   // a mail rename domain name (EXPERIMENTAL)
	TypeNULL  QueryType = 10  // a null RR (EXPERIMENTAL)
	TypeWKS   QueryType = 11  // a well known service description
	TypePTR   QueryType = 12  // a domain name pointer
	TypeHINFO QueryType = 13  // host information
	TypeMINFO QueryType = 14  // mailbox or mail list information
	TypeMX    QueryType = 15  // mail exchange
	TypeTXT   QueryType = 16  // text strings
	TypeAAAA  QueryType = 28  // a IPv6 host address [RFC3596]
	TypeSRV   QueryType = 33  // server discovery [RFC2782] [RFC6195]
	TypeOPT   QueryType = 41  // OPT Pseudo-RR [RFC6891]
	TypeURI   QueryType = 256 // URI RR [RFC7553]
)

DNSType known values.

type ReverseDNS

type ReverseDNS interface {
	Resolve(map[util.Address]struct{}) map[util.Address][]Hostname
	GetDNSStats() StatsByKeyByNameByType

	// WaitForDomain is used in tests to ensure a domain has been
	// seen by the ReverseDNS.
	WaitForDomain(domain string) error

	Start() error
	Close()
}

ReverseDNS translates IPs to names

type Stats

type Stats struct {
	Timeouts          uint32
	SuccessLatencySum uint64
	FailureLatencySum uint64
	CountByRcode      map[uint32]uint32
}

Stats holds statistics corresponding to a particular domain

type StatsByKeyByNameByType

type StatsByKeyByNameByType map[Key]map[Hostname]map[QueryType]Stats

StatsByKeyByNameByType provides a type name for the map of DNS stats based on the host key->the lookup name->querytype

Jump to

Keyboard shortcuts

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