MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / ProcessData

Function ProcessData

agent/utils/websocket/process_data.go:106–140  ·  view source on GitHub ↗
(c *Client, inputMsg []byte)

Source from the content-addressed store, hash-verified

104}
105
106func ProcessData(c *Client, inputMsg []byte) {
107 wsInput := &WsInput{}
108 err := json.Unmarshal(inputMsg, wsInput)
109 if err != nil {
110 global.LOG.Errorf("unmarshal wsInput error,err %s", err.Error())
111 return
112 }
113 switch wsInput.Type {
114 case "wget":
115 res, err := getDownloadProcess(wsInput.DownloadProgress)
116 if err != nil {
117 return
118 }
119 c.Send(res)
120 case "ps":
121 res, err := getProcessData(wsInput.PsProcessConfig)
122 if err != nil {
123 return
124 }
125 c.Send(res)
126 case "ssh":
127 res, err := getSSHSessions(wsInput.SSHSessionConfig)
128 if err != nil {
129 return
130 }
131 c.Send(res)
132 case "net":
133 res, err := getNetConnections(wsInput.NetConfig)
134 if err != nil {
135 return
136 }
137 c.Send(res)
138 }
139
140}
141
142func getDownloadProcess(progress DownloadProgress) (res []byte, err error) {
143 var result []files.Process

Callers 1

ReadMethod · 0.85

Calls 6

getDownloadProcessFunction · 0.85
getProcessDataFunction · 0.85
getSSHSessionsFunction · 0.85
getNetConnectionsFunction · 0.85
ErrorMethod · 0.45
SendMethod · 0.45

Tested by

no test coverage detected