mirror of
https://github.com/40t/go-sniffer.git
synced 2025-10-19 14:29:17 +08:00
implementl get user and database
Signed-off-by: zhuhuijun <zhuhuijunzhj@gmail.com>
This commit is contained in:
34
pkg/model/result.go
Normal file
34
pkg/model/result.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package model
|
||||
|
||||
import "encoding/json"
|
||||
|
||||
// MysqlQueryPiece 查询信息
|
||||
type MysqlQueryPiece struct {
|
||||
BaseQueryPiece
|
||||
|
||||
ClientHost string `json:"cip"`
|
||||
ClientPort string `json:"cport"`
|
||||
|
||||
VisitUser string `json:"user"`
|
||||
VisitDB string `json:"db"`
|
||||
QuerySQL string `json:"sql"`
|
||||
CostTimeInMS int64 `json:"cms"`
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
// BaseQueryPiece 查询信息
|
||||
type BaseQueryPiece struct {
|
||||
ServerIP string `json:"sip"`
|
||||
ServerPort string `json:"sport"`
|
||||
CapturePacketRate float64 `json:"cpr"`
|
||||
EventTime int64 `json:"bt"`
|
||||
}
|
||||
|
||||
func (p MysqlQueryPiece) ToString() string {
|
||||
bytes, err := json.Marshal(&p)
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
|
||||
return string(bytes)
|
||||
}
|
10
pkg/model/session.go
Normal file
10
pkg/model/session.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package model
|
||||
|
||||
type MysqlSession struct {
|
||||
UserName string
|
||||
DBName string
|
||||
ClientIP string
|
||||
ClientPort string
|
||||
ServerIP string
|
||||
ServerPort string
|
||||
}
|
Reference in New Issue
Block a user