Documentation
¶
Overview ¶
Package dnstest provides a configurable DNS server simulator for tests.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Response ¶
type Response struct {
// Msg is sent as the response if non-nil. The Question and Id are set from
// the incoming request before sending.
Msg *dns.Msg
// Rcode is used if Msg is nil to set the reply code in the generated
// message. Defaults to RcodeSuccess.
Rcode int
// Raw is written directly on the wire instead of Msg/Rcode allowing
// responses with malformed DNS packets.
Raw []byte
// Drop causes the server to ignore the request simulating a timeout.
Drop bool
// Delay adds an optional delay before processing the response.
Delay time.Duration
}
Response defines how the server should answer a specific DNS question.
type Server ¶
type Server struct {
// Addr is the address the server is listening on.
Addr string
// contains filtered or unexported fields
}
Server simulates a DNS server for use in tests.
Click to show internal directories.
Click to hide internal directories.