Documentation ¶
Index ¶
- Constants
- Variables
- type GlobalHeader
- type RawPacket
- type RecordHeader
- type Worker
- type WorkerCounter
- type WorkerManager
- type WrappedWriter
- type Writer
- func (w *Writer) BufferSize() int
- func (w *Writer) Clear()
- func (w *Writer) Close() error
- func (w *Writer) FileSize() int64
- func (w *Writer) Flush() error
- func (w *Writer) GetAndResetStats() WriterCounter
- func (w *Writer) GetStats() WriterCounter
- func (w *Writer) ResetStats()
- func (w *Writer) Write(packet *datatype.MetaPacket) error
- type WriterCounter
- type WriterKey
Constants ¶
View Source
const ( SLICE_PAYLOAD_LEN = 2 MAX_HEADER_LEN = 128 MAC_ADDRESS_LEN = 6 IP_ADDRESS_LEN = 4 )
View Source
const ( ETHERNET_LEN = 14 VLAN_LEN = 4 )
View Source
const ( IPV4_VERSION_IHL_OFFSET = 0 IPV4_DSCP_ECN_OFFSET = 1 IPV4_TOTAL_LENGTH_OFFSET = 2 IPV4_ID_OFFSET = 4 IPV4_FLAGS_FRAGMENT_OFFSET = 6 IPV4_TTL_OFFSET = 8 IPV4_PROTOCOL_OFFSET = 9 IPV4_HEADER_CHECKSUM_OFFSET = 10 IPV4_SIP_OFFSET = 12 IPV4_DIP_OFFSET = 16 IPV4_LEN = 20 // no options )
View Source
const ( IPV4_VERSION = 4 IPV6_VERSION = 6 )
View Source
const ( IPV6_VERSION_FLOW_LABEL_OFFSET = 0 IPV6_PAYLOAD_LENGTH_OFFSET = 4 IPV6_NEXT_HEADER_OFFSET = 6 IPV6_HOP_LIMIT_OFFSET = 7 IPV6_SRC_ADDRESS_OFFSET = 8 IPV6_DST_ADDRESS_OFFSET = 24 IPV6_OPTIONS_OFFSET = 40 IPV6_HEADER_LEN = 40 )
View Source
const ( TCP_SPORT_OFFSET = 0 TCP_DPORT_OFFSET = 2 TCP_SEQ_NUMBER_OFFSET = 4 TCP_ACK_NUMBER_OFFSET = 8 TCP_DATA_OFFSET_OFFSET = 12 TCP_FLAGS_OFFSET = 13 // NS not included TCP_WINDOW_SIZE_OFFSET = 14 TCP_CHECKSUM_OFFSET = 16 TCP_URG_PTR_OFFSET = 18 TCP_OPTIONS_OFFSET = 20 TCP_MAX_OPTIONS_LEN = 40 TCP_MIN_LEN = 20 )
View Source
const ( TCP_OPTION_KIND_MSS_LEN = 4 TCP_OPTION_KIND_WINDOW_SCALE_LEN = 3 TCP_OPTION_KIND_SACK_PERMITTED_LEN = 2 )
View Source
const ( UDP_SPORT_OFFSET = 0 UDP_DPORT_OFFSET = 2 UDP_LENGTH_OFFSET = 4 UDP_CHECKSUM_OFFSET = 6 UDP_LEN = 8 )
View Source
const ( GLOBAL_HEADER_LEN = 24 PCAP_MAGIC = 0xa1b2c3d4 VERSION_MAJOR = 2 VERSION_MINOR = 4 )
View Source
const ( RECORD_HEADER_LEN = 16 TS_SEC_OFFSET = 0 TS_USEC_OFFSET = 4 INCL_LEN_OFFSET = 8 ORIG_LEN_OFFSET = 12 )
View Source
const ( QUEUE_BATCH_SIZE = 1024 BROADCAST_MAC = datatype.MacInt(^uint64(0) >> 16) BROADCAST_IP = datatype.IPv4Int(^uint32(0)) )
View Source
const (
SNAPLEN = 65535
)
View Source
const (
TIME_FORMAT = "060102150405"
)
Variables ¶
Functions ¶
This section is empty.
Types ¶
type GlobalHeader ¶
type GlobalHeader []byte
func NewGlobalHeader ¶
func NewGlobalHeader(buffer []byte, snaplen uint32) GlobalHeader
type RawPacket ¶
type RawPacket []byte
func NewRawPacket ¶
func (RawPacket) MetaPacketToRaw ¶
func (p RawPacket) MetaPacketToRaw(packet *datatype.MetaPacket, tcpipChecksum bool) int
type RecordHeader ¶
type RecordHeader []byte
func NewRecordHeader ¶
func NewRecordHeader(buffer []byte) RecordHeader
func (RecordHeader) SetInclLen ¶
func (h RecordHeader) SetInclLen(inclLen int)
func (RecordHeader) SetOrigLen ¶
func (h RecordHeader) SetOrigLen(origLen int)
func (RecordHeader) SetTimestamp ¶
func (h RecordHeader) SetTimestamp(ts time.Duration)
type Worker ¶
type Worker struct { *WorkerCounter // contains filtered or unexported fields }
func (*Worker) GetCounter ¶
func (w *Worker) GetCounter() interface{}
type WorkerCounter ¶
type WorkerCounter struct { FileCreations uint64 `statsd:"file_creations"` FileCloses uint64 `statsd:"file_closes"` FileRejections uint64 `statsd:"file_rejections"` FileCreationFailures uint64 `statsd:"file_creation_failures"` FileWritingFailures uint64 `statsd:"file_writing_failures"` BufferedCount uint64 `statsd:"buffered_count"` WrittenCount uint64 `statsd:"written_count"` BufferedBytes uint64 `statsd:"buffered_bytes"` WrittenBytes uint64 `statsd:"written_bytes"` }
type WorkerManager ¶
type WorkerManager struct {
// contains filtered or unexported fields
}
func NewWorkerManager ¶
func NewWorkerManager( packetQueueReaders []queue.QueueReader, packetQueueWriters []queue.QueueWriter, tcpipChecksum bool, blockSizeKB int, maxConcurrentFiles int, maxFileSizeMB int, maxFilePeriodSecond int, maxDirectorySizeGB int, diskFreeSpaceMarginGB int, baseDirectory string, ) *WorkerManager
func (*WorkerManager) Close ¶
func (m *WorkerManager) Close() error
func (*WorkerManager) Start ¶
func (m *WorkerManager) Start() []io.Closer
type WrappedWriter ¶
type WrappedWriter struct { *Writer // contains filtered or unexported fields }
type Writer ¶
type Writer struct { WriterCounter // contains filtered or unexported fields }
func (*Writer) BufferSize ¶
func (*Writer) GetAndResetStats ¶
func (w *Writer) GetAndResetStats() WriterCounter
func (*Writer) GetStats ¶
func (w *Writer) GetStats() WriterCounter
func (*Writer) ResetStats ¶
func (w *Writer) ResetStats()
type WriterCounter ¶
type WriterCounter struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.