mirror of
https://github.com/lejianwen/rustdesk-api.git
synced 2025-12-03 18:43:15 +00:00
add conn log
This commit is contained in:
40
http/request/api/audit.go
Normal file
40
http/request/api/audit.go
Normal 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,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user