func (m *MatrixClient) onAppDisconnect(p *skn.Packet) { id := new(skynet.Pstring) err := proto.Unmarshal(p.Body, id) if err != nil { log.Println("onAppDisconnect - ", err) return } delete(appInfos, id.GetValue()) }
func (a *Agent) onAppDisconnected(p *skn.Packet) { id := new(skynet.Pstring) err := proto.Unmarshal(p.Body, id) if err != nil { log.Println("onAppDisconnected - ", err) return } delete(appInfos, id.GetValue()) tcpServer.Broadcast(p) }
func (m *MatrixClient) execAgentCmd(p *skn.Packet) { go func() { c := new(skynet.Pstring) err := proto.Unmarshal(p.Body, c) if err != nil { log.Println("execAgentCmd - ", err) return } log.Println("execAgentCmd", c.GetValue()) rawCmd := strings.Split(c.GetValue(), " ") cmd := exec.Command(rawCmd[0], rawCmd[1:]...) data, err := cmd.CombinedOutput() if err != nil { log.Println(err) return } log.Println(string(data)) }() }