Documentation
¶
Overview ¶
Package network handles network-layer protocol conversations (ICMP, IGMP, GRE, etc.) that don't have a transport layer. Conversations are grouped by IP pair.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Streams = newNetworkStreamPool()
Streams contains a pool of network-layer data streams
Functions ¶
func FlushNetworkStreams ¶
func FlushNetworkStreams()
FlushNetworkStreams will flush all collected network-layer streams to disk
func NumSavedNetworkConns ¶
func NumSavedNetworkConns() int64
NumSavedNetworkConns returns the number of saved network-layer conversations
func ResetStreams ¶
func ResetStreams()
ResetStreams creates a new network stream pool to clear all stream state This should be called when resetting state between processing different files
Types ¶
type NetworkData ¶
type NetworkData struct {
// Raw payload data from the network layer
RawData []byte
// Capture information from gopacket
CaptureInformation gopacket.CaptureInfo
// Network layer flow (src/dst IP)
Net gopacket.Flow
// Protocol type (e.g., "ICMPv4", "ICMPv6", "IGMP", "GRE")
Protocol string
// Direction of the packet (client to server or server to client)
Dir reassembly.TCPFlowDirection
}
NetworkData represents a single network-layer packet fragment
func (*NetworkData) CaptureInfo ¶
func (n *NetworkData) CaptureInfo() gopacket.CaptureInfo
CaptureInfo returns the capture information from gopacket
func (*NetworkData) Direction ¶
func (n *NetworkData) Direction() reassembly.TCPFlowDirection
Direction returns the direction of the packet
func (*NetworkData) Network ¶
func (n *NetworkData) Network() gopacket.Flow
Network returns the network layer flow
func (*NetworkData) Raw ¶
func (n *NetworkData) Raw() []byte
Raw returns the raw byte slice that makes up the data fragment.
func (*NetworkData) SetDirection ¶
func (n *NetworkData) SetDirection(d reassembly.TCPFlowDirection)
SetDirection sets the direction of the packet
type NetworkDataFragments ¶
type NetworkDataFragments []*NetworkData
NetworkDataFragments is a sortable slice of NetworkData
func (NetworkDataFragments) Len ¶
func (n NetworkDataFragments) Len() int
Len returns the length of the fragments
func (NetworkDataFragments) Less ¶
func (n NetworkDataFragments) Less(i, j int) bool
Less compares two fragments by timestamp
func (NetworkDataFragments) Size ¶
func (n NetworkDataFragments) Size() int
Size returns the total size of all fragments
func (NetworkDataFragments) Sort ¶
func (n NetworkDataFragments) Sort()
Sort sorts the fragments by timestamp
func (NetworkDataFragments) Swap ¶
func (n NetworkDataFragments) Swap(i, j int)
Swap swaps two fragments