Documentation ¶
Index ¶
- func AssertDatagram(t *testing.T, ch <-chan *gplayers.IPv4, src, dst net.IP, payload []byte)
- func AssertFrame(t *testing.T, ch <-chan *gplayers.Ethernet, src, dst net.HardwareAddr, ...)
- func AssertUDPSegment(t *testing.T, ch <-chan gopacket.TransportLayer, srcPort, dstPort uint16, ...)
- func CloseEthPortsAndFlagErrorForUnexpectedData(t *testing.T, cards ...link.EthernetPort)
- func CloseIntfsAndFlagErrorForUnexpectedData(t *testing.T, intfs ...network.Interface)
- func FlagErrorForUnexpectedDatagrams(t *testing.T, ch <-chan *gplayers.IPv4)
- func FlagErrorForUnexpectedFrames(t *testing.T, ch <-chan *gplayers.Ethernet)
- func MustParseCIDR(t *testing.T, s string) *net.IPNet
- func MustParseMAC(t *testing.T, s string) net.HardwareAddr
- func NewMockNetworkLayer(t *testing.T, sentSegments chan<- gopacket.TransportLayer, ...) network.Layer
- func RecvUDPSegment(t *testing.T, recvdDatagrams chan<- *gplayers.IPv4, segment *gplayers.UDP, ...)
- type MockIPProtocol
- type TestIPProtocol
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertDatagram ¶
func AssertFrame ¶
func AssertUDPSegment ¶
func CloseEthPortsAndFlagErrorForUnexpectedData ¶
func CloseEthPortsAndFlagErrorForUnexpectedData(t *testing.T, cards ...link.EthernetPort)
func MustParseMAC ¶
func MustParseMAC(t *testing.T, s string) net.HardwareAddr
func NewMockNetworkLayer ¶
func NewMockNetworkLayer( t *testing.T, sentSegments chan<- gopacket.TransportLayer, recvdDatagrams <-chan *gplayers.IPv4, ) network.Layer
NewMockNetworkLayer creates a mock network.Layer that simply relays datagrams received on the recvdDatagrams channel to the listener.
Types ¶
type MockIPProtocol ¶
type MockIPProtocol struct { IPProtocol gplayers.IPProtocol RecvFunc func(datagram *gplayers.IPv4) }
func (*MockIPProtocol) GetID ¶
func (m *MockIPProtocol) GetID() gplayers.IPProtocol
func (*MockIPProtocol) Recv ¶
func (m *MockIPProtocol) Recv(datagram *gplayers.IPv4)
type TestIPProtocol ¶
func NewTestIPProtocol ¶
func NewTestIPProtocol() *TestIPProtocol
func (*TestIPProtocol) Close ¶
func (p *TestIPProtocol) Close(t *testing.T)
func (*TestIPProtocol) GetID ¶
func (p *TestIPProtocol) GetID() gplayers.IPProtocol
func (*TestIPProtocol) Recv ¶
func (p *TestIPProtocol) Recv(datagram *gplayers.IPv4)
Click to show internal directories.
Click to hide internal directories.