query

package
v0.0.0-...-d4f9e80 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckResponse

func CheckResponse(response *dns.Msg) error

CheckResponse - very simple - just checks length of reply for now TODO pcullen make this better

func ClientConnection

func ClientConnection(client *dns.Client, dport int, host string) (*dns.Conn, error)

ClientConnection creates a persistent connection for an already existing dns client

func DNSClient

func DNSClient(timeout time.Duration) *dns.Client

DNSClient creates a new DNS Cloent

func MakeReq

func MakeReq(domain string, now func() time.Time, randomise bool, qtype dns.Type) *dns.Msg

MakeReq creates a DNS request

func MonitorTarget

func MonitorTarget(sigPause chan struct{}, monPort int, monHost string)

MonitorTarget checks that target is responding

func ProcessQueryInputFile

func ProcessQueryInputFile(path string) ([]string, []dns.Type, error)

ProcessQueryInputFile parses a dnsperf compatible query input file for qnames/qtypes

func QTypeStrToDNSQtype

func QTypeStrToDNSQtype(qTypeStr string) (dns.Type, error)

QTypeStrToDNSQtype transforms qtypestr (eg: "A") to miekg/dns qtype eg: dns.TypeA

func RunQueries

func RunQueries(dport int, host string, domains []string, timeout time.Duration, randomiseQueries bool, qTypes []dns.Type, now func() time.Time, runState *RunState, sigpause chan struct{}) error

RunQueries starts loading the target host with DNS queries

func RunQuery

func RunQuery(reqMsg *dns.Msg, requestFunc SendMsg, now func() time.Time, state *RunState)

RunQuery wraps the function that sends the DNS query and passes metrics to a channel

Types

type RunState

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

RunState object holds the state of the performance test

func NewRunState

func NewRunState(queriesToSend int, limiter ratelimit.Limiter, daemon bool, nowfunc func() time.Time) *RunState

NewRunState creates a new RunState instance

func (*RunState) ExportIntermediateResults

func (r *RunState) ExportIntermediateResults() *stats.ExportedMetrics

ExportIntermediateResults is used to export intermediate results while the test is still in progress

func (*RunState) ExportResults

func (r *RunState) ExportResults() *stats.ExportedMetrics

ExportResults returns the final results of the test

type SendMsg

type SendMsg func(*dns.Msg) (*dns.Msg, error)

SendMsg takes a pointer to a DNS request and returns a pointer to a DNS reply

func DNS

func DNS(client *dns.Client, check ValidateResponse, timeout time.Duration, conn *dns.Conn) SendMsg

DNS sends a DNS request and checks the response from the DNS server

type ValidateResponse

type ValidateResponse func(response *dns.Msg) error

ValidateResponse returns error if DNS response not valid

Jump to

Keyboard shortcuts

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