wire

package
v0.0.0-...-5801c3e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 26, 2019 License: MIT Imports: 3 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AttachHeader

func AttachHeader(header *Header, body []byte) []byte

func Encode

func Encode(connid UID, cmdtype CommandType, flow FlowType, v interface{}) ([]byte, error)

func UpdateHeader

func UpdateHeader(header *Header, body []byte) []byte

Types

type AgentsCountMsg

type AgentsCountMsg struct {
	Agents map[string]UID
}

used by server to give connid and list of agents online

type Byteable

type Byteable interface {
	GetBytes() []byte
}

type CommandType

type CommandType byte
const (
	CMD_SERVER_HELLO CommandType = iota
	CMD_SYSTEM_STAT
	CMD_TERMINAL
	CMD_TASKMGR
	CMD_PROCESS_ACTION
	CMD_LIST_SERVICES
	CMD_SERVICE_ACTION
	CMD_EXIT
	CMD_GCM_TOKEN // register gcm or notification tokens from browser to server
	CMD_AGENTS_NO
	CMD_EVENTS
	CMD_FM_LISTDIR
	CMD_FM_ACTION
	CMD_SYSTEM_ACTION
	CMD_START_SERVICE
	CMD_DOWNLOAD_SERVICE
	CMD_UPLOAD_SERVICE
	CMD_SCRIPT
	CMD_BUILTIN_MAX
)

type DownloaderReq

type DownloaderReq struct {
	Control byte
	Offset  int64
}

type Exit

type Exit struct {
}

type FSNode

type FSNode struct {
	Name string
	Type string
	Size int64
}

type FlowType

type FlowType byte
const (
	AgentToUser FlowType = iota
	UserToAgent
	BroadcastUsers
	DefaultFlow
)

type FmActionReq

type FmActionReq struct {
	Action      string
	Basepath    string
	Targets     []string
	Destination string
	Options     []string
}

type FmActionRes

type FmActionRes map[string]interface{}
type FmActionRes struct {
	Action string
	Status bool
	Errors []string
	Outputs []string
}
type Header struct {
	Connid  UID
	CmdType CommandType
	Flow    FlowType
}

func Decode

func Decode(raw []byte, out interface{}) (*Header, error)

func GetHeader

func GetHeader(raw []byte) (*Header, []byte)

func NewHeader

func NewHeader(connid UID, cmdtype CommandType, flow FlowType) *Header

type ListDirReply

type ListDirReply struct {
	Path       string
	FSNodes    []FSNode
	ParentPath string
}

type ListDirReq

type ListDirReq struct {
	Path    string
	Options []string
}

listdir in filemanager

type ListServicesCmd

type ListServicesCmd struct {
}

type ListServicesMsg

type ListServicesMsg struct {
	Services []*ServiceInfo
}

type Packet

type Packet struct {
	// contains filtered or unexported fields
}

func NewPacket

func NewPacket(head Byteable, body interface{}) *Packet

func (*Packet) Decode

func (p *Packet) Decode(b []byte)

func (*Packet) Encode

func (p *Packet) Encode() []byte

type ProcessActionCmd

type ProcessActionCmd struct {
	PID    int32
	Action string
	ID     int32
}

type ProcessActionData

type ProcessActionData struct {
	Output string
	ID     int32
}

type ProcessInfo

type ProcessInfo struct {
	PID       int32
	USER      string
	CPU       float64
	MEM       uint64
	UpTime    float64
	Command   string
	ChildPIDS []int32
}

type ScriptReq

type ScriptReq struct {
	Code string
}

type ScriptRes

type ScriptRes struct {
	Response string
}

type ServiceInfo

type ServiceInfo struct {
	Name string
}

type StartServiceReq

type StartServiceReq struct {
	Interval    int64 //duration in sec
	Timeout     int64 // 0 means no timeouts
	Options     []string
	ServiceType byte // should be CommandType
}

type SysStatCmd

type SysStatCmd struct {
	Interval int64 //duration in sec
	Timeout  int64 // 0 means no timeouts
}

type SysStatData

type SysStatData struct {
	TimeStamp    int64
	CPUPercent   []float64
	TotalMem     uint64
	AvailableMem uint64
	NetSentbytes uint64
	NetRecvbytes uint64
	DiskTotal    uint64
	DiskFree     uint64
}

type SystemActionReq

type SystemActionReq struct {
	Action  string
	Options []string
}

shutdown and reboot for now

type TaskMgrCmd

type TaskMgrCmd struct {
	Interval int64 //duration in msec
	Timeout  int64 // 0 means default timeout will be used
}

type TaskMgrData

type TaskMgrData struct {
	Uptime    int64
	AvgLoad   int
	Battery   uint8
	Processes []*ProcessInfo
}

type TermData

type TermData struct {
	Data       string
	ResizeInfo string
}

type TokenMessage

type TokenMessage struct {
	Token string
}

type UID

type UID uint16

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL