event_processor

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: May 19, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Ssl2Version   = 0x0002
	Ssl3Version   = 0x0300
	Tls1Version   = 0x0301
	Tls11Version  = 0x0302
	Tls12Version  = 0x0303
	Tls13Version  = 0x0304
	Dtls1Version  = 0xFEFF
	Dtls12Version = 0xFEFD
)
View Source
const (
	MaxTickerCount = 10 // 1 Sencond/(eventWorker.ticker.C) = 10
	MaxChanLen     = 16 // 包队列长度

)
View Source
const (
	MaxIncomingChanLen = 1024
	MaxParserQueueLen  = 1024
)
View Source
const ChunkSize = 16
View Source
const ChunkSizeHalf = ChunkSize / 2
View Source
const HTTP_NEW_LINE_LENGTH = 4

length of \r\n\r\n

View Source
const MaxDataSize = 1024 * 4

Variables

This section is empty.

Functions

func CToGoString

func CToGoString(c []byte) string

func GetAllModules

func GetAllModules() map[string]IParser

GetAllModules 获取modules列表

func Register

func Register(p IParser)

Types

type AttachType

type AttachType int64
const (
	ProbeEntry AttachType = iota
	ProbeRet
)

type BaseEvent

type BaseEvent struct {
	DataType  int64
	Timestamp uint64
	Pid       uint32
	Tid       uint32
	Data      [MaxDataSize]byte
	DataLen   int32
	Comm      [16]byte
	Fd        uint32
	Version   int32
	// contains filtered or unexported fields
}

func (*BaseEvent) Clone

func (be *BaseEvent) Clone() event.IEventStruct

func (*BaseEvent) Decode

func (be *BaseEvent) Decode(payload []byte) (err error)

func (*BaseEvent) EventType

func (be *BaseEvent) EventType() event.EventType

func (*BaseEvent) GetUUID

func (be *BaseEvent) GetUUID() string

func (*BaseEvent) Payload

func (be *BaseEvent) Payload() []byte

func (*BaseEvent) PayloadLen

func (be *BaseEvent) PayloadLen() int

func (*BaseEvent) String

func (be *BaseEvent) String() string

func (*BaseEvent) StringHex

func (be *BaseEvent) StringHex() string

type DefaultParser

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

func (*DefaultParser) Display

func (dp *DefaultParser) Display() []byte

func (*DefaultParser) Init

func (dp *DefaultParser) Init()

func (*DefaultParser) IsDone

func (dp *DefaultParser) IsDone() bool

func (*DefaultParser) Name

func (dp *DefaultParser) Name() string

func (*DefaultParser) PacketType

func (dp *DefaultParser) PacketType() PacketType

func (*DefaultParser) ParserType

func (dp *DefaultParser) ParserType() ParserType

func (*DefaultParser) Reset

func (dp *DefaultParser) Reset()

func (*DefaultParser) Write

func (dp *DefaultParser) Write(b []byte) (int, error)

type EventProcessor

type EventProcessor struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewEventProcessor

func NewEventProcessor(logger io.Writer, isHex bool) *EventProcessor

func (*EventProcessor) Close

func (ep *EventProcessor) Close() error

func (*EventProcessor) GetLogger

func (ep *EventProcessor) GetLogger() io.Writer

func (*EventProcessor) Serve

func (ep *EventProcessor) Serve() error

Serve Write event 处理器读取事件

func (*EventProcessor) Write

func (ep *EventProcessor) Write(e event.IEventStruct)

Write event 外部调用者调用该方法

type HTTPRequest

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

func (*HTTPRequest) Display

func (hr *HTTPRequest) Display() []byte

func (*HTTPRequest) Init

func (hr *HTTPRequest) Init()

func (*HTTPRequest) IsDone

func (hr *HTTPRequest) IsDone() bool

func (*HTTPRequest) Name

func (hr *HTTPRequest) Name() string

func (*HTTPRequest) PacketType

func (hr *HTTPRequest) PacketType() PacketType

func (*HTTPRequest) ParserType

func (hr *HTTPRequest) ParserType() ParserType

func (*HTTPRequest) Reset

func (hr *HTTPRequest) Reset()

func (*HTTPRequest) Write

func (hr *HTTPRequest) Write(b []byte) (int, error)

type HTTPResponse

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

func (*HTTPResponse) Display

func (hr *HTTPResponse) Display() []byte

func (*HTTPResponse) Init

func (hr *HTTPResponse) Init()

func (*HTTPResponse) IsDone

func (hr *HTTPResponse) IsDone() bool

func (*HTTPResponse) Name

func (hr *HTTPResponse) Name() string

func (*HTTPResponse) PacketType

func (hr *HTTPResponse) PacketType() PacketType

func (*HTTPResponse) ParserType

func (hr *HTTPResponse) ParserType() ParserType

func (*HTTPResponse) Reset

func (hr *HTTPResponse) Reset()

func (*HTTPResponse) Write

func (hr *HTTPResponse) Write(b []byte) (int, error)

type IParser

type IParser interface {
	Write(b []byte) (int, error)
	ParserType() ParserType
	PacketType() PacketType
	// Name Body() []byte
	Name() string
	IsDone() bool
	Init()
	Display() []byte
	Reset()
	// contains filtered or unexported methods
}

func GetModuleByName

func GetModuleByName(name string) IParser

GetModuleByName 获取modules列表

func NewParser

func NewParser(payload []byte) IParser

type IWorker

type IWorker interface {

	// 收包
	Write(event.IEventStruct) error
	GetUUID() string
	IfUsed() bool
	Get()
	Put()
}

func NewEventWorker

func NewEventWorker(uuid string, processor *EventProcessor) IWorker

type PacketType

type PacketType uint8
const (
	PacketTypeNull PacketType = iota
	PacketTypeUnknow
	PacketTypeGzip
	PacketTypeWebSocket
)

type ParserType

type ParserType uint8
const (
	ParserTypeNull ParserType = iota
	ParserTypeHttpRequest
	ParserTypeHttp2Request
	ParserTypeHttpResponse
	ParserTypeHttp2Response
	ParserTypeWebSocket
)

type ProcessStatus

type ProcessStatus uint8
const (
	ProcessStateInit ProcessStatus = iota
	ProcessStateProcessing
	ProcessStateDone
)

Jump to

Keyboard shortcuts

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