marge: 合并代码
This commit is contained in:
20
src/modules/ws/model/net_connect.go
Normal file
20
src/modules/ws/model/net_connect.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package model
|
||||
|
||||
import "github.com/shirou/gopsutil/v3/net"
|
||||
|
||||
// NetConnectData 网络连接进程数据
|
||||
type NetConnectData struct {
|
||||
Type string `json:"type"`
|
||||
Status string `json:"status"`
|
||||
Laddr net.Addr `json:"localaddr"`
|
||||
Raddr net.Addr `json:"remoteaddr"`
|
||||
PID int32 `json:"PID"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
// NetConnectQuery 网络连接进程查询
|
||||
type NetConnectQuery struct {
|
||||
Port int32 `json:"port"`
|
||||
ProcessName string `json:"processName"`
|
||||
ProcessID int32 `json:"processID"`
|
||||
}
|
||||
38
src/modules/ws/model/ps_process.go
Normal file
38
src/modules/ws/model/ps_process.go
Normal file
@@ -0,0 +1,38 @@
|
||||
package model
|
||||
|
||||
// PsProcessData 进程数据
|
||||
type PsProcessData struct {
|
||||
PID int32 `json:"PID"`
|
||||
Name string `json:"name"`
|
||||
PPID int32 `json:"PPID"`
|
||||
Username string `json:"username"`
|
||||
Status string `json:"status"`
|
||||
StartTime string `json:"startTime"`
|
||||
NumThreads int32 `json:"numThreads"`
|
||||
NumConnections int `json:"numConnections"`
|
||||
CpuPercent string `json:"cpuPercent"`
|
||||
|
||||
DiskRead string `json:"diskRead"`
|
||||
DiskWrite string `json:"diskWrite"`
|
||||
CmdLine string `json:"cmdLine"`
|
||||
|
||||
Rss string `json:"rss"`
|
||||
VMS string `json:"vms"`
|
||||
HWM string `json:"hwm"`
|
||||
Data string `json:"data"`
|
||||
Stack string `json:"stack"`
|
||||
Locked string `json:"locked"`
|
||||
Swap string `json:"swap"`
|
||||
|
||||
CpuValue float64 `json:"cpuValue"`
|
||||
RssValue uint64 `json:"rssValue"`
|
||||
|
||||
Envs []string `json:"envs"`
|
||||
}
|
||||
|
||||
// PsProcessQuery 进程查询
|
||||
type PsProcessQuery struct {
|
||||
Pid int32 `json:"pid"`
|
||||
Name string `json:"name"`
|
||||
Username string `json:"username"`
|
||||
}
|
||||
21
src/modules/ws/model/ws.go
Normal file
21
src/modules/ws/model/ws.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package model
|
||||
|
||||
import "github.com/gorilla/websocket"
|
||||
|
||||
// WSClient ws客户端
|
||||
type WSClient struct {
|
||||
ID string // 连接ID-随机字符串16位
|
||||
Conn *websocket.Conn // 连接实例
|
||||
LastHeartbeat int64 // 最近一次心跳消息(毫秒)
|
||||
BindUid string // 绑定登录用户ID
|
||||
SubGroup []string // 订阅组ID
|
||||
MsgChan chan []byte // 消息通道
|
||||
StopChan chan struct{} // 停止信号-退出协程
|
||||
}
|
||||
|
||||
// WSRequest ws消息接收
|
||||
type WSRequest struct {
|
||||
RequestID string `json:"requestId"` // 请求ID
|
||||
Type string `json:"type"` // 业务类型
|
||||
Data any `json:"data"` // 查询结构
|
||||
}
|
||||
Reference in New Issue
Block a user