Documentation
¶
Index ¶
- Constants
- Variables
- func CToGoString(c []byte) string
- func GetAllModules() map[string]IParser
- func Register(p IParser)
- type AttachType
- type Base
- type BaseEvent
- func (be *BaseEvent) Base() Base
- func (be *BaseEvent) Clone() IEventStruct
- func (be *BaseEvent) Decode(payload []byte) (err error)
- func (be *BaseEvent) EventType() Type
- func (be *BaseEvent) GetUUID() string
- func (be *BaseEvent) Payload() []byte
- func (be *BaseEvent) PayloadLen() int
- func (be *BaseEvent) String() string
- func (be *BaseEvent) StringHex() string
- func (be *BaseEvent) ToProtobufEvent() *pb.Event
- type CollectorWriter
- type DefaultParser
- func (dp *DefaultParser) Display() []byte
- func (dp *DefaultParser) Init()
- func (dp *DefaultParser) IsDone() bool
- func (dp *DefaultParser) Name() string
- func (dp *DefaultParser) PacketType() PacketType
- func (dp *DefaultParser) ParserType() ParserType
- func (dp *DefaultParser) Reset()
- func (dp *DefaultParser) Write(b []byte) (int, error)
- type EventProcessor
- type HTTP2Request
- func (h2r *HTTP2Request) Display() []byte
- func (h2r *HTTP2Request) Init()
- func (h2r *HTTP2Request) IsDone() bool
- func (h2r *HTTP2Request) Name() string
- func (h2r *HTTP2Request) PacketType() PacketType
- func (h2r *HTTP2Request) ParserType() ParserType
- func (h2r *HTTP2Request) Reset()
- func (h2r *HTTP2Request) Write(b []byte) (int, error)
- type HTTP2Response
- func (h2r *HTTP2Response) Display() []byte
- func (h2r *HTTP2Response) Init()
- func (h2r *HTTP2Response) IsDone() bool
- func (h2r *HTTP2Response) Name() string
- func (h2r *HTTP2Response) PacketType() PacketType
- func (h2r *HTTP2Response) ParserType() ParserType
- func (h2r *HTTP2Response) Reset()
- func (h2r *HTTP2Response) Write(b []byte) (int, error)
- type HTTPRequest
- func (hr *HTTPRequest) Display() []byte
- func (hr *HTTPRequest) Init()
- func (hr *HTTPRequest) IsDone() bool
- func (hr *HTTPRequest) Name() string
- func (hr *HTTPRequest) PacketType() PacketType
- func (hr *HTTPRequest) ParserType() ParserType
- func (hr *HTTPRequest) Reset()
- func (hr *HTTPRequest) Write(b []byte) (int, error)
- type HTTPResponse
- func (hr *HTTPResponse) Display() []byte
- func (hr *HTTPResponse) Init()
- func (hr *HTTPResponse) IsDone() bool
- func (hr *HTTPResponse) Name() string
- func (hr *HTTPResponse) PacketType() PacketType
- func (hr *HTTPResponse) ParserType() ParserType
- func (hr *HTTPResponse) Reset()
- func (hr *HTTPResponse) Write(b []byte) (int, error)
- type IEventStruct
- type IParser
- type IWorker
- type LifeCycleState
- type PacketType
- type ParserType
- type ProcessStatus
- type TlsVersion
- type Type
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 = 1024 // 包队列长度 )
View Source
const ( MaxIncomingChanLen = 1024 MaxParserQueueLen = 1024 )
View Source
const ChunkSize = 16
View Source
const ChunkSizeHalf = ChunkSize / 2
View Source
const ClientPrefaceLen = len(http2.ClientPreface)
View Source
const MaxDataSize = 1024 * 16
View Source
const SocketLifecycleUUIDPrefix = "sock:"
SocketLifecycleUUIDPrefix Socket生命周期UUID前缀
Variables ¶
View Source
var ( ErrEventWorkerIncomingFull = errors.New("eventWorker Write failed, incoming chan is full") ErrEventWorkerOutcomingFull = errors.New("eventWorker Write failed, outComing chan is full") )
Functions ¶
func CToGoString ¶
Types ¶
type Base ¶
type Base struct {
Timestamp int64 // 时间戳
UUID string // 唯一标识符
PID int64 // 进程ID
PName string // 进程名称
SrcIP string // 源IP
SrcPort uint16 // 源端口
DstIP string // 目标IP
DstPort uint16 // 目标端口
Type uint32 // 事件类型
}
Base 事件基础信息
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() IEventStruct
func (*BaseEvent) PayloadLen ¶
func (*BaseEvent) ToProtobufEvent ¶
type CollectorWriter ¶
CollectorWriter 收集器写入接口 用于识别日志输出器是否是collector类型
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()
type EventProcessor ¶
func NewEventProcessor ¶
func NewEventProcessor(logger io.Writer, isHex bool, truncateSize uint64) *EventProcessor
func (*EventProcessor) Close ¶
func (ep *EventProcessor) Close() error
func (*EventProcessor) ErrorChan ¶
func (ep *EventProcessor) ErrorChan() chan error
func (*EventProcessor) GetLogger ¶
func (ep *EventProcessor) GetLogger() io.Writer
func (*EventProcessor) Write ¶
func (ep *EventProcessor) Write(e IEventStruct)
Write event 外部调用者调用该方法
func (*EventProcessor) WriteDestroyConn ¶
func (ep *EventProcessor) WriteDestroyConn(s uint64)
type HTTP2Request ¶
type HTTP2Request struct {
// contains filtered or unexported fields
}
func (*HTTP2Request) Display ¶
func (h2r *HTTP2Request) Display() []byte
func (*HTTP2Request) Init ¶
func (h2r *HTTP2Request) Init()
func (*HTTP2Request) IsDone ¶
func (h2r *HTTP2Request) IsDone() bool
func (*HTTP2Request) Name ¶
func (h2r *HTTP2Request) Name() string
func (*HTTP2Request) PacketType ¶
func (h2r *HTTP2Request) PacketType() PacketType
func (*HTTP2Request) ParserType ¶
func (h2r *HTTP2Request) ParserType() ParserType
func (*HTTP2Request) Reset ¶
func (h2r *HTTP2Request) Reset()
type HTTP2Response ¶
type HTTP2Response struct {
// contains filtered or unexported fields
}
func (*HTTP2Response) Display ¶
func (h2r *HTTP2Response) Display() []byte
func (*HTTP2Response) Init ¶
func (h2r *HTTP2Response) Init()
func (*HTTP2Response) IsDone ¶
func (h2r *HTTP2Response) IsDone() bool
func (*HTTP2Response) Name ¶
func (h2r *HTTP2Response) Name() string
func (*HTTP2Response) PacketType ¶
func (h2r *HTTP2Response) PacketType() PacketType
func (*HTTP2Response) ParserType ¶
func (h2r *HTTP2Response) ParserType() ParserType
func (*HTTP2Response) Reset ¶
func (h2r *HTTP2Response) Reset()
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()
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()
type IEventStruct ¶
type IEventStruct interface {
// GetUUID 获取事件的唯一标识符
GetUUID() string
// Payload 获取事件的payload数据
Payload() []byte
// Base 获取事件的基本信息
Base() Base
// ToProtobufEvent 转换为protobuf事件
ToProtobufEvent() *pb.Event
// Clone 克隆事件
Clone() IEventStruct
// EventType 获取事件类型
EventType() Type
}
IEventStruct 事件接口定义 这个接口定义了event_processor需要的事件方法
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
}
type IWorker ¶
type IWorker interface {
// 收包
Write(IEventStruct) error
GetUUID() string
GetDestroyUUID() uint64
IfUsed() bool
Get()
Put()
CloseEventWorker()
}
func NewEventWorker ¶
func NewEventWorker(uuid string, processor *EventProcessor) IWorker
type LifeCycleState ¶
type LifeCycleState uint8
eventWorker有两种生命周期,一种由自己的定时器决定,另一种由外部Socket的生命周期决定
const ( LifeCycleStateDefault LifeCycleState = iota LifeCycleStateSock )
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 )
type TlsVersion ¶
type TlsVersion struct {
Version int32
}
func (TlsVersion) String ¶
func (t TlsVersion) String() string
Click to show internal directories.
Click to hide internal directories.