Help us shape the future of Go! Take the 2026 Go Developer Survey

dnsproxytest

package
v0.75.6 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2025 License: Apache-2.0 Imports: 1 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 FakeUpstream

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

FakeUpstream is a fake [proxy.Upstream] implementation for tests.

TODO(e.burkov): Move this to the golibs some time later.

func (*FakeUpstream) Address

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

Address implements the [proxy.Upstream] interface for *FakeUpstream.

func (*FakeUpstream) Close

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

Close implements the [proxy.Upstream] interface for *FakeUpstream.

func (*FakeUpstream) Exchange

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

Exchange implements the [proxy.Upstream] interface for *FakeUpstream.

type TestMessageConstructor added in v0.73.0

type TestMessageConstructor 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)
}

TestMessageConstructor is a fake [proxy.MessageConstructor] implementation for tests.

func NewTestMessageConstructor added in v0.73.0

func NewTestMessageConstructor() (c *TestMessageConstructor)

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

func (*TestMessageConstructor) NewMsgNODATA added in v0.73.0

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

NewMsgNODATA implements the [MessageConstructor] interface for *TestMessageConstructor.

func (*TestMessageConstructor) NewMsgNOTIMPLEMENTED added in v0.73.0

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

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

func (*TestMessageConstructor) NewMsgNXDOMAIN added in v0.73.0

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

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

func (*TestMessageConstructor) NewMsgSERVFAIL added in v0.73.0

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

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

Jump to

Keyboard shortcuts

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