(c *Client, inputMsg []byte)
| 104 | } |
| 105 | |
| 106 | func 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 | |
| 142 | func getDownloadProcess(progress DownloadProgress) (res []byte, err error) { |
| 143 | var result []files.Process |
no test coverage detected