dnsproxytest

package
v0.78.2 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 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 added in v0.76.2

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 added in v0.76.2

func NewMessageConstructor() (c *MessageConstructor)

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

func (*MessageConstructor) NewMsgNODATA added in v0.76.2

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

NewMsgNODATA implements the MessageConstructor interface for *TestMessageConstructor.

func (*MessageConstructor) NewMsgNOTIMPLEMENTED added in v0.76.2

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

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

func (*MessageConstructor) NewMsgNXDOMAIN added in v0.76.2

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

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

func (*MessageConstructor) NewMsgSERVFAIL added in v0.76.2

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

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

type Upstream added in v0.76.2

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 added in v0.76.2

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

Address implements the upstream.Upstream interface for *Upstream.

func (*Upstream) Close added in v0.76.2

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

Close implements the upstream.Upstream interface for *Upstream.

func (*Upstream) Exchange added in v0.76.2

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