mirror of
https://github.com/Li4n0/revsuit.git
synced 2026-09-25 16:11:53 +08:00
feat(rmi): support receive rmi connection (#5)
This commit is contained in:
+3
-3
@@ -125,7 +125,7 @@ func (s *Server) ConnectionClosed(c *vmysql.Conn) {
|
||||
log.Error("MySQL record(rule_id:%s) created failed :%s", _rule.Name, err.Error())
|
||||
return
|
||||
}
|
||||
log.Trace("MySQL record(id:%d) has been created", r.ID)
|
||||
log.Info("MySQL record(id:%d,rule:%s,remote_ip:%s) has been created", r.ID, _rule.Name, ip)
|
||||
|
||||
//only send to client when this connection recorded first time.
|
||||
if _rule.PushToClient {
|
||||
@@ -267,10 +267,10 @@ func (s *Server) Run() {
|
||||
var authServer = &vmysql.AuthServerNone{}
|
||||
var err error
|
||||
|
||||
log.Info("Starting Mysql Server at %s", s.Addr)
|
||||
log.Info("Starting MySQL Server at %s", s.Addr)
|
||||
s.listener, err = vmysql.NewListener("tcp", s.Addr, authServer, s, s.VersionString, 0, 0)
|
||||
if err != nil {
|
||||
log.Error("New Mysql Server failed: %s", err)
|
||||
log.Error("New MySQL Server failed: %s", err)
|
||||
os.Exit(-1)
|
||||
}
|
||||
|
||||
|
||||
+7
-1
@@ -49,13 +49,14 @@ func newRecord(rule *Rule, flag, username, clientName, clientOS, remoteIp, ipAre
|
||||
return r, err
|
||||
}
|
||||
|
||||
func List(c *gin.Context) {
|
||||
func ListRecords(c *gin.Context) {
|
||||
var (
|
||||
mysqlRecord Record
|
||||
res []Record
|
||||
count int64
|
||||
order = c.Query("order")
|
||||
)
|
||||
|
||||
if err := c.ShouldBind(&mysqlRecord); err != nil {
|
||||
c.JSON(400, gin.H{
|
||||
"status": "failed",
|
||||
@@ -90,6 +91,11 @@ func List(c *gin.Context) {
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if order != "desc" && order != "asc" {
|
||||
order = "desc"
|
||||
}
|
||||
|
||||
if err := db.Preload("Files").Order("id" + " " + order).Count(&count).Offset((page - 1) * 10).Limit(10).Find(&res).Error; err != nil {
|
||||
c.JSON(400, gin.H{
|
||||
"status": "failed",
|
||||
|
||||
@@ -89,6 +89,11 @@ func ListRules(c *gin.Context) {
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if order != "desc" && order != "asc" {
|
||||
order = "desc"
|
||||
}
|
||||
|
||||
if err := db.Order("rank desc").Order("id" + " " + order).Count(&count).Offset((page - 1) * 10).Limit(10).Find(&res).Error; err != nil {
|
||||
c.JSON(400, gin.H{
|
||||
"status": "failed",
|
||||
|
||||
Reference in New Issue
Block a user