Documentation ¶
Index ¶
- Constants
- Variables
- func CToGoString(c []byte) string
- func GetAllModules() map[string]IParser
- func Register(p IParser)
- type AttachType
- type BaseEvent
- func (be *BaseEvent) Clone() event.IEventStruct
- func (be *BaseEvent) Decode(payload []byte) (err error)
- func (be *BaseEvent) EventType() event.EventType
- 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
- 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 IParser
- type IWorker
- type PacketType
- type ParserType
- type ProcessStatus
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 HTTP_NEW_LINE_LENGTH = 4
length of \r\n\r\n
View Source
const MaxDataSize = 1024 * 4
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 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) PayloadLen ¶
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) *EventProcessor
func (*EventProcessor) Close ¶
func (ep *EventProcessor) Close() error
func (*EventProcessor) ErrorChan ¶ added in v0.9.0
func (ep *EventProcessor) ErrorChan() chan error
func (*EventProcessor) GetLogger ¶
func (ep *EventProcessor) GetLogger() io.Writer
func (*EventProcessor) Write ¶
func (ep *EventProcessor) Write(e event.IEventStruct)
Write event 外部调用者调用该方法
type HTTP2Request ¶ added in v0.8.5
type HTTP2Request struct {
// contains filtered or unexported fields
}
func (*HTTP2Request) Display ¶ added in v0.8.5
func (h2r *HTTP2Request) Display() []byte
func (*HTTP2Request) Init ¶ added in v0.8.5
func (h2r *HTTP2Request) Init()
func (*HTTP2Request) IsDone ¶ added in v0.8.5
func (h2r *HTTP2Request) IsDone() bool
func (*HTTP2Request) Name ¶ added in v0.8.5
func (h2r *HTTP2Request) Name() string
func (*HTTP2Request) PacketType ¶ added in v0.8.5
func (h2r *HTTP2Request) PacketType() PacketType
func (*HTTP2Request) ParserType ¶ added in v0.8.5
func (h2r *HTTP2Request) ParserType() ParserType
func (*HTTP2Request) Reset ¶ added in v0.8.5
func (h2r *HTTP2Request) Reset()
type HTTP2Response ¶ added in v0.8.5
type HTTP2Response struct {
// contains filtered or unexported fields
}
func (*HTTP2Response) Display ¶ added in v0.8.5
func (h2r *HTTP2Response) Display() []byte
func (*HTTP2Response) Init ¶ added in v0.8.5
func (h2r *HTTP2Response) Init()
func (*HTTP2Response) IsDone ¶ added in v0.8.5
func (h2r *HTTP2Response) IsDone() bool
func (*HTTP2Response) Name ¶ added in v0.8.5
func (h2r *HTTP2Response) Name() string
func (*HTTP2Response) PacketType ¶ added in v0.8.5
func (h2r *HTTP2Response) PacketType() PacketType
func (*HTTP2Response) ParserType ¶ added in v0.8.5
func (h2r *HTTP2Response) ParserType() ParserType
func (*HTTP2Response) Reset ¶ added in v0.8.5
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 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(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 )
Click to show internal directories.
Click to hide internal directories.