dnstest

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package dnstest runs internal/dnsserver for hermetic tests (#67): servers stop on test cleanup, and failures to listen fail (or, for IPv6, skip) the test.

Index

Constants

This section is empty.

Variables

View Source
var (
	NXDomain = dnsserver.NXDomain
	ServFail = dnsserver.ServFail
	Refused  = dnsserver.Refused
	Dropped  = dnsserver.Dropped
)

Common replies.

Functions

func StartTLS

func StartTLS(t testing.TB, s *Server, h Handler)

StartTLS adds a DNS-over-TLS listener to s answering with h. Use TLSAddr as tls://<TLSAddr> and RootCAs to trust it.

Types

type Handler

type Handler = dnsserver.Handler

Handler answers one query.

type Options

type Options = dnsserver.Options

Options configure a server.

type Query

type Query = dnsserver.Query

Query is one question the server received.

type Reply

type Reply = dnsserver.Reply

Reply scripts the answer to a Query.

type Server

type Server = dnsserver.Server

Server is a running DNS server.

func Start

func Start(t testing.TB, h Handler) *Server

Start runs a concurrent IPv4 server answering with h, stopped on cleanup.

func StartWith

func StartWith(t testing.TB, opts Options, h Handler) *Server

StartWith runs a server with options, stopped on cleanup. With IPv6 set and no IPv6 loopback available, the test is skipped.

Jump to

Keyboard shortcuts

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