dnsproxytest

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package dnsproxytest provides a set of test utilities for the dnsproxy module.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MessageConstructor

type MessageConstructor struct {
	OnNewMsgNXDOMAIN       func(req *dns.Msg) (resp *dns.Msg)
	OnNewMsgSERVFAIL       func(req *dns.Msg) (resp *dns.Msg)
	OnNewMsgNOTIMPLEMENTED func(req *dns.Msg) (resp *dns.Msg)
	OnNewMsgNODATA         func(req *dns.Msg) (resp *dns.Msg)
}

MessageConstructor is a mock dnsmsg.MessageConstructor implementation for tests.

func NewMessageConstructor

func NewMessageConstructor() (c *MessageConstructor)

NewMessageConstructor creates a new *TestMessageConstructor with all it's methods set to panic.

func (*MessageConstructor) NewMsgNODATA

func (c *MessageConstructor) NewMsgNODATA(req *dns.Msg) (resp *dns.Msg)

NewMsgNODATA implements the MessageConstructor interface for *TestMessageConstructor.

func (*MessageConstructor) NewMsgNOTIMPLEMENTED

func (c *MessageConstructor) NewMsgNOTIMPLEMENTED(req *dns.Msg) (resp *dns.Msg)

NewMsgNOTIMPLEMENTED implements the [proxy.MessageConstructor] interface for *TestMessageConstructor.

func (*MessageConstructor) NewMsgNXDOMAIN

func (c *MessageConstructor) NewMsgNXDOMAIN(req *dns.Msg) (resp *dns.Msg)

NewMsgNXDOMAIN implements the [proxy.MessageConstructor] interface for *TestMessageConstructor.

func (*MessageConstructor) NewMsgSERVFAIL

func (c *MessageConstructor) NewMsgSERVFAIL(req *dns.Msg) (resp *dns.Msg)

NewMsgSERVFAIL implements the [proxy.MessageConstructor] interface for *TestMessageConstructor.

type Upstream

type Upstream struct {
	OnAddress  func() (addr string)
	OnExchange func(req *dns.Msg) (resp *dns.Msg, err error)
	OnClose    func() (err error)
}

Upstream is a mock upstream.Upstream implementation for tests.

TODO(e.burkov): Move to golibs.

func (*Upstream) Address

func (u *Upstream) Address() (addr string)

Address implements the upstream.Upstream interface for *Upstream.

func (*Upstream) Close

func (u *Upstream) Close() (err error)

Close implements the upstream.Upstream interface for *Upstream.

func (*Upstream) Exchange

func (u *Upstream) Exchange(req *dns.Msg) (resp *dns.Msg, err error)

Exchange implements the upstream.Upstream interface for *Upstream.

Jump to

Keyboard shortcuts

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