dnstest

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

DNS resolver for testing purposes.

In the future, when go fuzz can make use of _test.go files, we can rename this file dns_test.go and remove this extra package entirely. Until then, unfortunately this is the most reasonable way to share these helpers between go and fuzz tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TestResolver

type TestResolver struct {
	Txt    map[string][]string
	Mx     map[string][]*net.MX
	Ip     map[string][]net.IP
	Addr   map[string][]string
	Cname  map[string]string
	Errors map[string]error
}

Testing DNS resolver.

Not exported since this is not part of the public API and only used internally on tests.

func NewResolver

func NewResolver() *TestResolver

func (*TestResolver) LookupAddr

func (r *TestResolver) LookupAddr(ctx context.Context, host string) (addrs []string, err error)

func (*TestResolver) LookupIPAddr

func (r *TestResolver) LookupIPAddr(ctx context.Context, host string) (as []net.IPAddr, err error)

func (*TestResolver) LookupMX

func (r *TestResolver) LookupMX(ctx context.Context, domain string) (mxs []*net.MX, err error)

func (*TestResolver) LookupTXT

func (r *TestResolver) LookupTXT(ctx context.Context, domain string) (txts []string, err error)

Jump to

Keyboard shortcuts

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