Documentation ¶
Overview ¶
Package dnsproxytest provides a set of test utilities for the dnsproxy module.
Index ¶
- type FakeUpstream
- type TestMessageConstructor
- func (c *TestMessageConstructor) NewMsgNODATA(req *dns.Msg) (resp *dns.Msg)
- func (c *TestMessageConstructor) NewMsgNOTIMPLEMENTED(req *dns.Msg) (resp *dns.Msg)
- func (c *TestMessageConstructor) NewMsgNXDOMAIN(req *dns.Msg) (resp *dns.Msg)
- func (c *TestMessageConstructor) NewMsgSERVFAIL(req *dns.Msg) (resp *dns.Msg)
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 [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 [Upstream] interface for *FakeUpstream.
func (*FakeUpstream) Close ¶
func (u *FakeUpstream) Close() (err error)
Close implements the [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 [dnsmsg.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 [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 [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 [MessageConstructor] interface for *TestMessageConstructor.