Documentation
¶
Index ¶
- func IPv4(t *testing.T, b []byte, checkers ...NetworkChecker)
- type NetworkChecker
- type TransportChecker
- func AckNum(seq uint32) TransportChecker
- func DstPort(port uint16) TransportChecker
- func SeqNum(seq uint32) TransportChecker
- func SrcPort(port uint16) TransportChecker
- func TCPFlags(flags uint8) TransportChecker
- func TCPFlagsMatch(flags, mask uint8) TransportChecker
- func TCPSynOptions(wantOpts header.TCPSynOptions) TransportChecker
- func Window(window uint16) TransportChecker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IPv4 ¶
func IPv4(t *testing.T, b []byte, checkers ...NetworkChecker)
IPv4 checks the validity and properties of the given IPv4 packet. It is expected to be used in conjunction with other network checkers for specific properties. For example, to check the source and destination address, one would call:
checker.IPv4(t, b, checker.SrcAddr(x), checker.DstAddr(y))
Types ¶
type NetworkChecker ¶
NetworkChecker is a function to check a property of a network packet
func DstAddr ¶
func DstAddr(addr types.Address) NetworkChecker
DstAddr calculates a checker that checks the destination address
func PayloadLen ¶
func PayloadLen(plen int) NetworkChecker
PayloadLen creates a checker that checks the payload length
func SrcAddr ¶
func SrcAddr(addr types.Address) NetworkChecker
SrcAddr creates a checker that checks the source address
func TCP ¶
func TCP(checkers ...TransportChecker) NetworkChecker
TCP creates a checker that checks the transport protocol is TCP and potentially additional transport header fields
type TransportChecker ¶
TransportChecker is a function to check a property of a transport packet
func AckNum ¶
func AckNum(seq uint32) TransportChecker
AckNum creates a checker that checks the ack number
func DstPort ¶
func DstPort(port uint16) TransportChecker
DstPort creates a checker that checks the destination port
func SeqNum ¶
func SeqNum(seq uint32) TransportChecker
SeqNum creates a checker that checks the sequence number
func SrcPort ¶
func SrcPort(port uint16) TransportChecker
SrcPort creates a checker that checks the source port
func TCPFlags ¶
func TCPFlags(flags uint8) TransportChecker
TCPFlags creates a checker that checks the tcp flags
func TCPFlagsMatch ¶
func TCPFlagsMatch(flags, mask uint8) TransportChecker
TCPFlagsMatch creates a checker that checks the tcp flags, masked by the given mask, match the supplied flags
func TCPSynOptions ¶
func TCPSynOptions(wantOpts header.TCPSynOptions) TransportChecker
TCPSynOptions creates a checker that checks the presence of TCP options in SYN segments.
If wndScale is negative, the window scale option must not be present
func Window ¶
func Window(window uint16) TransportChecker
Window creates a checker that checks the tcp window