Documentation ¶
Overview ¶
Package probe classifies the packets into stream according to network flow and transport flow.
stream(network1:transport1)\ / \ / hash(transport flow)- stream(network2:transport1)- \
packet-> hash(network flow) messages
\ hash(transport flow)- stream(network3:transport2)- / \ / stream(network4:transport2)/ | tcp assembly |
Index ¶
- func GenerateSourceQuery(node sqlparser.SQLNode) (string, map[string]string)
- func GenerateTemplateQuery(node sqlparser.SQLNode) (string, map[string]string)
- type Assembly
- type IsRequest
- type Key
- type MysqlBasePacket
- func (p *MysqlBasePacket) DecodeFromBytes(data []byte) (int, error)
- func (p *MysqlBasePacket) Length() int
- func (p *MysqlBasePacket) ParseRequestPacket(packet *MysqlRequestPacket) error
- func (p *MysqlBasePacket) ParseResponsePacket(reqType byte, packet *MysqlResponsePacket) (err error)
- func (p *MysqlBasePacket) Seq() byte
- type MysqlRequestPacket
- type MysqlResponsePacket
- type MysqlStream
- type Probe
- type Worker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateSourceQuery ¶
GenerateSourceQuery rebuild the query by AST
Types ¶
type Assembly ¶
type Assembly struct {
// contains filtered or unexported fields
}
Assembly dispatchs packet according to net flow and tcp flow
type Key ¶
type Key struct {
// contains filtered or unexported fields
}
Key is the pair of networker and transport Flow
type MysqlBasePacket ¶
MysqlBasePacket is the complete packet with header and payload
func (*MysqlBasePacket) DecodeFromBytes ¶
func (p *MysqlBasePacket) DecodeFromBytes(data []byte) (int, error)
DecodeFromBytes try to decode the first packet from bytes
func (*MysqlBasePacket) Length ¶
func (p *MysqlBasePacket) Length() int
Length retrun the body length
func (*MysqlBasePacket) ParseRequestPacket ¶
func (p *MysqlBasePacket) ParseRequestPacket(packet *MysqlRequestPacket) error
ParseRequestPacket filter out the query packet
func (*MysqlBasePacket) ParseResponsePacket ¶
func (p *MysqlBasePacket) ParseResponsePacket(reqType byte, packet *MysqlResponsePacket) (err error)
ParseResponsePacket distinguish OK packet, Err packet and Result set Packet
type MysqlRequestPacket ¶
type MysqlRequestPacket struct {
// contains filtered or unexported fields
}
MysqlRequestPacket retains the infomation of query packet
func (*MysqlRequestPacket) CMD ¶
func (p *MysqlRequestPacket) CMD() byte
CMD return the request command flag
func (*MysqlRequestPacket) SQL ¶
func (p *MysqlRequestPacket) SQL() string
SQL return the sql in query packet
func (*MysqlRequestPacket) Seq ¶
func (p *MysqlRequestPacket) Seq() uint8
Seq return the sequence id in head
func (*MysqlRequestPacket) Stmt ¶
func (p *MysqlRequestPacket) Stmt() sqlparser.Statement
Stmt return the AST of the sql in query packet
func (*MysqlRequestPacket) StmtID ¶
func (p *MysqlRequestPacket) StmtID() uint32
StmtID return the statement id of a execution request
type MysqlResponsePacket ¶
type MysqlResponsePacket struct {
// contains filtered or unexported fields
}
MysqlResponsePacket retains the infomation about the response packet of query
type MysqlStream ¶
type MysqlStream struct {
// contains filtered or unexported fields
}
MysqlStream is a tcp assembly stream wrapper of ReaderStream
type Probe ¶
type Probe struct {
// contains filtered or unexported fields
}
Probe need to deloyed at server side.
func NewProbe ¶
func NewProbe(device string, snapLen int32, port uint16, workerNum int, out chan<- *message.Message, watcher *util.ConnectionWatcher) *Probe
NewProbe create a probe to collect and parse packets
type Worker ¶
type Worker struct {
// contains filtered or unexported fields
}
Worker assembles the data from tcp connection dispatched by Probe
func NewProbeWorker ¶
NewProbeWorker create a new woker to assemble tcp packets