tcpreader

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 4, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Stream

type Stream interface {
	// Closed check stream closed
	Closed() bool
	// Recv data from stream;
	// chan closed when Stream close;
	// return empty bytes when stream lost some data.
	Recv() <-chan []byte
}

Stream stream for watcher

type StreamConfig

type StreamConfig struct {
	// RecvBufferLen recv channel length,
	// min is recvBufferMin(128)
	RecvBufferLen int
	// MaxBuffered is an upper limit on the number of
	// out-of-order packet.
	MaxBuffered int
}

StreamConfig config of tcp stream

type StreamFactory

type StreamFactory interface {
	// Notify new stream created
	New(flow string, stream Stream)
}

StreamFactory is used by assembly to create a new stream for each new TCP session.

type StreamPool

type StreamPool struct {
	// contains filtered or unexported fields
}

StreamPool storage all cap tcp stream Notice: cannot run at muti threads

func NewStreamPool

func NewStreamPool(factory StreamFactory, cfg StreamConfig) *StreamPool

NewStreamPool new tcp stream reassembly pool

func (*StreamPool) AssembleWithTimestamp

func (p *StreamPool) AssembleWithTimestamp(netFlow gopacket.Flow, t *layers.TCP, timestamp time.Time)

AssembleWithTimestamp write tcp package from pcap

func (*StreamPool) FlushOlderThan

func (p *StreamPool) FlushOlderThan(t time.Time)

FlushOlderThan close connection last input data time < `t`

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL