release 0.1.3-beta (#19)

Co-authored-by: E99p1ant <[email protected]>
This commit is contained in:
Li4n0
2021-05-25 20:41:37 +08:00
committed by GitHub
co-authored by E99p1ant
parent 1144f67d37
commit cbbf3ba0ba
68 changed files with 640 additions and 197 deletions
+4 -4
View File
@@ -48,7 +48,7 @@ func (s *Server) getRules() []*Rule {
return s.rules
}
func (s *Server) updateRules() error {
func (s *Server) UpdateRules() error {
db := database.DB.Model(new(Rule))
defer s.rulesLock.Unlock()
s.rulesLock.Lock()
@@ -105,11 +105,11 @@ func (s *Server) ConnectionClosed(c *vmysql.Conn) {
var clientName, clientOS, flag, flagGroup string
user := c.User
schema := c.SchemaName
supportLoadLocalData := c.SupportLoadDataLocal
cr, ok := s.connRulePool.Load(c.ConnectionID)
if !ok {
log.Warn("MySQL Connection rule(%d) not match flag", c.ConnectionID)
return
}
@@ -130,7 +130,7 @@ func (s *Server) ConnectionClosed(c *vmysql.Conn) {
}
}
r, err := newRecord(_rule, flag, user, clientName, clientOS, ip, qqwry.Area(ip), supportLoadLocalData, files)
r, err := newRecord(_rule, flag, user, schema, clientName, clientOS, ip, qqwry.Area(ip), supportLoadLocalData, files)
if err != nil {
log.Warn("MySQL record[rule_id: %s] created failed: %s", _rule.Name, err)
return
@@ -288,7 +288,7 @@ func (s *Server) Run() {
s.Enable = false
s.livingLock.Unlock()
}()
if err := s.updateRules(); err != nil {
if err := s.UpdateRules(); err != nil {
log.Error(err.Error())
return
}