mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-28 17:48:45 +01:00
52 lines
1.3 KiB
Go
52 lines
1.3 KiB
Go
package scpacket
|
|
|
|
import (
|
|
"reflect"
|
|
|
|
"github.com/scripthaus-dev/mshell/pkg/packet"
|
|
)
|
|
|
|
const FeCommandPacketStr = "fecmd"
|
|
const WatchScreenPacketStr = "watchscreen"
|
|
|
|
type RemoteState struct {
|
|
RemoteId string `json:"remoteid"`
|
|
RemoteName string `json:"remotename"`
|
|
Cwd string `json:"cwd"`
|
|
}
|
|
|
|
type FeCommandPacketType struct {
|
|
Type string `json:"type"`
|
|
MetaCmd string `json:"metacmd"`
|
|
MetaSubCmd string `json:"metasubcmd,omitempty"`
|
|
Args []string `json:"args,omitempty"`
|
|
Kwargs map[string]string `json:"kwargs,omitempty"`
|
|
}
|
|
|
|
func init() {
|
|
packet.RegisterPacketType(FeCommandPacketStr, reflect.TypeOf(FeCommandPacketType{}))
|
|
packet.RegisterPacketType(WatchScreenPacketStr, reflect.TypeOf(WatchScreenPacketType{}))
|
|
}
|
|
|
|
func (*FeCommandPacketType) GetType() string {
|
|
return FeCommandPacketStr
|
|
}
|
|
|
|
func MakeFeCommandPacket() *FeCommandPacketType {
|
|
return &FeCommandPacketType{Type: FeCommandPacketStr}
|
|
}
|
|
|
|
type WatchScreenPacketType struct {
|
|
Type string `json:"type"`
|
|
SessionId string `json:"sessionid"`
|
|
ScreenId string `json:"screenid"`
|
|
}
|
|
|
|
func (*WatchScreenPacketType) GetType() string {
|
|
return WatchScreenPacketStr
|
|
}
|
|
|
|
func MakeWatchScreenPacket() *WatchScreenPacketType {
|
|
return &WatchScreenPacketType{Type: WatchScreenPacketStr}
|
|
}
|