add conn log

This commit is contained in:
ljw
2024-10-18 15:05:58 +08:00
parent 488fedf784
commit e142cc00c6
20 changed files with 1253 additions and 169 deletions

40
http/request/api/audit.go Normal file
View File

@@ -0,0 +1,40 @@
package api
import (
"Gwen/model"
"strconv"
)
type AuditConnForm struct {
Action string `json:"action"`
ConnId int64 `json:"conn_id"`
Id string `json:"id"`
Peer []string `json:"peer"`
Ip string `json:"ip"`
SessionId float64 `json:"session_id"`
Type int `json:"type"`
Uuid string `json:"uuid"`
}
func (a *AuditConnForm) ToAuditConn() *model.AuditConn {
fp := ""
fn := ""
if len(a.Peer) >= 1 {
fp = a.Peer[0]
if len(a.Peer) == 2 {
fn = a.Peer[1]
}
}
ssid := strconv.FormatFloat(a.SessionId, 'f', -1, 64)
return &model.AuditConn{
Action: a.Action,
ConnId: a.ConnId,
PeerId: a.Id,
FromPeer: fp,
FromName: fn,
Ip: a.Ip,
SessionId: ssid,
Type: a.Type,
Uuid: a.Uuid,
}
}