Documentation ¶
Overview ¶
Example (PrintResults_default) ¶
Example_printResults_default runs printResults() with default values
plan := getExamplePrintResultsPlan("") plan.printResults()
Output: Printing results: 1:65535 drop
Example (PrintResults_drop) ¶
Example_printResults_drop runs printResults() with only dropped packets
plan := getExamplePrintResultsPlan("1024:1032") plan.printResults()
Output: Printing results: 1024:1032 drop
Example (PrintResults_dropPass) ¶
Example_printResults_dropPass runs printResults() with dropped packets and some passing packets
// init plan := getExamplePrintResultsPlan("1024:1032") // create result messages r := &MessageResult{ Result: ResultPass, } results := []*MessageResult{r} // set results for some items for i := uint32(3); i < 6; i++ { plan.items[i].ReceiverResults = results } // check output plan.printResults()
Output: Printing results: 1024:1026 drop 1027:1029 pass 1030:1032 drop
Example (PrintResults_dropTCPReset) ¶
Example_printResults_dropTCPReset runs printResults() with dropped packets and some tcp resetted (rejected) packets
// init plan := getExamplePrintResultsPlan("1024:1032") // create result messages r := &MessageResult{ Result: ResultTCPReset, } results := []*MessageResult{r} // set results for some items for i := uint32(3); i < 6; i++ { plan.items[i].SenderResults = results } // check output plan.printResults()
Output: Printing results: 1024:1026 drop 1027:1029 reject 1030:1032 drop
Example (PrintResults_even) ¶
Example_printResults_even runs printResults() with the same amount of packets in each category
// init plan := getExamplePrintResultsPlan("1024:1032") // create reset result messages rr := &MessageResult{ Result: ResultTCPReset, } rresults := []*MessageResult{rr} // create pass result messages pr := &MessageResult{ Result: ResultPass, } presults := []*MessageResult{pr} // set reject results for some items for i := uint32(3); i < 6; i++ { plan.items[i].SenderResults = rresults } // set pass results for some items for i := uint32(6); i < 9; i++ { plan.items[i].ReceiverResults = presults } // check output plan.printResults()
Output: Printing results: 1024:1026 drop 1027:1029 reject 1030:1032 pass
Example (PrintResults_interleaved) ¶
Example_printResults_interleaved runs printResults() with each packet in a different category
// init plan := getExamplePrintResultsPlan("1024:1032") // create reset result messages rr := &MessageResult{ Result: ResultTCPReset, } rresults := []*MessageResult{rr} // create pass result messages pr := &MessageResult{ Result: ResultPass, } presults := []*MessageResult{pr} for i, item := range plan.items { switch i % 3 { case 1: // set reject results item.SenderResults = rresults case 2: // set pass results item.ReceiverResults = presults } } // check output plan.printResults()
Output: Printing results: 1024 drop 1025 reject 1026 pass 1027 drop 1028 reject 1029 pass 1030 drop 1031 reject 1032 pass
Example (PrintResults_pass) ¶
Example_printResults_pass runs printResults() with passing packets
// init plan := getExamplePrintResultsPlan("1024:1032") // create result messages r := &MessageResult{ Result: ResultPass, } results := []*MessageResult{r} // set results for all items for _, i := range plan.items { i.ReceiverResults = results } // check output plan.printResults()
Output: Printing results: 1024:1032 pass
Example (PrintResults_rejectTCPReset) ¶
Example_printResults_rejectTCPReset runs printResults() with tcp resetted (rejected) packets
// init plan := getExamplePrintResultsPlan("1024:1032") // create result messages r := &MessageResult{ Result: ResultTCPReset, } results := []*MessageResult{r} // set results for all items for _, i := range plan.items { i.SenderResults = results } // check output plan.printResults()
Output: Printing results: 1024:1032 reject
Index ¶
- Constants
- func Run()
- type Config
- func (c *Config) GetPortRange() (first uint16, last uint16)
- func (c *Config) GetReceiverDstIP() net.IP
- func (c *Config) GetReceiverDstMAC() net.HardwareAddr
- func (c *Config) GetReceiverSrcIP() net.IP
- func (c *Config) GetReceiverSrcMAC() net.HardwareAddr
- func (c *Config) GetSenderDstIP() net.IP
- func (c *Config) GetSenderDstMAC() net.HardwareAddr
- func (c *Config) GetSenderSrcIP() net.IP
- func (c *Config) GetSenderSrcMAC() net.HardwareAddr
- func (c *Config) ParseCommandLine()
- type Message
- type MessageNop
- type MessageRegister
- type MessageResult
- type MessageTest
- type TLVMessage
Examples ¶
Constants ¶
const ( // MessageHeaderLength is the length of the Type and Length fields // of a message MessageHeaderLength = 3 // MessageMaxLength is the maximum length of a message in bytes MessageMaxLength = 4096 )
const ( MessageTypeNone = iota MessageTypeNop MessageTypeRegister MessageTypeTest MessageTypeResult MessageTypeInvalid )
Message types
const ( ProtocolNone = 0 ProtocolTCP = 6 ProtocolUDP = 17 )
Protocol types
const ( ResultNone = iota ResultReady ResultError ResultPass ResultICMPv4NetworkUnreachable ResultICMPv4HostUnreachable ResultICMPv4ProtocolUnreachable ResultICMPv4PortUnreachable ResultICMPv4FragmentationNeeded ResultICMPv4SourceRoutingFailed ResultICMPv4NetworkUnknown ResultICMPv4HostUnknown ResultICMPv4SourceIsolated ResultICMPv4NetworkProhibited ResultICMPv4HostProhibited ResultICMPv4NetworkTOS ResultICMPv4HostTOS ResultICMPv4CommProhibited ResultICMPv4HostPrecedence ResultICMPv4PrecedenceCutoff ResultICMPv6NoRouteToDst ResultICMPv6AdminProhibited ResultICMPv6BeyondScopeOfSrc ResultICMPv6AddressUnreachable ResultICMPv6PortUnreachable ResultICMPv6SrcAddressFailed ResultICMPv6RejectRouteToDst ResultICMPv6SrcRoutingHeader ResultICMPv6HeadersTooLong ResultTCPReset ResultTimeout ResultInvalid )
Test result values
const (
// NopInterval specifies the seconds between sending nop messages
NopInterval = 15
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { // ServerMode determines if we run as a server or a client ServerMode bool // ServerAddress is the address of the server ServerAddress string // ClientID is the id of the client ClientID uint8 // SenderID is the id of the sending client SenderID uint8 // ReceiverID is the id of the receiving client ReceiverID uint8 // SenderDevice is the name of the sender's network interface SenderDevice string // ReceiverDevice is the name of the receiver's network interface ReceiverDevice string // SenderSrcMAC is the sender's source MAC address SenderSrcMAC string // SenderDstMAC is the sender's destination MAC address SenderDstMAC string // ReceiverSrcMAC is the receiver's source MAC address ReceiverSrcMAC string // ReceiverDstMAC is the receiver's destination MAC address ReceiverDstMAC string // SenderSrcIP is the sender's source IP address SenderSrcIP string // SenderDstIP is the sender's destination IP address SenderDstIP string // ReceiverSrcIP is the receiver's source IP address ReceiverSrcIP string // ReceiverDstIP is the receiver's destination IP address ReceiverDstIP string // Protocol is the layer 4 protocol Protocol uint16 // SenderSrcPort is the sender's source port SenderSrcPort uint16 // PortRange is the tested port range PortRange string // OutFile is the file the plan and its results are written to OutFile string // ShowDiffs specifies if packet differences are shown in results ShowDiffs bool }
Config contains the configuration
func (*Config) GetPortRange ¶
GetPortRange returns the first and last port of the port range
func (*Config) GetReceiverDstIP ¶
GetReceiverDstIP returns the receiver's destination IP address
func (*Config) GetReceiverDstMAC ¶
func (c *Config) GetReceiverDstMAC() net.HardwareAddr
GetReceiverDstMAC returns the receiver's destination MAC address
func (*Config) GetReceiverSrcIP ¶
GetReceiverSrcIP returns the receiver's source IP address
func (*Config) GetReceiverSrcMAC ¶
func (c *Config) GetReceiverSrcMAC() net.HardwareAddr
GetReceiverSrcMAC returns the receiver's source MAC address
func (*Config) GetSenderDstIP ¶
GetSenderDstIP returns the sender's destination IP address
func (*Config) GetSenderDstMAC ¶
func (c *Config) GetSenderDstMAC() net.HardwareAddr
GetSenderDstMAC returns the sender's destination MAC address
func (*Config) GetSenderSrcIP ¶
GetSenderSrcIP returns the sender's source IP address
func (*Config) GetSenderSrcMAC ¶
func (c *Config) GetSenderSrcMAC() net.HardwareAddr
GetSenderSrcMAC returns the sender's source MAC address
func (*Config) ParseCommandLine ¶
func (c *Config) ParseCommandLine()
ParseCommandLine fills the config from command line arguments
type MessageNop ¶
type MessageNop struct{}
MessageNop is a no operation message
func (*MessageNop) GetType ¶
func (m *MessageNop) GetType() uint8
GetType returns the type of the message
type MessageRegister ¶
type MessageRegister struct {
Client uint8
}
MessageRegister is a register message
func (*MessageRegister) GetType ¶
func (m *MessageRegister) GetType() uint8
GetType returns the type of the message
type MessageResult ¶
MessageResult is a test result message
func (*MessageResult) GetType ¶
func (m *MessageResult) GetType() uint8
GetType returns the type of the message
type MessageTest ¶
type MessageTest struct { ID uint32 Initiate bool Device string SrcMAC net.HardwareAddr DstMAC net.HardwareAddr SrcIP net.IP DstIP net.IP Protocol uint16 SrcPort uint16 DstPort uint16 }
MessageTest is a test command message
func (*MessageTest) GetType ¶
func (m *MessageTest) GetType() uint8
GetType returns the type of the message
type TLVMessage ¶
TLVMessage is a TLV message