test

package
v0.0.0-...-0c57748 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2016 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func A

func A(rr string) *dns.A

func AAAA

func AAAA(rr string) *dns.AAAA

func CNAME

func CNAME(rr string) *dns.CNAME

func CoreDNSServer

func CoreDNSServer(corefile string) (*caddy.Instance, error)

CoreDNSServer returns a test server. It just takes a normal Corefile as input.

func CoreDNSServerPorts

func CoreDNSServerPorts(i *caddy.Instance, k int) (udp, tcp string)

CoreDNSServeRPorts returns the ports the instance is listening on. The integer k indicates which ServerListener you want.

func CoreDNSServerStop

func CoreDNSServerStop(i *caddy.Instance)

CoreDNSSserverStop stops a server.

func DNSKEY

func DNSKEY(rr string) *dns.DNSKEY

func Exchange

func Exchange(m *dns.Msg, server, net string) (*dns.Msg, error)
func Header(t *testing.T, tc Case, resp *dns.Msg) bool

func MX

func MX(rr string) *dns.MX

func Msg

func Msg(zone string, typ uint16, o *dns.OPT) *dns.Msg

func NS

func NS(rr string) *dns.NS

func NSEC

func NSEC(rr string) *dns.NSEC

func OPT

func OPT(bufsize int, do bool) *dns.OPT

func PTR

func PTR(rr string) *dns.PTR

func RRSIG

func RRSIG(rr string) *dns.RRSIG

func SOA

func SOA(rr string) *dns.SOA

func SRV

func SRV(rr string) *dns.SRV

func Section

func Section(t *testing.T, tc Case, sect Sect, rr []dns.RR) bool

func TCPServer

func TCPServer(t *testing.T, laddr string) (*dns.Server, string, error)

func TXT

func TXT(rr string) *dns.TXT

func TempFile

func TempFile(t *testing.T, dir, content string) (string, func(), error)

TempFile will create a temporary file on disk and returns the name and a cleanup function to remove it later.

func UDPServer

func UDPServer(t *testing.T, laddr string) (*dns.Server, string, error)

Types

type Case

type Case struct {
	Qname  string
	Qtype  uint16
	Rcode  int
	Do     bool
	Answer []dns.RR
	Ns     []dns.RR
	Extra  []dns.RR
}

If the TTL of a record is 303 we don't care what the TTL is.

func (Case) Msg

func (c Case) Msg() *dns.Msg

type Handler

type Handler interface {
	ServeDNS(context.Context, dns.ResponseWriter, *dns.Msg) (int, error)
}

Copied here to prevent an import cycle.

func ErrorHandler

func ErrorHandler() Handler

type HandlerFunc

type HandlerFunc func(context.Context, dns.ResponseWriter, *dns.Msg) (int, error)

HandlerFunc is a convenience type like dns.HandlerFunc, except ServeDNS returns an rcode and an error.

func (HandlerFunc) ServeDNS

func (f HandlerFunc) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error)

ServeDNS implements the Handler interface.

type Input

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

func NewInput

func NewInput(corefile string) *Input

func (*Input) Body

func (i *Input) Body() []byte

func (*Input) Path

func (i *Input) Path() string

func (*Input) ServerType

func (i *Input) ServerType() string

type RRSet

type RRSet []dns.RR

func (RRSet) Len

func (p RRSet) Len() int

func (RRSet) Less

func (p RRSet) Less(i, j int) bool

func (RRSet) Swap

func (p RRSet) Swap(i, j int)

type ResponseWriter

type ResponseWriter struct{}

func (*ResponseWriter) Close

func (t *ResponseWriter) Close() error

func (*ResponseWriter) Hijack

func (t *ResponseWriter) Hijack()

func (*ResponseWriter) LocalAddr

func (t *ResponseWriter) LocalAddr() net.Addr

func (*ResponseWriter) RemoteAddr

func (t *ResponseWriter) RemoteAddr() net.Addr

func (*ResponseWriter) TsigStatus

func (t *ResponseWriter) TsigStatus() error

func (*ResponseWriter) TsigTimersOnly

func (t *ResponseWriter) TsigTimersOnly(bool)

func (*ResponseWriter) Write

func (t *ResponseWriter) Write(buf []byte) (int, error)

func (*ResponseWriter) WriteMsg

func (t *ResponseWriter) WriteMsg(m *dns.Msg) error

type Sect

type Sect int
const (
	Answer Sect = iota
	Ns
	Extra
)

Jump to

Keyboard shortcuts

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