test

package
v0.0.0-...-e8aa44e Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ServeUDPResponse

func ServeUDPResponse(t *testing.T,
	port uint16,
	callbackFunc func(*dns.Msg, *net.UDPAddr) *dns.Msg)

Types

type MockAddr

type MockAddr struct {
	Value string
	V6    bool
}

func (MockAddr) Is6

func (m MockAddr) Is6() bool

func (MockAddr) NewRandom

func (m MockAddr) NewRandom() MockAddr

func (MockAddr) NewRandomV4

func (m MockAddr) NewRandomV4() MockAddr

func (MockAddr) NewRandomV6

func (m MockAddr) NewRandomV6() MockAddr

func (MockAddr) String

func (m MockAddr) String() string

type MockClient

type MockClient struct {
	ReceivedCalls int32
	ExchangeFunc  func(correlationId uuid.UUID, q client.Question, ip client.Address, sendOpts client.SendOpts)
	RespChan      chan client.Response
}

MockClient is a customizable mock implementation of common.DNSClientDecorator to be used for testing.

func (*MockClient) Enqueue

func (mock *MockClient) Enqueue(correlationId uuid.UUID, q client.Question, ip client.Address, sendOpts client.SendOpts)

func (*MockClient) ResponseChan

func (mock *MockClient) ResponseChan() <-chan client.Response

type MockConn

type MockConn struct {
	ReadFunc  func([]byte) (int, error)
	WriteFunc func([]byte) (int, error)
	CloseFunc func() error
}

MockConn is a customizable mock implementation of net.Conn to be used for testing

func (MockConn) Close

func (m MockConn) Close() error

func (MockConn) LocalAddr

func (m MockConn) LocalAddr() net.Addr

func (MockConn) Read

func (m MockConn) Read(b []byte) (int, error)

func (MockConn) RemoteAddr

func (m MockConn) RemoteAddr() net.Addr

func (MockConn) SetDeadline

func (m MockConn) SetDeadline(_ time.Time) error

func (MockConn) SetReadDeadline

func (m MockConn) SetReadDeadline(_ time.Time) error

func (MockConn) SetWriteDeadline

func (m MockConn) SetWriteDeadline(_ time.Time) error

func (MockConn) Write

func (m MockConn) Write(b []byte) (int, error)

type MockPacketConn

type MockPacketConn struct {
	ReadFromFunc         func([]byte) (int, net.Addr, error)
	WriteToFunc          func([]byte, net.Addr) (int, error)
	CloseFunc            func() error
	SetWriteDeadlineFunc func(time.Time) error
}

MockPacketConn is a customizable mock implementation of net.PacketConn to be used for testing

func (MockPacketConn) Close

func (m MockPacketConn) Close() error

func (MockPacketConn) LocalAddr

func (m MockPacketConn) LocalAddr() net.Addr

func (MockPacketConn) ReadFrom

func (m MockPacketConn) ReadFrom(p []byte) (n int, addr net.Addr, err error)

func (MockPacketConn) SetDeadline

func (m MockPacketConn) SetDeadline(_ time.Time) error

func (MockPacketConn) SetReadDeadline

func (m MockPacketConn) SetReadDeadline(_ time.Time) error

func (MockPacketConn) SetWriteDeadline

func (m MockPacketConn) SetWriteDeadline(t time.Time) error

func (MockPacketConn) WriteTo

func (m MockPacketConn) WriteTo(p []byte, addr net.Addr) (n int, err error)

Jump to

Keyboard shortcuts

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