rcproxy

package
v0.0.0-...-7d7780a Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2022 License: MulanPSL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CallReponseToJson

func CallReponseToJson(rep *CallReponse) ([]byte, error)

func CallRequestToJson

func CallRequestToJson(req *CallRequest) ([]byte, error)

Types

type CallReponse

type CallReponse struct {
	Id     string      `json:"id"`     //	消息ID
	Result interface{} `json:"result"` //	结果
}

func CallReponseFromJson

func CallReponseFromJson(text []byte) (*CallReponse, error)

type CallRequest

type CallRequest struct {
	Id     string        `json:"id"`     //	消息ID
	Object string        `json:"object"` //	被调用的对象
	Func   string        `json:"func"`   //	函数名
	Args   []interface{} `json:"args"`   //	参数列表
}

func CallRequestFromJson

func CallRequestFromJson(text []byte) (*CallRequest, error)

type RCProxy

type RCProxy struct {
	Shellrs map[string]*Shellr //	Shellr 对象列表
}

func NewRCProxy

func NewRCProxy() *RCProxy

func (*RCProxy) EnumShellr

func (sm *RCProxy) EnumShellr(callback func(name string, addr net.Addr) int)

func (*RCProxy) Find

func (sm *RCProxy) Find(name string) (*Shellr, error)

func (*RCProxy) RegisterShellr

func (sm *RCProxy) RegisterShellr(shellr *Shellr) error

RegisterShellr 用于注册一个 Shellr 对象

func (*RCProxy) UnregisterShellr

func (sm *RCProxy) UnregisterShellr(name string)

UnregisterShellr 用于注册一个 Shellr 对象;如果注册成功,将返回注册对象的唯一编号;如果注册失败,返回 -1;

type Runner

type Runner struct {
	Addr string //	Runner 的唯一地址

}

type Shellr

type Shellr struct {
	Name string
	// contains filtered or unexported fields
}

func NewShellr

func NewShellr(name string, conn *websocket.Conn) *Shellr

func (*Shellr) Call

func (s *Shellr) Call(req []byte) ([]byte, error)

Jump to

Keyboard shortcuts

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