dnsproxytest

package
v1.9999.9999 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 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

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)
	OnNewMsgRateLimited    func(req *dns.Msg) (resp *dns.Msg)
}

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

func NewTestMessageConstructor

func NewTestMessageConstructor() (c *TestMessageConstructor)

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

func (*TestMessageConstructor) NewMsgNODATA

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

NewMsgNODATA implements the [MessageConstructor] interface for *TestMessageConstructor.

func (*TestMessageConstructor) NewMsgNOTIMPLEMENTED

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

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

func (*TestMessageConstructor) NewMsgNXDOMAIN

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

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

func (*TestMessageConstructor) NewMsgRateLimited

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

func (*TestMessageConstructor) NewMsgSERVFAIL

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