dnstest

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2016 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package dnstest provides DNS testing utilities and convenience functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func A

func A(hdr dns.RR_Header, ip net.IP) *dns.A

A returns an A record set with the given arguments.

func Message

func Message(opts ...MsgOpt) *dns.Msg

Message returns a dns.Msg with the given MsgOpts applied to it.

func NS

func NS(hdr dns.RR_Header, ns string) *dns.NS

NS returns a NS record set with the given arguments.

func RRHeader

func RRHeader(name string, rrtype uint16, ttl uint32) dns.RR_Header

RRHeader returns a dns.RR_Header with the given arguments set as well as a few hard-coded defaults.

func SOA

func SOA(hdr dns.RR_Header, ns, mbox string, minttl uint32) *dns.SOA

SOA returns an SOA records set with the given arguments and some hard-coded defaults.

func SRV

func SRV(hdr dns.RR_Header, target string, port, priority, weight uint16) *dns.SRV

SRV returns a SRV record set with the given arguments.

Types

type MsgOpt

type MsgOpt func(*dns.Msg)

A MsgOpt is functional option for dns.Msgs

func Answers

func Answers(rrs ...dns.RR) MsgOpt

Answers returns a MsgOpt that appends the given dns.RRs to a Msg's Answer section.

func Extras

func Extras(rrs ...dns.RR) MsgOpt

Extras returns a MsgOpt that appends the given dns.RRs to a Msg's Extras section.

func Header(auth bool, rcode int) MsgOpt

Header returns a MsgOpt that sets a dns.Msg's MsgHdr with the given arguments and some hard-coded defaults.

func NSs

func NSs(rrs ...dns.RR) MsgOpt

NSs returns a MsgOpt that appends the given dns.RRs to a Msg's Ns section.

func Question

func Question(name string, qtype uint16) MsgOpt

Question returns a MsgOpt that sets the Question section in a Msg.

type ResponseRecorder

type ResponseRecorder struct {
	Local, Remote net.IPAddr
	Msg           *dns.Msg
}

ResponseRecorder implements the dns.ResponseWriter interface. It's used in tests only.

func (*ResponseRecorder) Close

func (r *ResponseRecorder) Close() error

Close is not implemented.

func (*ResponseRecorder) Hijack

func (r *ResponseRecorder) Hijack()

Hijack is not implemented.

func (ResponseRecorder) LocalAddr

func (r ResponseRecorder) LocalAddr() net.Addr

LocalAddr returns the internal Local net.IPAddr.

func (ResponseRecorder) RemoteAddr

func (r ResponseRecorder) RemoteAddr() net.Addr

RemoteAddr returns the internal Remote net.IPAddr

func (ResponseRecorder) TsigStatus

func (r ResponseRecorder) TsigStatus() error

TsigStatus is not implemented.

func (ResponseRecorder) TsigTimersOnly

func (r ResponseRecorder) TsigTimersOnly(bool)

TsigTimersOnly is not implemented.

func (*ResponseRecorder) Write

func (r *ResponseRecorder) Write([]byte) (int, error)

Write is not implemented.

func (*ResponseRecorder) WriteMsg

func (r *ResponseRecorder) WriteMsg(m *dns.Msg) error

WriteMsg sets the internal Msg to the given Msg and returns nil.

Jump to

Keyboard shortcuts

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