From 4ca98102230ed3fc70fb3e54e437b1da4b13191d Mon Sep 17 00:00:00 2001 From: mcoo <26184088+mcoo@users.noreply.github.com> Date: Sun, 30 Apr 2023 16:21:18 +0800 Subject: [PATCH] feat: init --- README.md | 1 + config.yaml | 7 + config/config.go | 14 + cron/cron.go | 11 + generate.go | 5 + go.mod | 85 + main.go | 29 + opq/opq.go | 19 + plugin/S/S.go | 65 + plugin/S/S_host.go | 13 + plugin/S/msgCmd/msgCmd.go | 172 + plugin/admin.go | 107 + plugin/builder/cmd/build.go | 168 + plugin/builder/cmd/key.go | 49 + plugin/builder/cmd/root.go | 41 + plugin/builder/main.go | 11 + plugin/builder/main.go.bak | 49 + plugin/callOPQApi.go | 87 + plugin/httpApi.go | 60 + plugin/meta/generate/generate.go | 83 + plugin/meta/meta.go | 48 + plugin/meta/meta_generate.go | 126 + plugin/plugin.go | 509 ++ plugin/repository/repository.go | 50 + plugins/animeCharacter/animeCharacter.go | 92 + plugins/animeCharacter/config/model.go | 6 + .../animeCharacter/config/model_easyjson.go | 85 + plugins/animeCharacter/meta.json | 8 + plugins/example/example.go | 143 + plugins/example/meta.json | 8 + plugins/signPlugin/config.json | 1 + plugins/signPlugin/config/config.go | 37 + plugins/signPlugin/config/config_easyjson.go | 124 + plugins/signPlugin/generate_config.go | 3 + plugins/signPlugin/meta.json | 9 + plugins/signPlugin/signPlugin.go | 141 + plugins/systemInfo/meta.json | 9 + plugins/systemInfo/systemInfo.go | 82 + proto/generate/generate.go | 49 + proto/library/systemInfo/export/model.go | 115 + .../systemInfo/export/model_easyjson.go | 1049 ++++ .../systemInfo/export/systemInfo.pb.go | 46 + .../systemInfo/export/systemInfo.proto | 15 + .../systemInfo/export/systemInfo_host.pb.go | 99 + .../systemInfo/export/systemInfo_plugin.pb.go | 72 + .../export/systemInfo_vtproto.pb.go | 264 ++ proto/library/systemInfo/systemInfo.go | 101 + proto/opq.pb.go | 834 ++++ proto/opq.proto | 157 + proto/opq_host.pb.go | 904 ++++ proto/opq_options.pb.go | 47 + proto/opq_plugin.pb.go | 428 ++ proto/opq_vtproto.pb.go | 4218 +++++++++++++++++ session/session.go | 20 + "web/docs/guide/\345\274\200\345\247\213.md" | 16 + ...06\345\221\230\345\221\275\344\273\244.md" | 45 + web/docs/index.md | 28 + web/docs/public/opq.png | Bin 0 -> 34287 bytes .../\344\272\213\344\273\266.md" | 19 + .../\346\217\222\344\273\266API.md" | 49 + ...03\351\231\220\347\224\263\350\257\267.md" | 12 + ...57\345\242\203\351\205\215\347\275\256.md" | 38 + web/package.json | 18 + web/tsconfig.json | 16 + web/yarn.lock | 596 +++ 65 files changed, 11812 insertions(+) create mode 100644 README.md create mode 100644 config.yaml create mode 100644 config/config.go create mode 100644 cron/cron.go create mode 100644 generate.go create mode 100644 go.mod create mode 100644 main.go create mode 100644 opq/opq.go create mode 100644 plugin/S/S.go create mode 100644 plugin/S/S_host.go create mode 100644 plugin/S/msgCmd/msgCmd.go create mode 100644 plugin/admin.go create mode 100644 plugin/builder/cmd/build.go create mode 100644 plugin/builder/cmd/key.go create mode 100644 plugin/builder/cmd/root.go create mode 100644 plugin/builder/main.go create mode 100644 plugin/builder/main.go.bak create mode 100644 plugin/callOPQApi.go create mode 100644 plugin/httpApi.go create mode 100644 plugin/meta/generate/generate.go create mode 100644 plugin/meta/meta.go create mode 100644 plugin/meta/meta_generate.go create mode 100644 plugin/plugin.go create mode 100644 plugin/repository/repository.go create mode 100644 plugins/animeCharacter/animeCharacter.go create mode 100644 plugins/animeCharacter/config/model.go create mode 100644 plugins/animeCharacter/config/model_easyjson.go create mode 100644 plugins/animeCharacter/meta.json create mode 100644 plugins/example/example.go create mode 100644 plugins/example/meta.json create mode 100644 plugins/signPlugin/config.json create mode 100644 plugins/signPlugin/config/config.go create mode 100644 plugins/signPlugin/config/config_easyjson.go create mode 100644 plugins/signPlugin/generate_config.go create mode 100644 plugins/signPlugin/meta.json create mode 100644 plugins/signPlugin/signPlugin.go create mode 100644 plugins/systemInfo/meta.json create mode 100644 plugins/systemInfo/systemInfo.go create mode 100644 proto/generate/generate.go create mode 100644 proto/library/systemInfo/export/model.go create mode 100644 proto/library/systemInfo/export/model_easyjson.go create mode 100644 proto/library/systemInfo/export/systemInfo.pb.go create mode 100644 proto/library/systemInfo/export/systemInfo.proto create mode 100644 proto/library/systemInfo/export/systemInfo_host.pb.go create mode 100644 proto/library/systemInfo/export/systemInfo_plugin.pb.go create mode 100644 proto/library/systemInfo/export/systemInfo_vtproto.pb.go create mode 100644 proto/library/systemInfo/systemInfo.go create mode 100644 proto/opq.pb.go create mode 100644 proto/opq.proto create mode 100644 proto/opq_host.pb.go create mode 100644 proto/opq_options.pb.go create mode 100644 proto/opq_plugin.pb.go create mode 100644 proto/opq_vtproto.pb.go create mode 100644 session/session.go create mode 100644 "web/docs/guide/\345\274\200\345\247\213.md" create mode 100644 "web/docs/guide/\347\256\241\347\220\206\345\221\230\345\221\275\344\273\244.md" create mode 100644 web/docs/index.md create mode 100644 web/docs/public/opq.png create mode 100644 "web/docs/\346\217\222\344\273\266\347\274\226\345\206\231/\344\272\213\344\273\266.md" create mode 100644 "web/docs/\346\217\222\344\273\266\347\274\226\345\206\231/\346\217\222\344\273\266API.md" create mode 100644 "web/docs/\346\217\222\344\273\266\347\274\226\345\206\231/\346\235\203\351\231\220\347\224\263\350\257\267.md" create mode 100644 "web/docs/\346\217\222\344\273\266\347\274\226\345\206\231/\347\216\257\345\242\203\351\205\215\347\275\256.md" create mode 100644 web/package.json create mode 100644 web/tsconfig.json create mode 100644 web/yarn.lock diff --git a/README.md b/README.md new file mode 100644 index 0000000..c983fbb --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# Yui diff --git a/config.yaml b/config.yaml new file mode 100644 index 0000000..4c76b27 --- /dev/null +++ b/config.yaml @@ -0,0 +1,7 @@ +httpproxy: http://127.0.0.1:7890 # 插件 HTTP 服务时会使用的 Proxy +opqurl: http://127.0.0.1:8086 # OPQ 的地址 +admin: + - 2435932516 # 管理员 +plugin: + env: + test: opqbot # 环境变量 将会传递到插件内 \ No newline at end of file diff --git a/config/config.go b/config/config.go new file mode 100644 index 0000000..f22556a --- /dev/null +++ b/config/config.go @@ -0,0 +1,14 @@ +package config + +import ( + "github.com/charmbracelet/log" + "github.com/spf13/viper" +) + +func init() { + viper.SetConfigFile("config.yaml") + err := viper.ReadInConfig() // 搜索并读取配置文件 + if err != nil { // 处理错误 + log.Fatalf("没有配置文件呢?: %s \n", err) + } +} diff --git a/cron/cron.go b/cron/cron.go new file mode 100644 index 0000000..d1ce8e7 --- /dev/null +++ b/cron/cron.go @@ -0,0 +1,11 @@ +package cron + +import "github.com/robfig/cron/v3" + +var ( + C = cron.New() +) + +func init() { + C.Start() +} diff --git a/generate.go b/generate.go new file mode 100644 index 0000000..ef855d7 --- /dev/null +++ b/generate.go @@ -0,0 +1,5 @@ +package main + +//go:generate protoc --go-plugin_out=. --go-plugin_opt=paths=source_relative proto/opq.proto +//go:generate go run proto/generate/generate.go +//go:generate protoc --go-plugin_out=. --go-plugin_opt=paths=source_relative proto/library/systemInfo/export/systemInfo.proto diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..dd08e2a --- /dev/null +++ b/go.mod @@ -0,0 +1,85 @@ +module Yui + +go 1.19 + +require ( + github.com/charmbracelet/log v0.2.1 + github.com/ethereum/go-ethereum v1.11.6 + github.com/fogleman/gg v1.3.0 + github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 + github.com/google/uuid v1.3.0 + github.com/imroc/req/v3 v3.33.2 + github.com/knqyf263/go-plugin v0.7.1-0.20230420183704-82cf9090ca1e + github.com/mailru/easyjson v0.7.7 + github.com/mcoo/OPQBot v0.2.2-0.20230415115049-02b00e2cf9e1 + github.com/opq-osc/OPQBot/v2 v2.0.0-20230427091225-f73faded2e3b + github.com/robfig/cron/v3 v3.0.1 + github.com/shirou/gopsutil/v3 v3.23.3 + github.com/spf13/cast v1.5.0 + github.com/spf13/cobra v1.7.0 + github.com/spf13/viper v1.15.0 + github.com/tetratelabs/wazero v1.0.3 + github.com/tidwall/gjson v1.14.4 + golang.org/x/image v0.0.0-20190802002840-cff245a6509b + golang.org/x/tools v0.8.0 + google.golang.org/protobuf v1.30.0 +) + +require ( + github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect + github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect + github.com/charmbracelet/lipgloss v0.7.1 // indirect + github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect + github.com/fsnotify/fsnotify v1.6.0 // indirect + github.com/go-logfmt/logfmt v0.6.0 // indirect + github.com/go-ole/go-ole v1.2.6 // indirect + github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 // indirect + github.com/golang/mock v1.6.0 // indirect + github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 // indirect + github.com/gorilla/websocket v1.5.0 // indirect + github.com/hashicorp/errwrap v1.1.0 // indirect + github.com/hashicorp/go-multierror v1.1.1 // indirect + github.com/hashicorp/hcl v1.0.0 // indirect + github.com/holiman/uint256 v1.2.2-0.20230321075855-87b91420868c // indirect + github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/josharian/intern v1.0.0 // indirect + github.com/lucasb-eyer/go-colorful v1.2.0 // indirect + github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect + github.com/magiconair/properties v1.8.7 // indirect + github.com/makiuchi-d/gozxing v0.1.1 // indirect + github.com/mattn/go-isatty v0.0.18 // indirect + github.com/mattn/go-runewidth v0.0.14 // indirect + github.com/mdp/qrterminal/v3 v3.0.0 // indirect + github.com/mitchellh/mapstructure v1.5.0 // indirect + github.com/muesli/reflow v0.3.0 // indirect + github.com/muesli/termenv v0.15.1 // indirect + github.com/onsi/ginkgo/v2 v2.2.0 // indirect + github.com/pelletier/go-toml/v2 v2.0.6 // indirect + github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect + github.com/quic-go/qpack v0.4.0 // indirect + github.com/quic-go/qtls-go1-18 v0.2.0 // indirect + github.com/quic-go/qtls-go1-19 v0.2.0 // indirect + github.com/quic-go/qtls-go1-20 v0.1.0 // indirect + github.com/quic-go/quic-go v0.32.0 // indirect + github.com/rivo/uniseg v0.2.0 // indirect + github.com/rotisserie/eris v0.5.4 // indirect + github.com/spf13/afero v1.9.3 // indirect + github.com/spf13/jwalterweatherman v1.1.0 // indirect + github.com/spf13/pflag v1.0.5 // indirect + github.com/subosito/gotenv v1.4.2 // indirect + github.com/tidwall/match v1.1.1 // indirect + github.com/tidwall/pretty v1.2.1 // indirect + github.com/tklauser/go-sysconf v0.3.11 // indirect + github.com/tklauser/numcpus v0.6.0 // indirect + github.com/yusufpapurcu/wmi v1.2.2 // indirect + golang.org/x/crypto v0.4.0 // indirect + golang.org/x/exp v0.0.0-20230206171751-46f607a40771 // indirect + golang.org/x/mod v0.10.0 // indirect + golang.org/x/net v0.9.0 // indirect + golang.org/x/sys v0.7.0 // indirect + golang.org/x/text v0.9.0 // indirect + golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect + gopkg.in/ini.v1 v1.67.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect + rsc.io/qr v0.2.0 // indirect +) diff --git a/main.go b/main.go new file mode 100644 index 0000000..6a573da --- /dev/null +++ b/main.go @@ -0,0 +1,29 @@ +package main + +import ( + _ "Yui/config" + "Yui/cron" + "Yui/opq" + "Yui/plugin" + "context" + "github.com/charmbracelet/log" + "github.com/spf13/viper" +) + +var ( + version = "v0.0.1" + commit = "xxxxxxxxxxxxxxx" +) + +func main() { + log.Infof("Yui 欢迎使用 Version:%s (commit:%s)", version, commit) + if v := viper.Get("logLevel"); v != nil { + log.SetLevel(log.Level(v.(int))) + } + err := opq.C.ListenAndWait(context.Background()) + if err != nil { + log.Error(err) + } + plugin.M.CloseAllPlugin(context.Background()) + cron.C.Stop() +} diff --git a/opq/opq.go b/opq/opq.go new file mode 100644 index 0000000..9881ed5 --- /dev/null +++ b/opq/opq.go @@ -0,0 +1,19 @@ +package opq + +import ( + "github.com/charmbracelet/log" + "github.com/opq-osc/OPQBot/v2" + "github.com/spf13/viper" +) + +var C *OPQBot.Core + +var Url = viper.GetString("opqUrl") + +func init() { + var err error + C, err = OPQBot.NewCore(Url) + if err != nil { + log.Fatal(err) + } +} diff --git a/plugin/S/S.go b/plugin/S/S.go new file mode 100644 index 0000000..cd51cce --- /dev/null +++ b/plugin/S/S.go @@ -0,0 +1,65 @@ +//go:build tinygo.wasm + +package S + +import ( + "Yui/proto" + "context" + "github.com/opq-osc/OPQBot/v2/events" +) + +func LogInfo(ctx context.Context, msg string) { + proto.NewApi().Log(ctx, &proto.LogReq{ + LogType: proto.LogType_Info, + Msg: msg, + }) +} +func LogError(ctx context.Context, msg string) { + proto.NewApi().Log(ctx, &proto.LogReq{ + LogType: proto.LogType_Error, + Msg: msg, + }) +} +func LogWarn(ctx context.Context, msg string) { + proto.NewApi().Log(ctx, &proto.LogReq{ + LogType: proto.LogType_Warn, + Msg: msg, + }) +} +func LogDebug(ctx context.Context, msg string) { + proto.NewApi().Log(ctx, &proto.LogReq{ + LogType: proto.LogType_Debug, + Msg: msg, + }) +} +func HttpGet(ctx context.Context, url string, header map[string]string) (*proto.HttpRes, error) { + return proto.NewApi().Http(ctx, &proto.HttpReq{ + Url: url, + Method: proto.HttpMethod_GET, + Header: header, + Content: nil, + }) +} +func HttpPost(ctx context.Context, url string, header map[string]string, body []byte) (*proto.HttpRes, error) { + return proto.NewApi().Http(ctx, &proto.HttpReq{ + Url: url, + Method: proto.HttpMethod_POST, + Header: header, + Content: body, + }) +} +func SendGroupTextMsg(ctx context.Context, toUin, botUin int64, text string) (*proto.SendReply, error) { + return proto.NewApi().SendGroupMsg(ctx, &proto.MsgReq{ + ToUin: toUin, + Msg: &proto.MsgReq_TextMsg{TextMsg: &proto.TextMsg{Text: text}}, + BotUin: botUin, + }) +} +func ParserEvent(rawMessage []byte) (events.IEvent, error) { + var event = &events.EventStruct{} + err := event.UnmarshalJSON(rawMessage) + if err != nil { + return nil, err + } + return event, nil +} diff --git a/plugin/S/S_host.go b/plugin/S/S_host.go new file mode 100644 index 0000000..3d3b783 --- /dev/null +++ b/plugin/S/S_host.go @@ -0,0 +1,13 @@ +//go:build !tinygo.wasm + +package S + +import ( + "Yui/opq" + "github.com/opq-osc/OPQBot/v2/apiBuilder" + "github.com/opq-osc/OPQBot/v2/events" +) + +func GetApi(event events.IEvent) apiBuilder.IMainFunc { + return apiBuilder.New(opq.Url, event.GetCurrentQQ()) +} diff --git a/plugin/S/msgCmd/msgCmd.go b/plugin/S/msgCmd/msgCmd.go new file mode 100644 index 0000000..075672b --- /dev/null +++ b/plugin/S/msgCmd/msgCmd.go @@ -0,0 +1,172 @@ +package msgCmd + +import ( + "fmt" + "github.com/charmbracelet/log" + "reflect" + "strconv" + "strings" +) + +// 用于解析聊天命令 + +func ShouldBind(msg string, obj any) error { + rv := reflect.ValueOf(obj) + if rv.Kind() != reflect.Pointer || rv.IsNil() { + return fmt.Errorf("obj should be a Pointer and not nil") + } + cmds := strings.Split(msg, " ") + if len(cmds) < rv.Elem().NumField() { + return fmt.Errorf("命令长度不足") + } + var index = 0 + for i := 0; i < rv.Elem().NumField(); i++ { + if index >= len(cmds) { + return fmt.Errorf("命令长度不足") + } + if !rv.Elem().Field(i).CanSet() { + continue + } + switch rv.Elem().Field(i).Type().Kind() { + case reflect.String: + rv.Elem().Field(i).SetString(cmds[index]) + index++ + case reflect.Int: + value, err := strconv.Atoi(cmds[index]) + if err != nil { + return err + } + rv.Elem().Field(i).Set(reflect.ValueOf(value)) + index++ + case reflect.Int64: + value, err := strconv.ParseInt(cmds[index], 10, 64) + if err != nil { + return err + } + rv.Elem().Field(i).Set(reflect.ValueOf(value)) + index++ + case reflect.Bool: + value, err := strconv.ParseBool(cmds[index]) + if err != nil { + return err + } + rv.Elem().Field(i).Set(reflect.ValueOf(value)) + index++ + case reflect.Float64: + value, err := strconv.ParseFloat(cmds[index], 64) + if err != nil { + return err + } + rv.Elem().Field(i).Set(reflect.ValueOf(value)) + index++ + case reflect.Slice: + // 数组 判断长度 + lengthStr := rv.Elem().Type().Field(i).Tag.Get("opq") + + if lengthStr != "" { + length, err := strconv.Atoi(lengthStr) + if err != nil { + return err + } + if len(cmds)-index < length { + return fmt.Errorf("%s 长度不够", rv.Elem().Type().Field(i).Name) + } + + // 类型变换 + switch rv.Elem().Field(i).Type().Elem().Kind() { + case reflect.String: + elem := make([]string, 0) + for j := 0; j < length; j++ { + elem = append(elem, cmds[index]) + index++ + } + rv.Elem().Field(i).Set(reflect.ValueOf(elem)) + case reflect.Int: + elem := make([]int, 0) + for j := 0; j < length; j++ { + v, err := strconv.Atoi(cmds[index]) + if err != nil { + return err + } + elem = append(elem, v) + index++ + } + rv.Elem().Field(i).Set(reflect.ValueOf(elem)) + case reflect.Int64: + elem := make([]int64, 0) + for j := 0; j < length; j++ { + v, err := strconv.ParseInt(cmds[index], 10, 64) + if err != nil { + return err + } + elem = append(elem, v) + index++ + } + rv.Elem().Field(i).Set(reflect.ValueOf(elem)) + case reflect.Bool: + elem := make([]bool, 0) + for j := 0; j < length; j++ { + v, err := strconv.ParseBool(cmds[index]) + if err != nil { + return err + } + elem = append(elem, v) + index++ + } + rv.Elem().Field(i).Set(reflect.ValueOf(elem)) + case reflect.Float64: + elem := make([]float64, 0) + for j := 0; j < length; j++ { + v, err := strconv.ParseFloat(cmds[index], 64) + if err != nil { + return err + } + elem = append(elem, v) + index++ + } + rv.Elem().Field(i).Set(reflect.ValueOf(elem)) + } + } else { + for ; index < len(cmds); index++ { + // 类型变换 + switch rv.Elem().Field(i).Type().Elem().Kind() { + case reflect.String: + rv.Elem().Field(i).Set(reflect.ValueOf(cmds[index])) + case reflect.Int: + v, err := strconv.Atoi(cmds[index]) + if err != nil { + return err + } + rv.Elem().Field(i).Set(reflect.ValueOf(v)) + case reflect.Int64: + v, err := strconv.ParseInt(cmds[index], 10, 64) + if err != nil { + return err + } + rv.Elem().Field(i).Set(reflect.ValueOf(v)) + case reflect.Bool: + v, err := strconv.ParseBool(cmds[index]) + if err != nil { + return err + } + rv.Elem().Field(i).Set(reflect.ValueOf(v)) + case reflect.Float64: + + v, err := strconv.ParseFloat(cmds[index], 64) + if err != nil { + return err + } + + rv.Elem().Field(i).Set(reflect.ValueOf(v)) + } + } + + } + + } + log.Info(rv.Elem().Field(i).Type().Kind()) + } + + return nil + +} diff --git a/plugin/admin.go b/plugin/admin.go new file mode 100644 index 0000000..990e738 --- /dev/null +++ b/plugin/admin.go @@ -0,0 +1,107 @@ +package plugin + +import ( + "Yui/plugin/S" + "Yui/plugin/meta" + "Yui/plugin/repository" + "Yui/session" + "context" + "fmt" + "github.com/opq-osc/OPQBot/v2/events" + "github.com/spf13/cast" + "github.com/spf13/viper" + "strings" +) + +// 内置的插件管理功能 + +func IsAdmin(uin int64) bool { + for _, v := range cast.ToSlice(viper.Get("admin")) { + if cast.ToInt64(v) == uin { + return true + } + } + return false +} + +func (m *Manager) OnGroupMsgAdmin(ctx context.Context, event events.IEvent) bool { + s := session.S.SessionStart(event.ParseGroupMsg().GetSenderUin()) + //log.Debug(string(event.GetRawBytes())) + path, _ := s.GetString("loadPlugin") + if path != "" { + if event.ParseGroupMsg().ParseTextMsg().GetTextContent() == "是" { + err := M.LoadPlugin(ctx, path) + if err != nil { + S.GetApi(event).SendMsg().GroupMsg().ToUin(event.ParseGroupMsg().GetGroupUin()).TextMsg(err.Error()).Do(ctx) + } else { + S.GetApi(event).SendMsg().GroupMsg().ToUin(event.ParseGroupMsg().GetGroupUin()).TextMsg("加载成功").Do(ctx) + + } + } + s.Delete("loadPlugin") + return true + } + if strings.HasPrefix(event.ParseGroupMsg().ParseTextMsg().GetTextContent(), ".admin") && IsAdmin(event.ParseGroupMsg().GetSenderUin()) { + cmd := strings.Split(event.ParseGroupMsg().ParseTextMsg().GetTextContent(), " ") + if len(cmd) <= 1 { + return false + } + + switch cmd[1] { + case "unload": + err := M.UnloadPlugin(ctx, cmd[2]) + if err != nil { + S.GetApi(event).SendMsg().GroupMsg().ToUin(event.ParseGroupMsg().GetGroupUin()).TextMsg(err.Error()).Do(ctx) + } else { + S.GetApi(event).SendMsg().GroupMsg().ToUin(event.ParseGroupMsg().GetGroupUin()).TextMsg("卸载成功").Do(ctx) + } + case "load": + pluginInfo, err := GetPluginInfo(cmd[2]) + if err != nil { + S.GetApi(event).SendMsg().GroupMsg().ToUin(event.ParseGroupMsg().GetGroupUin()).TextMsg(err.Error()).Do(ctx) + } else { + info := fmt.Sprintf("是否加载插件 [%s] 作者: %s\n说明:%s\n它需要的权限有:\n%s", pluginInfo.PluginName, pluginInfo.Author, pluginInfo.Description, meta.GetPermissions(pluginInfo.Permissions)) + if pluginInfo.Sign { + info = fmt.Sprintf("✅ %s\n", pluginInfo.SignInfo) + info + } else { + info = "⚠️ 插件未知来源\n" + info + } + S.GetApi(event).SendMsg().GroupMsg().ToUin(event.ParseGroupMsg().GetGroupUin()).TextMsg(info).Do(ctx) + s.Set("loadPlugin", cmd[2]) + } + case "list": + plugins := M.GetAllPlugins() + msg := []string{} + for k, v := range plugins { + msg = append(msg, fmt.Sprintf("%s 作者:%s 说明:%s 权限:%d 签名:%v", k, v.Meta.Author, v.Meta.Description, v.Meta.Permissions, v.Meta.Sign)) + } + if len(msg) == 0 { + msg = []string{"没有插件呢?"} + } + S.GetApi(event).SendMsg().GroupMsg().ToUin(event.ParseGroupMsg().GetGroupUin()).TextMsg(strings.Join(msg, "\n")).Do(ctx) + case "yun": + switch cmd[2] { + case "list": + lists, err := repository.GetPluginList(ctx) + if err != nil { + S.GetApi(event).SendMsg().GroupMsg().ToUin(event.ParseGroupMsg().GetGroupUin()).TextMsg(err.Error()).Do(ctx) + return true + } + var msg = []string{"仓库插件:"} + for _, v := range lists { + msg = append(msg, fmt.Sprintf("%s 作者:%s 说明:%s 权限:%v", v.PluginName, v.Author, v.Description, v.Permissions)) + } + S.GetApi(event).SendMsg().GroupMsg().ToUin(event.ParseGroupMsg().GetGroupUin()).TextMsg(strings.Join(msg, "\n")).Do(ctx) + } + case "permission": + plugin, err := M.GetPlugin(cmd[2]) + if err != nil { + S.GetApi(event).SendMsg().GroupMsg().ToUin(event.ParseGroupMsg().GetGroupUin()).TextMsg(err.Error()).Do(ctx) + } else { + S.GetApi(event).SendMsg().GroupMsg().ToUin(event.ParseGroupMsg().GetGroupUin()).TextMsg(plugin.Meta.PluginName + "的权限有:\n" + meta.GetPermissions(plugin.Meta.Permissions)).Do(ctx) + } + } + return true + } + return false +} diff --git a/plugin/builder/cmd/build.go b/plugin/builder/cmd/build.go new file mode 100644 index 0000000..c64e9ce --- /dev/null +++ b/plugin/builder/cmd/build.go @@ -0,0 +1,168 @@ +/* +Copyright © 2023 NAME HERE +*/ +package cmd + +import ( + "Yui/plugin/meta" + "bytes" + "crypto/ecdsa" + "crypto/rand" + "crypto/sha256" + "encoding/binary" + "encoding/gob" + "encoding/hex" + "encoding/json" + "github.com/ethereum/go-ethereum/crypto" + "github.com/spf13/cobra" + "github.com/spf13/viper" + "io" + "os" + "os/exec" + "path/filepath" +) + +var ( + tinyGoPath string + output string + privateKey string +) + +type BuildMetaInfo struct { + meta.PluginMeta + Permissions []string `json:"Permissions"` +} + +// buildCmd represents the build command +var buildCmd = &cobra.Command{ + Use: "build 插件的go文件路径", + Short: "创建OPQ插件文件", + Long: `创建OPQ插件文件`, + Args: cobra.MinimumNArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + // 读取 meta 信息 + path := filepath.Dir(args[0]) + metaByte, err := os.ReadFile(filepath.Join(path, "meta.json")) + if err != nil { + return err + } + var rawM = BuildMetaInfo{} + err = json.Unmarshal(metaByte, &rawM) + if err != nil { + return err + } + // 权限转换 + var m = meta.PluginMeta{ + PluginName: rawM.PluginName, + Description: rawM.Description, + Dependencies: rawM.Dependencies, + Author: rawM.Author, + Url: rawM.Url, + Version: rawM.Version, + Permissions: meta.SumPermissions(rawM.Permissions...), + Sha256: rawM.Sha256, + Sign: false, + SignInfo: rawM.SignInfo, + } + + if output == "" { + output = filepath.Join(path, m.PluginName) + } + err = RunCmd(tinyGoPath, "build", "-o", output+".wasm", "-scheduler=none", "-target=wasi", "--no-debug", args[0]) + if err != nil { + return err + } + defer os.Remove(output + ".wasm") + b, err := os.ReadFile(output + ".wasm") + if err != nil { + return err + } + s := sha256.New() + s.Write(b) + sha256hash := hex.EncodeToString(s.Sum(nil)) + m.Sha256 = sha256hash + + var headerBuf bytes.Buffer + e := gob.NewEncoder(&headerBuf) + if err := e.Encode(m); err != nil { + panic(err) + } + header := headerBuf.Bytes() + var buf bytes.Buffer + buf.Write([]byte("OPQ")) + if err := binary.Write(&buf, binary.LittleEndian, int32(meta.PluginApiVersion)); err != nil { + panic(err) + } + if privateKey == "" { + if err := binary.Write(&buf, binary.LittleEndian, int32(0)); err != nil { + panic(err) + } + } else { + if err := binary.Write(&buf, binary.LittleEndian, int32(1)); err != nil { + panic(err) + } + // 签名 + privateKeyByte, err := hex.DecodeString(privateKey) + if err != nil { + panic(err) + } + key, err := crypto.ToECDSA(privateKeyByte) + if err != nil { + panic(err) + } + sha := sha256.New() + sha.Write(headerBuf.Bytes()) + hash := sha.Sum(nil) + r, s, err := ecdsa.Sign(rand.Reader, key, hash) + if err != nil { + panic(err) + } + Rbyte, err := r.MarshalText() + if err != nil { + panic(err) + } + Sbyte, err := s.MarshalText() + if err != nil { + panic(err) + } + if err := binary.Write(&buf, binary.LittleEndian, int32(len(Rbyte))); err != nil { + panic(err) + } + buf.Write(Rbyte) + if err := binary.Write(&buf, binary.LittleEndian, int32(len(Sbyte))); err != nil { + panic(err) + } + buf.Write(Sbyte) + } + if err := binary.Write(&buf, binary.LittleEndian, int32(len(header))); err != nil { + panic(err) + } + buf.Write(header) + buf.Write(b) + f, err := os.OpenFile(output+".opq", os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0777) + if err != nil { + panic(err) + } + defer f.Close() + _, err = io.Copy(f, &buf) + if err != nil { + panic(err) + } + return nil + }, +} + +func RunCmd(name string, args ...string) error { + cmd := exec.Command(name, args...) + cmd.Dir, _ = os.Getwd() + cmd.Stderr = os.Stderr + return cmd.Run() +} + +func init() { + viper.AutomaticEnv() + rootCmd.AddCommand(buildCmd) + buildCmd.Flags().StringVarP(&tinyGoPath, "tinyGoPath", "t", "tinygo", "设置tinyGo程序路径") + buildCmd.Flags().StringVarP(&output, "output", "o", "", "设置输出插件文件名,不包含后缀") + buildCmd.Flags().StringVarP(&privateKey, "privateKey", "p", viper.GetString("OPQPrivateKey"), "为插件签名") +} diff --git a/plugin/builder/cmd/key.go b/plugin/builder/cmd/key.go new file mode 100644 index 0000000..12649fe --- /dev/null +++ b/plugin/builder/cmd/key.go @@ -0,0 +1,49 @@ +/* +Copyright © 2023 NAME HERE +*/ +package cmd + +import ( + "crypto/ecdsa" + "encoding/hex" + "github.com/charmbracelet/log" + "github.com/ethereum/go-ethereum/crypto" + "github.com/spf13/cobra" +) + +// keyCmd represents the key command +var keyCmd = &cobra.Command{ + Use: "key", + Short: "生成公,私钥", + Long: `生成公,私钥`, + RunE: func(cmd *cobra.Command, args []string) error { + privateKey, err := crypto.GenerateKey() + if err != nil { + return err + } + privateKeyBytes := crypto.FromECDSA(privateKey) + log.Info("私钥", "key", hex.EncodeToString(privateKeyBytes)) + publicKey := privateKey.Public() + publicKeyECDSA, ok := publicKey.(*ecdsa.PublicKey) + if !ok { + log.Fatal("cannot assert type: publicKey is not of type *ecdsa.PublicKey") + } + publicKeyBytes := crypto.FromECDSAPub(publicKeyECDSA) + log.Info("公钥", "publicKey", hex.EncodeToString(publicKeyBytes)) + return nil + }, +} + +func init() { + rootCmd.AddCommand(keyCmd) + + // Here you will define your flags and configuration settings. + + // Cobra supports Persistent Flags which will work for this command + // and all subcommands, e.g.: + // keyCmd.PersistentFlags().String("foo", "", "A help for foo") + + // Cobra supports local flags which will only run when this command + // is called directly, e.g.: + // keyCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") +} diff --git a/plugin/builder/cmd/root.go b/plugin/builder/cmd/root.go new file mode 100644 index 0000000..7af0f64 --- /dev/null +++ b/plugin/builder/cmd/root.go @@ -0,0 +1,41 @@ +/* +Copyright © 2023 NAME HERE +*/ +package cmd + +import ( + "os" + + "github.com/spf13/cobra" +) + +// rootCmd represents the base command when called without any subcommands +var rootCmd = &cobra.Command{ + Use: "opq", + Short: "OPQ插件的命令行工具", + Long: `OPQ插件的命令行工具`, + // Uncomment the following line if your bare application + // has an action associated with it: + // Run: func(cmd *cobra.Command, args []string) { }, +} + +// Execute adds all child commands to the root command and sets flags appropriately. +// This is called by main.main(). It only needs to happen once to the rootCmd. +func Execute() { + err := rootCmd.Execute() + if err != nil { + os.Exit(1) + } +} + +func init() { + // Here you will define your flags and configuration settings. + // Cobra supports persistent flags, which, if defined here, + // will be global for your application. + + // rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.builder.yaml)") + + // Cobra also supports local flags, which will only run + // when this action is called directly. + // rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") +} diff --git a/plugin/builder/main.go b/plugin/builder/main.go new file mode 100644 index 0000000..3d77d13 --- /dev/null +++ b/plugin/builder/main.go @@ -0,0 +1,11 @@ +/* +Copyright © 2023 NAME HERE + +*/ +package main + +import "Yui/plugin/builder/cmd" + +func main() { + cmd.Execute() +} diff --git a/plugin/builder/main.go.bak b/plugin/builder/main.go.bak new file mode 100644 index 0000000..12b462d --- /dev/null +++ b/plugin/builder/main.go.bak @@ -0,0 +1,49 @@ +package main + +import ( + "Yui/plugin/meta" + "bytes" + "crypto/sha256" + "encoding/binary" + "encoding/gob" + "encoding/hex" + "io" + "os" +) + +func main() { + b, _ := os.ReadFile("plugins/example.wasm") + s := sha256.New() + s.Write(b) + + m := meta.PluginMeta{ + PluginName: "测试插件", + Author: "enjoy", + Url: "mcenjoy.cn", + Version: 0, + Permissions: meta.SendMsgPermission | meta.HTTPRequestPermission | meta.ReceiveAllMsgPermission | meta.UploadPermission, + Sha256: hex.EncodeToString(s.Sum(nil)), + } + var headerBuf bytes.Buffer + e := gob.NewEncoder(&headerBuf) + if err := e.Encode(m); err != nil { + panic(err) + } + var buf bytes.Buffer + buf.Write([]byte("OPQ")) + if err := binary.Write(&buf, binary.LittleEndian, int32(headerBuf.Len())); err != nil { + panic(err) + } + buf.Write(headerBuf.Bytes()) + buf.Write(b) + f, err := os.OpenFile("plugins/example.opq", os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0777) + if err != nil { + panic(err) + } + defer f.Close() + + _, err = io.Copy(f, &buf) + if err != nil { + panic(err) + } +} diff --git a/plugin/callOPQApi.go b/plugin/callOPQApi.go new file mode 100644 index 0000000..4d3c79d --- /dev/null +++ b/plugin/callOPQApi.go @@ -0,0 +1,87 @@ +package plugin + +import ( + "Yui/opq" + "Yui/plugin/meta" + "Yui/proto" + "context" + "fmt" + "github.com/opq-osc/OPQBot/v2/apiBuilder" +) + +func (p *Plugin) SendFriendMsg(ctx context.Context, request *proto.MsgReq) (*proto.SendReply, error) { + return nil, nil +} +func (p *Plugin) SendPrivateMsg(ctx context.Context, request *proto.MsgReq) (*proto.SendReply, error) { + return nil, nil +} +func (p *Plugin) SendGroupMsg(ctx context.Context, request *proto.MsgReq) (*proto.SendReply, error) { + if p.Meta.Permissions&meta.SendGroupMsgPermission == 0 { + return nil, fmt.Errorf("[%s]: %s", p.Meta.PluginName, "插件未获取发送群聊消息权限!") + } + groupMsgApi := apiBuilder.New(opq.C.ApiUrl.String(), request.BotUin).SendMsg().GroupMsg().ToUin(request.ToUin) + switch v := request.Msg.(type) { + case *proto.MsgReq_TextMsg: + groupMsgApi.TextMsg(v.TextMsg.GetText()) + case *proto.MsgReq_PicMsg: + var files []*apiBuilder.File + for _, v := range v.PicMsg.GetFile() { + files = append(files, &apiBuilder.File{ + FileId: v.GetFileId(), + FileToken: v.GetFileToken(), + FileSize: int(v.GetFileSize()), + FileMd5: v.GetFileMd5(), + }) + } + groupMsgApi.PicMsg(files...) + case *proto.MsgReq_XmlMsg: + groupMsgApi.XmlMsg(v.XmlMsg.GetXml()) + case *proto.MsgReq_JsonMsg: + groupMsgApi.JsonMsg(v.JsonMsg.GetJson()) + } + + resp, err := groupMsgApi.DoAndResponse(ctx) + if err != nil { + return nil, err + } + code, msg := resp.Result() + return &proto.SendReply{ + Ret: int32(code), + ErrMsg: &msg, + }, nil +} + +func (p *Plugin) Upload(ctx context.Context, uploadReq *proto.UploadReq) (*proto.UploadReply, error) { + if p.Meta.Permissions&meta.UploadPermission == 0 { + return nil, fmt.Errorf("[%s]: %s", p.Meta.PluginName, "插件未获取上传文件权限!") + } + api := apiBuilder.New(opq.C.ApiUrl.String(), uploadReq.BotUin).Upload() + switch v := uploadReq.File.(type) { + case *proto.UploadReq_Path: + api.GroupPic().SetFilePath(v.Path) + case *proto.UploadReq_Url: + api.SetFileUrlPath(v.Url) + case *proto.UploadReq_Base64Buf: + api.SetBase64Buf(v.Base64Buf) + } + switch uploadReq.GetUploadId() { + case proto.UploadId_Friend: + api.FriendPic() + case proto.UploadId_Group: + api.GroupPic() + } + file, err := api.DoUpload(ctx) + if err != nil { + return nil, err + } + return &proto.UploadReply{ + Ret: 0, + ErrMsg: nil, + File: &proto.File{ + FileId: file.FileId, + FileMd5: file.FileMd5, + FileSize: int32(file.FileSize), + FileToken: file.FileToken, + }, + }, nil +} diff --git a/plugin/httpApi.go b/plugin/httpApi.go new file mode 100644 index 0000000..3a81109 --- /dev/null +++ b/plugin/httpApi.go @@ -0,0 +1,60 @@ +package plugin + +import ( + "Yui/plugin/meta" + "Yui/proto" + "context" + "fmt" + "github.com/charmbracelet/log" + "github.com/imroc/req/v3" + "github.com/spf13/viper" +) + +func (p *Plugin) Http(ctx context.Context, request *proto.HttpReq) (*proto.HttpRes, error) { + if p.Meta.Permissions&meta.HTTPRequestPermission == 0 { + return nil, fmt.Errorf("[%s]: %s", p.Meta.PluginName, "插件未获取HTTP联网权限!") + } + log.Debug("插件发起HTTP连接", "plugin", p.Meta.PluginName, "method", request.Method, "url", request.Url) + var r *req.Request + if proxy := viper.GetString("httpProxy"); proxy != "" { + r = req.C().SetProxyURL(proxy).R().SetContext(ctx) + } else { + r = req.R().SetContext(ctx) + } + + switch request.GetMethod() { + case proto.HttpMethod_GET: + r.Method = "GET" + if request.Header != nil { + r.SetHeaders(request.Header) + } + + resp, err := r.Get(request.Url) + if err != nil { + return nil, err + } + log.Debug("响应", "statusCode", resp.StatusCode, "data", resp.String()) + return &proto.HttpRes{ + Header: resp.HeaderToString(), + StatusCode: int32(resp.StatusCode), + Content: resp.Bytes(), + }, nil + case proto.HttpMethod_POST: + r.Method = "POST" + r.SetBody(request.Content) + if request.Header != nil { + r.SetHeaders(request.Header) + } + resp, err := r.Post(request.Url) + if err != nil { + return nil, err + } + log.Debug("响应", "statusCode", resp.StatusCode, "data", resp.String()) + return &proto.HttpRes{ + Header: resp.HeaderToString(), + StatusCode: int32(resp.StatusCode), + Content: resp.Bytes(), + }, nil + } + return nil, fmt.Errorf("未知类型") +} diff --git a/plugin/meta/generate/generate.go b/plugin/meta/generate/generate.go new file mode 100644 index 0000000..923ea64 --- /dev/null +++ b/plugin/meta/generate/generate.go @@ -0,0 +1,83 @@ +package main + +import ( + "bytes" + "fmt" + "go/ast" + "go/format" + "go/parser" + "go/token" + "os" + "strings" +) + +func main() { + fs := token.NewFileSet() + f, err := parser.ParseFile(fs, "./meta.go", nil, parser.ParseComments) + if err != nil { + panic(err) + } + var data = map[string]struct { + value string + micro bool + }{} + for _, d := range f.Decls { + switch v := d.(type) { + case *ast.GenDecl: + + for _, v1 := range v.Specs { + if v2, ok := v1.(*ast.ValueSpec); ok { + for _, id := range v2.Names { + if strings.TrimSpace(v2.Comment.Text()) != "" { + //ast.Print(fs, v2.Names[1]) + //fmt.Println(id.Name, id.Obj.Decl) + value := strings.TrimSpace(v2.Comment.Text()) + data[id.Name] = struct { + value string + micro bool + }{value: value, micro: strings.HasPrefix(value, "宏")} + } + } + } + } + } + } + var output bytes.Buffer + output.WriteString("// Code generated by opq. DO NOT EDIT.\n\n") + output.WriteString("package meta\nimport \"strings\"\n") + output.WriteString(`func GetPermissions(permissions Permission) string { + permissionsStr := []string{} +`) + for k, v := range data { + if !v.micro { + output.WriteString(fmt.Sprintf(` if permissions&%s != 0 { + permissionsStr = append(permissionsStr, "%s") + } +`, k, v.value)) + } + + } + output.WriteString("return strings.Join(permissionsStr, \"\\n\")\n}\n") + output.WriteString(`func SumPermissions(permissions...string) Permission { + var sum Permission = 0 + for _,v:=range permissions { + switch v { +`) + for k, _ := range data { + output.WriteString(fmt.Sprintf(` case "%s": + sum |= %s +`, k, k)) + } + output.WriteString(` } + } + return sum +}`) + dataBytes, err := format.Source(output.Bytes()) + if err != nil { + panic(err) + } + err = os.WriteFile("meta_generate.go", dataBytes, 0777) + if err != nil { + panic(err) + } +} diff --git a/plugin/meta/meta.go b/plugin/meta/meta.go new file mode 100644 index 0000000..25fe715 --- /dev/null +++ b/plugin/meta/meta.go @@ -0,0 +1,48 @@ +package meta + +//go:generate go run ./generate/generate.go + +type PluginMeta struct { + PluginName string `json:"PluginName"` + Description string `json:"Description"` + Dependencies []string `json:"Dependencies"` + Author string `json:"Author"` + Url string `json:"Url"` + Version int `json:"Version"` + Permissions Permission `json:"Permissions"` + Sha256 string `json:"Sha256"` + Sign bool `json:"Sign"` // 社区官方签名认证 + SignInfo string `json:"SignInfo"` // 签名说明,会打印到插件载入时的信息里 +} + +type Permission uint64 + +const ( + SendGroupMsgPermission Permission = 1 << iota // 发送群消息权限 + SendFriendMsgPermission // 发送好友消息权限 + SendPrivateChatMsgPermission // 发送私聊权限 + HTTPRequestPermission // [⚠️注意] Http联网权限 + UploadPermission // 上传文件权限 + RegisterMiddlePermission // 注册中间件权限 + GetClientKeyPermission // [⚠️注意] 获取 Client Key 权限 + GetPSeyPermission // [⚠️注意] 获取 PS Key 权限 + GetFriendListPermission // 获取好友列表权限 + GetGroupListPermission // 获取群列表权限 + GetGroupMemberListPermission // 获取群成员列表权限 + GroupRevokePermission // 撤回群消息权限 + GroupMemberBanPermission // 禁言群成员权限 + GroupMemberRemovePermission // 踢出群组成员权限 + ReceiveGroupMsgPermission // 接收群消息事件权限 + ReceiveFriendMsgPermission // 接收好友消息事件权限 + ReceivePrivateMsgPermission // 接收私聊消息事件权限 + RegisterCronEventPermission // 添加注册周期定时任务权限 + RemoteCallEventPermission // [⚠️注意] 远程调用接口权限 + SystemInfoPermission // 获取系统信息权限 + + ReceiveAllMsgPermission = ReceiveGroupMsgPermission | ReceiveFriendMsgPermission | ReceivePrivateMsgPermission // 宏:接收消息权限 + SendMsgPermission = SendGroupMsgPermission | SendFriendMsgPermission | SendPrivateChatMsgPermission // 宏:发送消息权限 + + GroupAdminPermission = GetGroupListPermission | GetGroupMemberListPermission | GroupRevokePermission | GroupMemberBanPermission | GroupMemberRemovePermission // 宏:群管理权限 + AllPermission = Permission(^uint64(0)) // 宏:所有权限 +) +const PluginApiVersion = 1 diff --git a/plugin/meta/meta_generate.go b/plugin/meta/meta_generate.go new file mode 100644 index 0000000..f047969 --- /dev/null +++ b/plugin/meta/meta_generate.go @@ -0,0 +1,126 @@ +// Code generated by opq. DO NOT EDIT. + +package meta + +import "strings" + +func GetPermissions(permissions Permission) string { + permissionsStr := []string{} + if permissions&RegisterCronEventPermission != 0 { + permissionsStr = append(permissionsStr, "添加注册周期定时任务权限") + } + if permissions&SendGroupMsgPermission != 0 { + permissionsStr = append(permissionsStr, "发送群消息权限") + } + if permissions&SendPrivateChatMsgPermission != 0 { + permissionsStr = append(permissionsStr, "发送私聊权限") + } + if permissions&GetClientKeyPermission != 0 { + permissionsStr = append(permissionsStr, "[⚠️注意] 获取 Client Key 权限") + } + if permissions&GetPSeyPermission != 0 { + permissionsStr = append(permissionsStr, "[⚠️注意] 获取 PS Key 权限") + } + if permissions&GroupMemberRemovePermission != 0 { + permissionsStr = append(permissionsStr, "踢出群组成员权限") + } + if permissions&RemoteCallEventPermission != 0 { + permissionsStr = append(permissionsStr, "[⚠️注意] 远程调用接口权限") + } + if permissions&SendFriendMsgPermission != 0 { + permissionsStr = append(permissionsStr, "发送好友消息权限") + } + if permissions&UploadPermission != 0 { + permissionsStr = append(permissionsStr, "上传文件权限") + } + if permissions&GetFriendListPermission != 0 { + permissionsStr = append(permissionsStr, "获取好友列表权限") + } + if permissions&GetGroupListPermission != 0 { + permissionsStr = append(permissionsStr, "获取群列表权限") + } + if permissions&ReceiveGroupMsgPermission != 0 { + permissionsStr = append(permissionsStr, "接收群消息事件权限") + } + if permissions&ReceiveFriendMsgPermission != 0 { + permissionsStr = append(permissionsStr, "接收好友消息事件权限") + } + if permissions&ReceivePrivateMsgPermission != 0 { + permissionsStr = append(permissionsStr, "接收私聊消息事件权限") + } + if permissions&SystemInfoPermission != 0 { + permissionsStr = append(permissionsStr, "获取系统信息权限") + } + if permissions&HTTPRequestPermission != 0 { + permissionsStr = append(permissionsStr, "[⚠️注意] Http联网权限") + } + if permissions&GetGroupMemberListPermission != 0 { + permissionsStr = append(permissionsStr, "获取群成员列表权限") + } + if permissions&GroupRevokePermission != 0 { + permissionsStr = append(permissionsStr, "撤回群消息权限") + } + if permissions&GroupMemberBanPermission != 0 { + permissionsStr = append(permissionsStr, "禁言群成员权限") + } + if permissions&RegisterMiddlePermission != 0 { + permissionsStr = append(permissionsStr, "注册中间件权限") + } + return strings.Join(permissionsStr, "\n") +} +func SumPermissions(permissions ...string) Permission { + var sum Permission = 0 + for _, v := range permissions { + switch v { + case "GroupMemberBanPermission": + sum |= GroupMemberBanPermission + case "ReceiveGroupMsgPermission": + sum |= ReceiveGroupMsgPermission + case "ReceiveFriendMsgPermission": + sum |= ReceiveFriendMsgPermission + case "ReceivePrivateMsgPermission": + sum |= ReceivePrivateMsgPermission + case "SystemInfoPermission": + sum |= SystemInfoPermission + case "HTTPRequestPermission": + sum |= HTTPRequestPermission + case "GetGroupMemberListPermission": + sum |= GetGroupMemberListPermission + case "GroupRevokePermission": + sum |= GroupRevokePermission + case "RegisterMiddlePermission": + sum |= RegisterMiddlePermission + case "AllPermission": + sum |= AllPermission + case "GetPSeyPermission": + sum |= GetPSeyPermission + case "RegisterCronEventPermission": + sum |= RegisterCronEventPermission + case "ReceiveAllMsgPermission": + sum |= ReceiveAllMsgPermission + case "SendMsgPermission": + sum |= SendMsgPermission + case "GroupAdminPermission": + sum |= GroupAdminPermission + case "SendGroupMsgPermission": + sum |= SendGroupMsgPermission + case "SendPrivateChatMsgPermission": + sum |= SendPrivateChatMsgPermission + case "GetClientKeyPermission": + sum |= GetClientKeyPermission + case "GetGroupListPermission": + sum |= GetGroupListPermission + case "GroupMemberRemovePermission": + sum |= GroupMemberRemovePermission + case "RemoteCallEventPermission": + sum |= RemoteCallEventPermission + case "SendFriendMsgPermission": + sum |= SendFriendMsgPermission + case "UploadPermission": + sum |= UploadPermission + case "GetFriendListPermission": + sum |= GetFriendListPermission + } + } + return sum +} diff --git a/plugin/plugin.go b/plugin/plugin.go new file mode 100644 index 0000000..e6b2a62 --- /dev/null +++ b/plugin/plugin.go @@ -0,0 +1,509 @@ +package plugin + +import ( + "Yui/cron" + "Yui/opq" + "Yui/plugin/meta" + "Yui/proto" + "Yui/proto/library/systemInfo" + systemInfoExport "Yui/proto/library/systemInfo/export" + "bytes" + "context" + "crypto/ecdsa" + "crypto/sha256" + "encoding/binary" + "encoding/gob" + "encoding/hex" + "fmt" + "github.com/charmbracelet/log" + "github.com/ethereum/go-ethereum/crypto" + "github.com/knqyf263/go-plugin/types/known/emptypb" + "github.com/opq-osc/OPQBot/v2/events" + cron2 "github.com/robfig/cron/v3" + "github.com/spf13/viper" + "github.com/tetratelabs/wazero" + "github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1" + "io" + "math/big" + "os" + "path/filepath" + "strings" + "sync" + "time" +) + +const publicKey = "04bb752482134fc1ed0d7b1bdd8502fb3a364918e047c3233cabe40c285ad386ce6c94b2ac56dab3f9b56491f8e54b88e376c5f5bfc0bde8b1bd186c1f920178b4" + +var M = Manager{ + plugins: sync.Map{}, +} + +type Manager struct { + plugins sync.Map +} + +type Plugin struct { + Meta meta.PluginMeta + event PluginEvent + cronJobs map[string]cron2.EntryID + lock sync.Mutex // 保护 event +} + +func (p *Plugin) RemoteCall(ctx context.Context, req *proto.RemoteCallReq) (*proto.RemoteCallReply, error) { + if p.Meta.Permissions&meta.RemoteCallEventPermission == 0 { + return nil, fmt.Errorf("缺少调用权限") + } + + dstPlugin, err := M.GetPlugin(req.DstPluginName) + if err != nil { + return nil, err + } + // 审查被调用插件权限 + if dstPlugin.Meta.Permissions&meta.RemoteCallEventPermission == 0 { + return nil, fmt.Errorf("被调用插件缺少权限,无法调用") + } + var result *proto.RemoteCallReply + dstPlugin.LockEvent(func() { + result, err = dstPlugin.event.OnRemoteCallEvent(ctx, req) + }) + return result, err +} + +func (p *Plugin) LockEvent(f func()) { + p.lock.Lock() + defer p.lock.Unlock() + f() +} + +func (p *Plugin) RemoveCronJob(ctx context.Context, job *proto.CronJob) (*emptypb.Empty, error) { + if p.Meta.Permissions&meta.RegisterCronEventPermission == 0 { + return nil, fmt.Errorf("[%s]: %s", p.Meta.PluginName, "插件未获取注册周期任务权限!") + } + if v, ok := p.cronJobs[job.Id]; ok { + cron.C.Remove(v) + delete(p.cronJobs, job.Id) + } + return &emptypb.Empty{}, nil +} + +func (p *Plugin) RegisterCronJob(ctx context.Context, job *proto.CronJob) (*emptypb.Empty, error) { + if p.Meta.Permissions&meta.RegisterCronEventPermission == 0 { + return nil, fmt.Errorf("[%s]: %s", p.Meta.PluginName, "插件未获取注册周期任务权限!") + } + id, err := cron.C.AddFunc(job.Spec, func() { + log.Debug("调用周期任务") + if p != nil && p.event != nil { + p.LockEvent(func() { + _, err := p.event.OnCronEvent(ctx, &proto.CronEventReq{Id: job.Id}) + if err != nil { + log.Error(err) + } + }) + } + }) + if err != nil { + return nil, err + } + log.Debug("添加周期任务") + p.cronJobs[job.Id] = id + return &emptypb.Empty{}, nil +} + +type PluginEvent interface { + Close(ctx context.Context) error + proto.Event +} + +func init() { + opq.C.On(events.EventNameGroupMsg, func(ctx context.Context, event events.IEvent) { + if event.ParseGroupMsg().GetMsgType() == events.MsgTypeGroupMsg { + M.OnGroupMsgEvent(ctx, event) + } + }) +} + +func (m *Manager) OnGroupMsgEvent(ctx context.Context, event events.IEvent) { + if m.OnGroupMsgAdmin(ctx, event) { + return + } + m.plugins.Range(func(key, value any) bool { + v := value.(*Plugin) + // 权限检查 + if v.Meta.Permissions&meta.ReceiveGroupMsgPermission != 0 { + msg := &proto.CommonMsg{ + Time: event.GetMsgTime(), + SelfId: event.GetCurrentQQ(), + FromUin: event.ParseGroupMsg().GetGroupUin(), + SenderUin: event.ParseGroupMsg().GetSenderUin(), + Message: event.ParseGroupMsg().ParseTextMsg().GetTextContent(), + RawMessage: event.GetRawBytes(), + MessageId: int32(event.GetMsgUid()), + MessageType: int32(event.GetMsgType()), + } + go v.LockEvent(func() { + newCtx, cancel := context.WithTimeout(ctx, time.Second*10) + defer cancel() + + _, err := v.event.OnGroupMsg(newCtx, msg) + //_, err := v.event.OnGroupMsg(ctx, msg) + if err != nil { + log.Error(err) + } + }) + + } + return true + }) +} +func (m *Manager) CloseAllPlugin(ctx context.Context) { + m.plugins.Range(func(key, value any) bool { + p := value.(*Plugin) + closedCh := make(chan struct{}, 1) + go func() { + defer close(closedCh) + for _, v := range p.cronJobs { + cron.C.Remove(v) + } + p.LockEvent(func() { + _, err := p.event.Unload(ctx, &emptypb.Empty{}) + if err != nil { + log.Error(err) + } + }) + + }() + select { + case <-closedCh: + log.Infof("插件[%s]已卸载", p.Meta.PluginName) + case <-time.After(time.Second * 2): + log.Infof("超时强制关闭插件 %s", p.Meta.PluginName) + } + return true + }) +} +func (m *Manager) UnloadPlugin(ctx context.Context, pluginName string) error { + pI, ok := m.plugins.Load(pluginName) + if !ok { + return fmt.Errorf("未找到该插件") + } + defer m.plugins.Delete(pluginName) + p := pI.(*Plugin) + defer p.LockEvent(func() { + p.event.Close(ctx) + }) + closedCh := make(chan struct{}, 1) + go func() { + defer close(closedCh) + for _, v := range p.cronJobs { + cron.C.Remove(v) + } + p.LockEvent(func() { + _, err := p.event.Unload(ctx, &emptypb.Empty{}) + if err != nil { + log.Error(err) + } + }) + }() + select { + case <-closedCh: + log.Infof("插件[%s]已卸载", p.Meta.PluginName) + case <-time.After(time.Second * 2): + return fmt.Errorf("超时强制关闭插件") + } + return nil +} + +func (m *Manager) GetPlugin(pluginName string) (*Plugin, error) { + p, ok := m.plugins.Load(pluginName) + if !ok { + return nil, fmt.Errorf("未找到该插件") + } + return p.(*Plugin), nil +} +func (m *Manager) GetAllPlugins() map[string]*Plugin { + var plugins = map[string]*Plugin{} + m.plugins.Range(func(key, value any) bool { + plugins[key.(string)] = value.(*Plugin) + return true + }) + return plugins +} +func GetPluginInfo(pluginPath string) (*meta.PluginMeta, error) { + f, err := os.ReadFile(pluginPath) + if err != nil { + return nil, err + } + reader := bytes.NewReader(f) + sign := [3]byte{} + _, err = reader.Read(sign[:]) + if err != nil { + return nil, err + } + if !bytes.Equal(sign[:], []byte("OPQ")) { + return nil, fmt.Errorf("非OPQ插件") + } + var pluginApiVersion int32 = 0 + err = binary.Read(reader, binary.LittleEndian, &pluginApiVersion) + if err != nil { + return nil, err + } + if pluginApiVersion < meta.PluginApiVersion { + return nil, fmt.Errorf("插件API版本过低无法载入") + } + var length int32 = 0 + // 获取签名信息 + r := big.NewInt(0) + s := big.NewInt(0) + var signFlag int32 = 0 + err = binary.Read(reader, binary.LittleEndian, &signFlag) + if err != nil { + return nil, err + } + if int(signFlag) == 1 { + err = binary.Read(reader, binary.LittleEndian, &length) + if err != nil { + return nil, err + } + rByte := make([]byte, length) + _, err = reader.Read(rByte) + + if err != nil { + return nil, err + } + err = r.UnmarshalText(rByte) + if err != nil { + return nil, err + } + + err = binary.Read(reader, binary.LittleEndian, &length) + if err != nil { + return nil, err + } + sByte := make([]byte, length) + _, err = reader.Read(sByte) + if err != nil { + return nil, err + } + err = s.UnmarshalText(sByte) + if err != nil { + return nil, err + } + } + + // 读取头信息 + err = binary.Read(reader, binary.LittleEndian, &length) + if err != nil { + return nil, err + } + var headerSha256 []byte + header := make([]byte, length) + _, err = reader.Read(header) + if err != nil { + return nil, err + } + sha := sha256.New() + sha.Write(header) + headerSha256 = sha.Sum(nil) + dec := gob.NewDecoder(bytes.NewBuffer(header)) + pluginMeta := meta.PluginMeta{} + if err = dec.Decode(&pluginMeta); err != nil { + return nil, err + } + pluginMeta.Sign = false + if int(signFlag) == 1 { + p, err := hex.DecodeString(publicKey) + if err != nil { + log.Error(err) + } + pubKey, err := crypto.UnmarshalPubkey(p) + if err != nil { + log.Fatal(err) + } + // 公钥验证签名 + pluginMeta.Sign = ecdsa.Verify(pubKey, headerSha256, r, s) + } + return &pluginMeta, nil +} + +/* +[0-2] OPQ +[3-6] int32 header Len +*/ + +func (m *Manager) LoadPlugin(ctx context.Context, pluginPath string) error { + f, err := os.ReadFile(pluginPath) + if err != nil { + return err + } + reader := bytes.NewReader(f) + sign := [3]byte{} + _, err = reader.Read(sign[:]) + if err != nil { + return err + } + if !bytes.Equal(sign[:], []byte("OPQ")) { + return fmt.Errorf("非OPQ插件") + } + var pluginApiVersion int32 = 0 + err = binary.Read(reader, binary.LittleEndian, &pluginApiVersion) + if err != nil { + return err + } + if pluginApiVersion < meta.PluginApiVersion { + return fmt.Errorf("插件API版本过低无法载入") + } + var length int32 = 0 + // 获取签名信息 + r := big.NewInt(0) + s := big.NewInt(0) + var signFlag int32 = 0 + err = binary.Read(reader, binary.LittleEndian, &signFlag) + if err != nil { + return err + } + if int(signFlag) == 1 { + err = binary.Read(reader, binary.LittleEndian, &length) + if err != nil { + return err + } + rByte := make([]byte, length) + _, err = reader.Read(rByte) + + if err != nil { + return err + } + err = r.UnmarshalText(rByte) + if err != nil { + return err + } + + err = binary.Read(reader, binary.LittleEndian, &length) + if err != nil { + return err + } + sByte := make([]byte, length) + _, err = reader.Read(sByte) + if err != nil { + return err + } + err = s.UnmarshalText(sByte) + if err != nil { + return err + } + } + + // 读取头信息 + err = binary.Read(reader, binary.LittleEndian, &length) + if err != nil { + return err + } + header := make([]byte, length) + _, err = reader.Read(header) + if err != nil { + return err + } + sha := sha256.New() + sha.Write(header) + headerSha256 := sha.Sum(nil) + dec := gob.NewDecoder(bytes.NewBuffer(header)) + pluginMeta := meta.PluginMeta{} + if err = dec.Decode(&pluginMeta); err != nil { + return err + } + if _, ok := m.plugins.Load(pluginMeta.PluginName); ok { + return fmt.Errorf("插件名已存在,无法重复加载!") + } + // 依赖 + for _, v := range pluginMeta.Dependencies { + if _, ok := m.plugins.Load(v); !ok { + return fmt.Errorf("缺少依赖项%s,插件无法载入", v) + } + } + + pluginMeta.Sign = false + if int(signFlag) == 1 { + p, err := hex.DecodeString(publicKey) + if err != nil { + log.Error(err) + } + pubKey, err := crypto.UnmarshalPubkey(p) + if err != nil { + log.Fatal(err) + } + // 公钥验证签名 + pluginMeta.Sign = ecdsa.Verify(pubKey, headerSha256, r, s) + } + log.Info("载入插件中", "pluginName", pluginMeta.PluginName, "sha256", pluginMeta.Sha256) + data, err := io.ReadAll(reader) + if err != nil { + return err + } + sha = sha256.New() + sha.Write(data) + sha256Result := hex.EncodeToString(sha.Sum(nil)) + log.Info("计算sha256", "result", sha256Result) + if !strings.EqualFold(sha256Result, pluginMeta.Sha256) { + return fmt.Errorf("插件疑似被篡改,禁止载入") + } + dir := filepath.Join("plugins", pluginMeta.PluginName) + err = os.MkdirAll(dir, 0777) + if err != nil { + return err + } + p := Plugin{Meta: pluginMeta, cronJobs: map[string]cron2.EntryID{}} + mc := wazero.NewModuleConfig(). + WithStdout(io.Discard). // 丢弃 + WithStderr(io.Discard). // 丢弃 + WithFSConfig(wazero.NewFSConfig().WithDirMount(dir, "/")) + env := viper.GetStringMapString("plugin.env") + for k, v := range env { + mc = mc.WithEnv(k, v) + } + rc := wazero.NewRuntimeConfig() + + pluginVm, err := proto.NewEventPlugin(ctx, proto.WazeroModuleConfig(mc), proto.WazeroRuntime(func(ctx context.Context) (wazero.Runtime, error) { + r := wazero.NewRuntimeWithConfig(ctx, rc) + if _, err := wasi_snapshot_preview1.Instantiate(ctx, r); err != nil { + return nil, err + } + if err = systemInfoExport.Instantiate(ctx, r, &systemInfo.SystemInfo{PluginInfo: pluginMeta}); err != nil { + return nil, err + } + return r, nil + })) + + if err != nil { + return err + } + + p.event, err = pluginVm.LoadWithBytes(ctx, data, &p) + if err != nil { + return err + } + reply, err := p.event.Init(ctx, &emptypb.Empty{}) + if err != nil { + p.event.Close(ctx) + return err + } + if !reply.Ok { + p.event.Close(ctx) + return fmt.Errorf(reply.Message) + } + m.plugins.Store(pluginMeta.PluginName, &p) + return nil +} + +func (p *Plugin) Log(ctx context.Context, req *proto.LogReq) (*emptypb.Empty, error) { + data := fmt.Sprintf("[%s]: %s", p.Meta.PluginName, req.GetMsg()) + switch req.LogType { + case proto.LogType_Info: + log.Info(data) + case proto.LogType_Debug: + log.Debug(data) + case proto.LogType_Error: + log.Error(data) + case proto.LogType_Warn: + log.Warn(data) + } + return &emptypb.Empty{}, nil +} diff --git a/plugin/repository/repository.go b/plugin/repository/repository.go new file mode 100644 index 0000000..7bccc0e --- /dev/null +++ b/plugin/repository/repository.go @@ -0,0 +1,50 @@ +package repository + +import ( + "Yui/plugin/meta" + "context" + "encoding/json" + "fmt" + "github.com/imroc/req/v3" + "github.com/spf13/viper" +) + +// 远程仓库 只允许加载签名的插件 + +const url = "https://raw.githubusercontent.com/mcoo/OPQPlugin/main/repository.json" + +//go:generate easyjson repository.go + +type Plugin struct { + meta.PluginMeta + Permissions []string `json:"Permissions"` + DownloadUrl string `json:"DownloadUrl"` +} + +//easyjson:json +type ResponseStruct struct { + ApiVersion int `json:"ApiVersion"` + Plugins map[string]Plugin `json:"Plugins"` +} + +func GetPluginList(ctx context.Context) (map[string]Plugin, error) { + var r *req.Request + if proxy := viper.GetString("httpProxy"); proxy != "" { + r = req.C().SetProxyURL(proxy).R().SetContext(ctx) + } else { + r = req.R().SetContext(ctx) + } + resp, err := r.Get("https://raw.githubusercontent.com/mcoo/OPQPlugin/main/yun.json") + if err != nil { + return nil, err + } + var data = &ResponseStruct{} + err = json.Unmarshal(resp.Bytes(), data) + if err != nil { + return nil, err + } + if meta.PluginApiVersion < data.ApiVersion { + return nil, fmt.Errorf("api版本过低") + } + return data.Plugins, nil +} diff --git a/plugins/animeCharacter/animeCharacter.go b/plugins/animeCharacter/animeCharacter.go new file mode 100644 index 0000000..e45fcf2 --- /dev/null +++ b/plugins/animeCharacter/animeCharacter.go @@ -0,0 +1,92 @@ +//go:build tinygo.wasm + +package main + +import ( + "Yui/plugin/S" + "Yui/plugins/animeCharacter/config" + "Yui/proto" + "context" + "fmt" + "github.com/knqyf263/go-plugin/types/known/emptypb" + "github.com/tidwall/gjson" + "math/rand" + "time" +) + +var dataArray []gjson.Result + +type animeCharacter struct { +} + +func (s animeCharacter) OnRemoteCallEvent(ctx context.Context, req *proto.RemoteCallReq) (*proto.RemoteCallReply, error) { + call := &config.RemoteCallS{} + err := call.UnmarshalJSON(req.Args) + if err != nil { + return nil, err + } + S.LogInfo(ctx, call.Test) + return &proto.RemoteCallReply{Data: []byte(dataArray[rand.Intn(len(dataArray))].String())}, nil +} + +func (s animeCharacter) Init(ctx context.Context, empty *emptypb.Empty) (*proto.InitReply, error) { + S.LogInfo(ctx, "初始化插件") + rand.Seed(time.Now().Unix()) + return &proto.InitReply{ + Ok: true, + Message: "", + }, nil +} + +func (s animeCharacter) OnGroupMsg(ctx context.Context, msg *proto.CommonMsg) (*emptypb.Empty, error) { + event, err := S.ParserEvent(msg.RawMessage) + if err != nil { + S.LogError(ctx, err.Error()) + } + if event.ParseGroupMsg().AtBot() { + S.SendGroupTextMsg(ctx, event.ParseGroupMsg().GetGroupUin(), event.GetCurrentQQ(), "at我干什么?") + } + + if msg.SelfId != msg.SenderUin { + if msg.Message == "来个名字" { + if dataArray == nil { + resp, err := S.HttpGet(ctx, "https://animechan.vercel.app/api/available/character", nil) + if err != nil { + return nil, err + } + S.LogDebug(ctx, string(resp.Content)) + data := gjson.ParseBytes(resp.Content) + if data.IsArray() { + dataArray = data.Array() + } else { + S.SendGroupTextMsg(ctx, msg.FromUin, msg.SelfId, "获取资源失败") + } + + } + S.SendGroupTextMsg(ctx, msg.FromUin, msg.SelfId, fmt.Sprintf("%s这个名字怎么样呢?", dataArray[rand.Intn(len(dataArray))].String())) + + } + + } + return &emptypb.Empty{}, nil +} + +func (s animeCharacter) OnFriendMsg(ctx context.Context, msg *proto.CommonMsg) (*emptypb.Empty, error) { + return &emptypb.Empty{}, nil +} + +func (s animeCharacter) OnPrivateMsg(ctx context.Context, msg *proto.CommonMsg) (*emptypb.Empty, error) { + return &emptypb.Empty{}, nil +} + +func (s animeCharacter) Unload(ctx context.Context, empty *emptypb.Empty) (*emptypb.Empty, error) { + return &emptypb.Empty{}, nil +} + +func (s animeCharacter) OnCronEvent(ctx context.Context, req *proto.CronEventReq) (*emptypb.Empty, error) { + return &emptypb.Empty{}, nil +} + +func main() { + proto.RegisterEvent(&animeCharacter{}) +} diff --git a/plugins/animeCharacter/config/model.go b/plugins/animeCharacter/config/model.go new file mode 100644 index 0000000..28e5c20 --- /dev/null +++ b/plugins/animeCharacter/config/model.go @@ -0,0 +1,6 @@ +package config + +//easyjson:json +type RemoteCallS struct { + Test string `json:"Test"` +} diff --git a/plugins/animeCharacter/config/model_easyjson.go b/plugins/animeCharacter/config/model_easyjson.go new file mode 100644 index 0000000..20f9101 --- /dev/null +++ b/plugins/animeCharacter/config/model_easyjson.go @@ -0,0 +1,85 @@ +// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT. + +package config + +import ( + json "encoding/json" + easyjson "github.com/mailru/easyjson" + jlexer "github.com/mailru/easyjson/jlexer" + jwriter "github.com/mailru/easyjson/jwriter" +) + +// suppress unused package warning +var ( + _ *json.RawMessage + _ *jlexer.Lexer + _ *jwriter.Writer + _ easyjson.Marshaler +) + +func easyjsonC80ae7adDecodeYuiPluginsAnimeCharacterConfig(in *jlexer.Lexer, out *RemoteCallS) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeFieldName(false) + in.WantColon() + if in.IsNull() { + in.Skip() + in.WantComma() + continue + } + switch key { + case "Test": + out.Test = string(in.String()) + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC80ae7adEncodeYuiPluginsAnimeCharacterConfig(out *jwriter.Writer, in RemoteCallS) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"Test\":" + out.RawString(prefix[1:]) + out.String(string(in.Test)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v RemoteCallS) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC80ae7adEncodeYuiPluginsAnimeCharacterConfig(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v RemoteCallS) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC80ae7adEncodeYuiPluginsAnimeCharacterConfig(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *RemoteCallS) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC80ae7adDecodeYuiPluginsAnimeCharacterConfig(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *RemoteCallS) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC80ae7adDecodeYuiPluginsAnimeCharacterConfig(l, v) +} diff --git a/plugins/animeCharacter/meta.json b/plugins/animeCharacter/meta.json new file mode 100644 index 0000000..e55dad0 --- /dev/null +++ b/plugins/animeCharacter/meta.json @@ -0,0 +1,8 @@ +{ + "PluginName":"animeCharacter", + "Description": "用于获取一个随机的二次元角色的插件", + "Author": "enjoy", + "Version": 0, + "Url": "https://mcenjoy.cn", + "Permissions": ["HTTPRequestPermission","UploadPermission","SendGroupMsgPermission","ReceiveGroupMsgPermission","RemoteCallEvent"] +} \ No newline at end of file diff --git a/plugins/example/example.go b/plugins/example/example.go new file mode 100644 index 0000000..9c97682 --- /dev/null +++ b/plugins/example/example.go @@ -0,0 +1,143 @@ +//go:build tinygo.wasm + +package main + +import ( + "Yui/plugin/meta" + "Yui/proto" + "context" + "encoding/base64" + "github.com/google/uuid" + "github.com/knqyf263/go-plugin/types/known/emptypb" + "os" +) + +const Permission = meta.SendMsgPermission | meta.HTTPRequestPermission | meta.UploadPermission | meta.GroupAdminPermission | meta.ReceiveAllMsgPermission + +type ExamplePlugin struct { +} + +func (p ExamplePlugin) OnRemoteCallEvent(ctx context.Context, req *proto.RemoteCallReq) (*proto.RemoteCallReply, error) { + //TODO implement me + panic("implement me") +} + +var cronJob = map[string]func(){} + +func (p ExamplePlugin) OnCronEvent(ctx context.Context, req *proto.CronEventReq) (*emptypb.Empty, error) { + v, ok := cronJob[req.Id] + if ok { + v() + } + return &emptypb.Empty{}, nil +} + +func (p ExamplePlugin) OnFriendMsg(ctx context.Context, msg *proto.CommonMsg) (*emptypb.Empty, error) { + //TODO implement me + panic("implement me") +} + +func (p ExamplePlugin) OnPrivateMsg(ctx context.Context, msg *proto.CommonMsg) (*emptypb.Empty, error) { + //TODO implement me + panic("implement me") +} + +func (p ExamplePlugin) OnGroupMsg(ctx context.Context, msg *proto.CommonMsg) (*emptypb.Empty, error) { + api := proto.NewApi() + if msg != nil { + if msg.Message == "http" { + resp, err := api.Http(ctx, &proto.HttpReq{ + Url: "https://api.github.com/repositories/332116757/languages", + Method: proto.HttpMethod_GET, + Header: nil, + Content: nil, + }) + if err != nil { + return nil, err + } + + _, _ = api.SendGroupMsg(ctx, &proto.MsgReq{ + ToUin: msg.FromUin, + Msg: &proto.MsgReq_TextMsg{TextMsg: &proto.TextMsg{Text: string(resp.Content)}}, + BotUin: msg.SelfId, + }) + } + if msg.Message == "pic" { + png, _ := os.ReadFile("/bq.png") + pic := base64.StdEncoding.EncodeToString(png) + file, err := api.Upload(ctx, &proto.UploadReq{ + File: &proto.UploadReq_Base64Buf{ + Base64Buf: pic, + }, + BotUin: msg.SelfId, + UploadId: proto.UploadId_Group, + }) + if err != nil { + return nil, err + } + _, err = api.SendGroupMsg(ctx, &proto.MsgReq{ + ToUin: msg.FromUin, + Msg: &proto.MsgReq_PicMsg{PicMsg: &proto.Files{ + File: []*proto.File{ + file.File, + }, + }}, + BotUin: msg.SelfId, + }) + + if err != nil { + return nil, err + } + } + if msg.Message == "测试周期任务" { + id := uuid.New() + cronJob[id.String()] = func() { + api := proto.NewApi() + _, _ = api.SendGroupMsg(ctx, &proto.MsgReq{ + ToUin: msg.FromUin, + Msg: &proto.MsgReq_TextMsg{TextMsg: &proto.TextMsg{Text: "周期任务测试"}}, + BotUin: msg.SelfId, + }) + } + api.RegisterCronJob(ctx, &proto.CronJob{Spec: "* * * * *", Id: id.String()}) + + } + } + + return &emptypb.Empty{}, nil +} +func (p ExamplePlugin) Unload(ctx context.Context, _ *emptypb.Empty) (*emptypb.Empty, error) { + return &emptypb.Empty{}, nil + +} +func (p ExamplePlugin) Init(ctx context.Context, _ *emptypb.Empty) (*proto.InitReply, error) { + api := proto.NewApi() + api.Log(ctx, &proto.LogReq{ + LogType: proto.LogType_Info, + Msg: "来自插件的消息欧~", + }) + api.Log(ctx, &proto.LogReq{ + LogType: proto.LogType_Warn, + Msg: "来自插件的消息欧~", + }) + api.Log(ctx, &proto.LogReq{ + LogType: proto.LogType_Error, + Msg: "来自插件的消息欧~", + }) + err := os.WriteFile("/test.txt", []byte("helloworld"), 0777) + if err != nil { + api.Log(ctx, &proto.LogReq{ + LogType: proto.LogType_Error, + Msg: err.Error(), + }) + } + + return &proto.InitReply{ + Ok: true, + Message: "Success", + }, nil +} + +func main() { + proto.RegisterEvent(ExamplePlugin{}) +} diff --git a/plugins/example/meta.json b/plugins/example/meta.json new file mode 100644 index 0000000..51d2260 --- /dev/null +++ b/plugins/example/meta.json @@ -0,0 +1,8 @@ +{ + "PluginName":"example", + "Description": "用于测试的简单插件", + "Author": "enjoy", + "Version": 0, + "Url": "https://mcenjoy.cn", + "Permissions": ["SendGroupMsgPermission","ReceiveGroupMsgPermission"] +} \ No newline at end of file diff --git a/plugins/signPlugin/config.json b/plugins/signPlugin/config.json new file mode 100644 index 0000000..db736a9 --- /dev/null +++ b/plugins/signPlugin/config.json @@ -0,0 +1 @@ +{"users":[2435932516],"botUin":2629326992} \ No newline at end of file diff --git a/plugins/signPlugin/config/config.go b/plugins/signPlugin/config/config.go new file mode 100644 index 0000000..21e9e3c --- /dev/null +++ b/plugins/signPlugin/config/config.go @@ -0,0 +1,37 @@ +package config + +import ( + "os" +) + +//easyjson:json +type Config struct { + Users []int64 `json:"users"` + BotUin int64 `json:"botUin"` +} + +var C *Config + +func ReadConfig() error { + fBytes, err := os.ReadFile("/config.json") + if err != nil { + return err + } + C = &Config{} + err = C.UnmarshalJSON(fBytes) + if err != nil { + return err + } + return nil +} +func SaveConfig() error { + jsonByes, err := C.MarshalJSON() + if err != nil { + return err + } + err = os.WriteFile("/config.json", []byte(jsonByes), 0777) + if err != nil { + return err + } + return nil +} diff --git a/plugins/signPlugin/config/config_easyjson.go b/plugins/signPlugin/config/config_easyjson.go new file mode 100644 index 0000000..3b5dd80 --- /dev/null +++ b/plugins/signPlugin/config/config_easyjson.go @@ -0,0 +1,124 @@ +// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT. + +package config + +import ( + json "encoding/json" + easyjson "github.com/mailru/easyjson" + jlexer "github.com/mailru/easyjson/jlexer" + jwriter "github.com/mailru/easyjson/jwriter" +) + +// suppress unused package warning +var ( + _ *json.RawMessage + _ *jlexer.Lexer + _ *jwriter.Writer + _ easyjson.Marshaler +) + +func easyjson6615c02eDecodeYuiPluginsSignPluginConfig(in *jlexer.Lexer, out *Config) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeFieldName(false) + in.WantColon() + if in.IsNull() { + in.Skip() + in.WantComma() + continue + } + switch key { + case "users": + if in.IsNull() { + in.Skip() + out.Users = nil + } else { + in.Delim('[') + if out.Users == nil { + if !in.IsDelim(']') { + out.Users = make([]int64, 0, 8) + } else { + out.Users = []int64{} + } + } else { + out.Users = (out.Users)[:0] + } + for !in.IsDelim(']') { + var v1 int64 + v1 = int64(in.Int64()) + out.Users = append(out.Users, v1) + in.WantComma() + } + in.Delim(']') + } + case "botUin": + out.BotUin = int64(in.Int64()) + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson6615c02eEncodeYuiPluginsSignPluginConfig(out *jwriter.Writer, in Config) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"users\":" + out.RawString(prefix[1:]) + if in.Users == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v2, v3 := range in.Users { + if v2 > 0 { + out.RawByte(',') + } + out.Int64(int64(v3)) + } + out.RawByte(']') + } + } + { + const prefix string = ",\"botUin\":" + out.RawString(prefix) + out.Int64(int64(in.BotUin)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v Config) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson6615c02eEncodeYuiPluginsSignPluginConfig(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v Config) MarshalEasyJSON(w *jwriter.Writer) { + easyjson6615c02eEncodeYuiPluginsSignPluginConfig(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *Config) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson6615c02eDecodeYuiPluginsSignPluginConfig(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *Config) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson6615c02eDecodeYuiPluginsSignPluginConfig(l, v) +} diff --git a/plugins/signPlugin/generate_config.go b/plugins/signPlugin/generate_config.go new file mode 100644 index 0000000..f82a658 --- /dev/null +++ b/plugins/signPlugin/generate_config.go @@ -0,0 +1,3 @@ +package main + +//go:generate easyjson -all config/config.go diff --git a/plugins/signPlugin/meta.json b/plugins/signPlugin/meta.json new file mode 100644 index 0000000..0ea3b6d --- /dev/null +++ b/plugins/signPlugin/meta.json @@ -0,0 +1,9 @@ +{ + "PluginName":"signPlugin", + "Description": "用于群内签到保活的插件", + "Author": "enjoy", + "Version": 0, + "Url": "https://mcenjoy.cn", + "SignInfo": "社区签名认证", + "Permissions": ["RemoteCallEvent","UploadPermission","SendGroupMsgPermission","RegisterCronEventPermission","ReceiveGroupMsgPermission"] +} \ No newline at end of file diff --git a/plugins/signPlugin/signPlugin.go b/plugins/signPlugin/signPlugin.go new file mode 100644 index 0000000..b546054 --- /dev/null +++ b/plugins/signPlugin/signPlugin.go @@ -0,0 +1,141 @@ +//go:build tinygo.wasm + +package main + +import ( + "Yui/plugin/S" + anime "Yui/plugins/animeCharacter/config" + "Yui/plugins/signPlugin/config" + "Yui/proto" + "context" + "fmt" + "github.com/knqyf263/go-plugin/types/known/emptypb" + "strconv" + "strings" + "time" +) + +type SignPlugin struct { +} + +func (s SignPlugin) OnRemoteCallEvent(ctx context.Context, req *proto.RemoteCallReq) (*proto.RemoteCallReply, error) { + //TODO implement me + panic("implement me") +} + +func RemoveUser(id int64) error { + for i, v := range config.C.Users { + if v == id { + config.C.Users = append(config.C.Users[:i], config.C.Users[i+1:]...) + } + } + return config.SaveConfig() +} +func AddUser(id int64) error { + isAdded := false + for _, v := range config.C.Users { + if v == id { + isAdded = true + break + } + } + if isAdded { + return fmt.Errorf("已经添加了!") + } + config.C.Users = append(config.C.Users, id) + return config.SaveConfig() +} +func GetList() (result []string) { + for _, v := range config.C.Users { + result = append(result, strconv.FormatInt(v, 10)) + } + return result +} + +func (s SignPlugin) Init(ctx context.Context, empty *emptypb.Empty) (*proto.InitReply, error) { + S.LogInfo(ctx, "初始化插件") + err := config.ReadConfig() + if err != nil { + S.LogError(ctx, err.Error()) + } + _, err = proto.NewApi().RegisterCronJob(ctx, &proto.CronJob{ + Spec: "0 12 * * *", + Id: "sign", + }) + if err != nil { + return nil, err + } + return &proto.InitReply{ + Ok: true, + Message: "", + }, nil +} + +func (s SignPlugin) OnGroupMsg(ctx context.Context, msg *proto.CommonMsg) (*emptypb.Empty, error) { + if msg.SelfId != msg.SenderUin { + if msg.Message == "远程call" { + data, _ := anime.RemoteCallS{Test: "测试"}.MarshalJSON() + r, err := proto.NewApi().RemoteCall(ctx, &proto.RemoteCallReq{ + DstPluginName: "animeCharacter", + CallPath: "randomName", + Args: data, + }) + if err != nil { + S.SendGroupTextMsg(ctx, msg.FromUin, msg.SelfId, err.Error()) + } else { + S.SendGroupTextMsg(ctx, msg.FromUin, msg.SelfId, "调用结果:"+string(r.Data)) + } + } + if msg.Message == "删除我" { + if err := RemoveUser(msg.SenderUin); err != nil { + S.SendGroupTextMsg(ctx, msg.FromUin, msg.SelfId, err.Error()) + } else { + S.SendGroupTextMsg(ctx, msg.FromUin, msg.SelfId, "删除成功") + } + } + if msg.Message == "添加我" { + if err := AddUser(msg.SenderUin); err != nil { + S.SendGroupTextMsg(ctx, msg.FromUin, msg.SelfId, err.Error()) + } else { + S.SendGroupTextMsg(ctx, msg.FromUin, msg.SelfId, "添加成功") + } + } + if msg.Message == "自动签到列表" { + S.SendGroupTextMsg(ctx, msg.FromUin, msg.SelfId, "自动签到列表:\n"+strings.Join(GetList(), "\n")) + + } + + } + return &emptypb.Empty{}, nil +} + +func (s SignPlugin) OnFriendMsg(ctx context.Context, msg *proto.CommonMsg) (*emptypb.Empty, error) { + return &emptypb.Empty{}, nil +} + +func (s SignPlugin) OnPrivateMsg(ctx context.Context, msg *proto.CommonMsg) (*emptypb.Empty, error) { + return &emptypb.Empty{}, nil +} + +func (s SignPlugin) Unload(ctx context.Context, empty *emptypb.Empty) (*emptypb.Empty, error) { + api := proto.NewApi() + api.RemoveCronJob(ctx, &proto.CronJob{ + Id: "sign", + }) + return &emptypb.Empty{}, nil +} + +func (s SignPlugin) OnCronEvent(ctx context.Context, req *proto.CronEventReq) (*emptypb.Empty, error) { + if req.Id == "sign" { + for _, v := range config.C.Users { + S.SendGroupTextMsg(ctx, 856337734, config.C.BotUin, "签到"+strconv.FormatInt(v, 10)) + time.Sleep(time.Second * 2) + } + + } + return &emptypb.Empty{}, nil +} + +func main() { + proto.RegisterEvent(&SignPlugin{}) +} diff --git a/plugins/systemInfo/meta.json b/plugins/systemInfo/meta.json new file mode 100644 index 0000000..b5e3fa3 --- /dev/null +++ b/plugins/systemInfo/meta.json @@ -0,0 +1,9 @@ +{ + "PluginName":"systemInfoPlugin", + "Description": "用于获取系统信息的插件", + "Author": "enjoy", + "Version": 0, + "Url": "https://mcenjoy.cn", + "SignInfo": "社区签名认证", + "Permissions": ["SendGroupMsgPermission","SystemInfoPermission","ReceiveGroupMsgPermission"] +} \ No newline at end of file diff --git a/plugins/systemInfo/systemInfo.go b/plugins/systemInfo/systemInfo.go new file mode 100644 index 0000000..cf26d9a --- /dev/null +++ b/plugins/systemInfo/systemInfo.go @@ -0,0 +1,82 @@ +//go:build tinygo.wasm + +package main + +import ( + "Yui/plugin/S" + "Yui/proto" + "Yui/proto/library/systemInfo/export" + "context" + "fmt" + + "github.com/knqyf263/go-plugin/types/known/emptypb" +) + +type SystemInfoPlugin struct { +} + +func (s SystemInfoPlugin) OnRemoteCallEvent(ctx context.Context, req *proto.RemoteCallReq) (*proto.RemoteCallReply, error) { + //TODO implement me + panic("implement me") +} + +func (s SystemInfoPlugin) Init(ctx context.Context, empty *emptypb.Empty) (*proto.InitReply, error) { + S.LogInfo(ctx, "初始化插件") + return &proto.InitReply{ + Ok: true, + Message: "", + }, nil +} + +func (s SystemInfoPlugin) OnGroupMsg(ctx context.Context, msg *proto.CommonMsg) (*emptypb.Empty, error) { + if msg.SelfId != msg.SenderUin { + if msg.Message == "系统信息" { + systemInfo := export.NewSystemInfo() + cpuInfoBytes, err := systemInfo.CpuInfo(ctx, &emptypb.Empty{}) + if err != nil { + S.SendGroupTextMsg(ctx, msg.FromUin, msg.SelfId, err.Error()) + return &emptypb.Empty{}, nil + } + var cpuInfo = &export.CpuInfo{} + err = cpuInfo.UnmarshalJSON(cpuInfoBytes.Data) + + memInfoBytes, err := systemInfo.MemInfo(ctx, &emptypb.Empty{}) + if err != nil { + S.SendGroupTextMsg(ctx, msg.FromUin, msg.SelfId, err.Error()) + return &emptypb.Empty{}, nil + } + var memInfo = &export.MemInfo{} + err = memInfo.UnmarshalJSON(memInfoBytes.Data) + if err != nil { + S.SendGroupTextMsg(ctx, msg.FromUin, msg.SelfId, err.Error()) + return &emptypb.Empty{}, nil + } + S.SendGroupTextMsg(ctx, msg.FromUin, msg.SelfId, fmt.Sprintf("CPU: %v\nMem: virtual:%v/%v", + cpuInfo.CPU[0].Family+" "+cpuInfo.CPU[0].Model+" "+cpuInfo.CPU[0].ModelName, + memInfo.VirtualMemory.Used, memInfo.VirtualMemory.Total, + )) + } + + } + return &emptypb.Empty{}, nil +} + +func (s SystemInfoPlugin) OnFriendMsg(ctx context.Context, msg *proto.CommonMsg) (*emptypb.Empty, error) { + return &emptypb.Empty{}, nil +} + +func (s SystemInfoPlugin) OnPrivateMsg(ctx context.Context, msg *proto.CommonMsg) (*emptypb.Empty, error) { + return &emptypb.Empty{}, nil +} + +func (s SystemInfoPlugin) Unload(ctx context.Context, empty *emptypb.Empty) (*emptypb.Empty, error) { + return &emptypb.Empty{}, nil +} + +func (s SystemInfoPlugin) OnCronEvent(ctx context.Context, req *proto.CronEventReq) (*emptypb.Empty, error) { + return &emptypb.Empty{}, nil +} + +func main() { + proto.RegisterEvent(&SystemInfoPlugin{}) +} diff --git a/proto/generate/generate.go b/proto/generate/generate.go new file mode 100644 index 0000000..ebd1ae8 --- /dev/null +++ b/proto/generate/generate.go @@ -0,0 +1,49 @@ +package main + +import ( + "go/ast" + "go/format" + "go/parser" + "go/token" + "golang.org/x/tools/go/ast/astutil" + "os" +) + +func main() { + fs := token.NewFileSet() + astFile, err := parser.ParseFile(fs, "proto/opq_host.pb.go", nil, parser.ParseComments) + if err != nil { + panic(err) + } + astutil.Apply(astFile, nil, func(cursor *astutil.Cursor) bool { + n := cursor.Node() + switch v := n.(type) { + case *ast.FuncDecl: + if v.Recv != nil { + if v.Name.Name == "Load" { + v.Name.Name = "LoadWithBytes" + v.Type.Params.List[1].Names[0].Name = "b" + v.Type.Params.List[1].Type.(*ast.Ident).Name = "[]byte" + v.Body.List = v.Body.List[2:] + } + } + case *ast.GenDecl: + if v.Tok.String() == "import" { + for i, j := range v.Specs { + imp := j.(*ast.ImportSpec) + if imp.Name.Name == "os" { + v.Specs = append(v.Specs[:i], v.Specs[i+1:]...) + } + } + } + + } + return true + }) + f, _ := os.OpenFile("proto/opq_host.pb.go", os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0777) + defer f.Close() + err = format.Node(f, fs, astFile) + if err != nil { + panic(err) + } +} diff --git a/proto/library/systemInfo/export/model.go b/proto/library/systemInfo/export/model.go new file mode 100644 index 0000000..b01a902 --- /dev/null +++ b/proto/library/systemInfo/export/model.go @@ -0,0 +1,115 @@ +package export + +//go:generate easyjson model.go + +type CPUStat struct { + CPU int32 `json:"cpu"` + VendorID string `json:"vendorId"` + Family string `json:"family"` + Model string `json:"model"` + Stepping int32 `json:"stepping"` + PhysicalID string `json:"physicalId"` + CoreID string `json:"coreId"` + Cores int32 `json:"cores"` + ModelName string `json:"modelName"` + Mhz float64 `json:"mhz"` + CacheSize int32 `json:"cacheSize"` + Flags []string `json:"flags"` + Microcode string `json:"microcode"` +} + +//easyjson:json +type CpuInfo struct { + CPU []CPUStat `json:"CPU"` +} + +//easyjson:json +type MemInfo struct { + SwapDevices []*struct { + Name string `json:"name"` + UsedBytes uint64 `json:"usedBytes"` + FreeBytes uint64 `json:"freeBytes"` + } `json:"SwapDevices"` + SwapMemory *struct { + Total uint64 `json:"total"` + Used uint64 `json:"used"` + Free uint64 `json:"free"` + UsedPercent float64 `json:"usedPercent"` + Sin uint64 `json:"sin"` + Sout uint64 `json:"sout"` + PgIn uint64 `json:"pgIn"` + PgOut uint64 `json:"pgOut"` + PgFault uint64 `json:"pgFault"` + + // Linux specific numbers + // https://www.kernel.org/doc/Documentation/cgroup-v2.txt + PgMajFault uint64 `json:"pgMajFault"` + } `json:"SwapMemory"` + VirtualMemory *struct { + // Total amount of RAM on this system + Total uint64 `json:"total"` + + // RAM available for programs to allocate + // + // This value is computed from the kernel specific values. + Available uint64 `json:"available"` + + // RAM used by programs + // + // This value is computed from the kernel specific values. + Used uint64 `json:"used"` + + // Percentage of RAM used by programs + // + // This value is computed from the kernel specific values. + UsedPercent float64 `json:"usedPercent"` + + // This is the kernel's notion of free memory; RAM chips whose bits nobody + // cares about the value of right now. For a human consumable number, + // Available is what you really want. + Free uint64 `json:"free"` + + // OS X / BSD specific numbers: + // http://www.macyourself.com/2010/02/17/what-is-free-wired-active-and-inactive-system-memory-ram/ + Active uint64 `json:"active"` + Inactive uint64 `json:"inactive"` + Wired uint64 `json:"wired"` + + // FreeBSD specific numbers: + // https://reviews.freebsd.org/D8467 + Laundry uint64 `json:"laundry"` + + // Linux specific numbers + // https://www.centos.org/docs/5/html/5.1/Deployment_Guide/s2-proc-meminfo.html + // https://www.kernel.org/doc/Documentation/filesystems/proc.txt + // https://www.kernel.org/doc/Documentation/vm/overcommit-accounting + Buffers uint64 `json:"buffers"` + Cached uint64 `json:"cached"` + WriteBack uint64 `json:"writeBack"` + Dirty uint64 `json:"dirty"` + WriteBackTmp uint64 `json:"writeBackTmp"` + Shared uint64 `json:"shared"` + Slab uint64 `json:"slab"` + Sreclaimable uint64 `json:"sreclaimable"` + Sunreclaim uint64 `json:"sunreclaim"` + PageTables uint64 `json:"pageTables"` + SwapCached uint64 `json:"swapCached"` + CommitLimit uint64 `json:"commitLimit"` + CommittedAS uint64 `json:"committedAS"` + HighTotal uint64 `json:"highTotal"` + HighFree uint64 `json:"highFree"` + LowTotal uint64 `json:"lowTotal"` + LowFree uint64 `json:"lowFree"` + SwapTotal uint64 `json:"swapTotal"` + SwapFree uint64 `json:"swapFree"` + Mapped uint64 `json:"mapped"` + VmallocTotal uint64 `json:"vmallocTotal"` + VmallocUsed uint64 `json:"vmallocUsed"` + VmallocChunk uint64 `json:"vmallocChunk"` + HugePagesTotal uint64 `json:"hugePagesTotal"` + HugePagesFree uint64 `json:"hugePagesFree"` + HugePagesRsvd uint64 `json:"hugePagesRsvd"` + HugePagesSurp uint64 `json:"hugePagesSurp"` + HugePageSize uint64 `json:"hugePageSize"` + } `json:"VirtualMemory"` +} diff --git a/proto/library/systemInfo/export/model_easyjson.go b/proto/library/systemInfo/export/model_easyjson.go new file mode 100644 index 0000000..888215d --- /dev/null +++ b/proto/library/systemInfo/export/model_easyjson.go @@ -0,0 +1,1049 @@ +// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT. + +package export + +import ( + json "encoding/json" + easyjson "github.com/mailru/easyjson" + jlexer "github.com/mailru/easyjson/jlexer" + jwriter "github.com/mailru/easyjson/jwriter" +) + +// suppress unused package warning +var ( + _ *json.RawMessage + _ *jlexer.Lexer + _ *jwriter.Writer + _ easyjson.Marshaler +) + +func easyjsonC80ae7adDecodeYuiProtoLibrarySystemInfoExport(in *jlexer.Lexer, out *MemInfo) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeFieldName(false) + in.WantColon() + if in.IsNull() { + in.Skip() + in.WantComma() + continue + } + switch key { + case "SwapDevices": + if in.IsNull() { + in.Skip() + out.SwapDevices = nil + } else { + in.Delim('[') + if out.SwapDevices == nil { + if !in.IsDelim(']') { + out.SwapDevices = make([]*struct { + Name string `json:"name"` + UsedBytes uint64 `json:"usedBytes"` + FreeBytes uint64 `json:"freeBytes"` + }, 0, 8) + } else { + out.SwapDevices = []*struct { + Name string `json:"name"` + UsedBytes uint64 `json:"usedBytes"` + FreeBytes uint64 `json:"freeBytes"` + }{} + } + } else { + out.SwapDevices = (out.SwapDevices)[:0] + } + for !in.IsDelim(']') { + var v1 *struct { + Name string `json:"name"` + UsedBytes uint64 `json:"usedBytes"` + FreeBytes uint64 `json:"freeBytes"` + } + if in.IsNull() { + in.Skip() + v1 = nil + } else { + if v1 == nil { + v1 = new(struct { + Name string `json:"name"` + UsedBytes uint64 `json:"usedBytes"` + FreeBytes uint64 `json:"freeBytes"` + }) + } + easyjsonC80ae7adDecode(in, v1) + } + out.SwapDevices = append(out.SwapDevices, v1) + in.WantComma() + } + in.Delim(']') + } + case "SwapMemory": + if in.IsNull() { + in.Skip() + out.SwapMemory = nil + } else { + if out.SwapMemory == nil { + out.SwapMemory = new(struct { + Total uint64 `json:"total"` + Used uint64 `json:"used"` + Free uint64 `json:"free"` + UsedPercent float64 `json:"usedPercent"` + Sin uint64 `json:"sin"` + Sout uint64 `json:"sout"` + PgIn uint64 `json:"pgIn"` + PgOut uint64 `json:"pgOut"` + PgFault uint64 `json:"pgFault"` + PgMajFault uint64 `json:"pgMajFault"` + }) + } + easyjsonC80ae7adDecode1(in, out.SwapMemory) + } + case "VirtualMemory": + if in.IsNull() { + in.Skip() + out.VirtualMemory = nil + } else { + if out.VirtualMemory == nil { + out.VirtualMemory = new(struct { + Total uint64 `json:"total"` + Available uint64 `json:"available"` + Used uint64 `json:"used"` + UsedPercent float64 `json:"usedPercent"` + Free uint64 `json:"free"` + Active uint64 `json:"active"` + Inactive uint64 `json:"inactive"` + Wired uint64 `json:"wired"` + Laundry uint64 `json:"laundry"` + Buffers uint64 `json:"buffers"` + Cached uint64 `json:"cached"` + WriteBack uint64 `json:"writeBack"` + Dirty uint64 `json:"dirty"` + WriteBackTmp uint64 `json:"writeBackTmp"` + Shared uint64 `json:"shared"` + Slab uint64 `json:"slab"` + Sreclaimable uint64 `json:"sreclaimable"` + Sunreclaim uint64 `json:"sunreclaim"` + PageTables uint64 `json:"pageTables"` + SwapCached uint64 `json:"swapCached"` + CommitLimit uint64 `json:"commitLimit"` + CommittedAS uint64 `json:"committedAS"` + HighTotal uint64 `json:"highTotal"` + HighFree uint64 `json:"highFree"` + LowTotal uint64 `json:"lowTotal"` + LowFree uint64 `json:"lowFree"` + SwapTotal uint64 `json:"swapTotal"` + SwapFree uint64 `json:"swapFree"` + Mapped uint64 `json:"mapped"` + VmallocTotal uint64 `json:"vmallocTotal"` + VmallocUsed uint64 `json:"vmallocUsed"` + VmallocChunk uint64 `json:"vmallocChunk"` + HugePagesTotal uint64 `json:"hugePagesTotal"` + HugePagesFree uint64 `json:"hugePagesFree"` + HugePagesRsvd uint64 `json:"hugePagesRsvd"` + HugePagesSurp uint64 `json:"hugePagesSurp"` + HugePageSize uint64 `json:"hugePageSize"` + }) + } + easyjsonC80ae7adDecode2(in, out.VirtualMemory) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC80ae7adEncodeYuiProtoLibrarySystemInfoExport(out *jwriter.Writer, in MemInfo) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"SwapDevices\":" + out.RawString(prefix[1:]) + if in.SwapDevices == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v2, v3 := range in.SwapDevices { + if v2 > 0 { + out.RawByte(',') + } + if v3 == nil { + out.RawString("null") + } else { + easyjsonC80ae7adEncode(out, *v3) + } + } + out.RawByte(']') + } + } + { + const prefix string = ",\"SwapMemory\":" + out.RawString(prefix) + if in.SwapMemory == nil { + out.RawString("null") + } else { + easyjsonC80ae7adEncode1(out, *in.SwapMemory) + } + } + { + const prefix string = ",\"VirtualMemory\":" + out.RawString(prefix) + if in.VirtualMemory == nil { + out.RawString("null") + } else { + easyjsonC80ae7adEncode2(out, *in.VirtualMemory) + } + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v MemInfo) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC80ae7adEncodeYuiProtoLibrarySystemInfoExport(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v MemInfo) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC80ae7adEncodeYuiProtoLibrarySystemInfoExport(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *MemInfo) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC80ae7adDecodeYuiProtoLibrarySystemInfoExport(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *MemInfo) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC80ae7adDecodeYuiProtoLibrarySystemInfoExport(l, v) +} +func easyjsonC80ae7adDecode2(in *jlexer.Lexer, out *struct { + Total uint64 `json:"total"` + Available uint64 `json:"available"` + Used uint64 `json:"used"` + UsedPercent float64 `json:"usedPercent"` + Free uint64 `json:"free"` + Active uint64 `json:"active"` + Inactive uint64 `json:"inactive"` + Wired uint64 `json:"wired"` + Laundry uint64 `json:"laundry"` + Buffers uint64 `json:"buffers"` + Cached uint64 `json:"cached"` + WriteBack uint64 `json:"writeBack"` + Dirty uint64 `json:"dirty"` + WriteBackTmp uint64 `json:"writeBackTmp"` + Shared uint64 `json:"shared"` + Slab uint64 `json:"slab"` + Sreclaimable uint64 `json:"sreclaimable"` + Sunreclaim uint64 `json:"sunreclaim"` + PageTables uint64 `json:"pageTables"` + SwapCached uint64 `json:"swapCached"` + CommitLimit uint64 `json:"commitLimit"` + CommittedAS uint64 `json:"committedAS"` + HighTotal uint64 `json:"highTotal"` + HighFree uint64 `json:"highFree"` + LowTotal uint64 `json:"lowTotal"` + LowFree uint64 `json:"lowFree"` + SwapTotal uint64 `json:"swapTotal"` + SwapFree uint64 `json:"swapFree"` + Mapped uint64 `json:"mapped"` + VmallocTotal uint64 `json:"vmallocTotal"` + VmallocUsed uint64 `json:"vmallocUsed"` + VmallocChunk uint64 `json:"vmallocChunk"` + HugePagesTotal uint64 `json:"hugePagesTotal"` + HugePagesFree uint64 `json:"hugePagesFree"` + HugePagesRsvd uint64 `json:"hugePagesRsvd"` + HugePagesSurp uint64 `json:"hugePagesSurp"` + HugePageSize uint64 `json:"hugePageSize"` +}) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeFieldName(false) + in.WantColon() + if in.IsNull() { + in.Skip() + in.WantComma() + continue + } + switch key { + case "total": + out.Total = uint64(in.Uint64()) + case "available": + out.Available = uint64(in.Uint64()) + case "used": + out.Used = uint64(in.Uint64()) + case "usedPercent": + out.UsedPercent = float64(in.Float64()) + case "free": + out.Free = uint64(in.Uint64()) + case "active": + out.Active = uint64(in.Uint64()) + case "inactive": + out.Inactive = uint64(in.Uint64()) + case "wired": + out.Wired = uint64(in.Uint64()) + case "laundry": + out.Laundry = uint64(in.Uint64()) + case "buffers": + out.Buffers = uint64(in.Uint64()) + case "cached": + out.Cached = uint64(in.Uint64()) + case "writeBack": + out.WriteBack = uint64(in.Uint64()) + case "dirty": + out.Dirty = uint64(in.Uint64()) + case "writeBackTmp": + out.WriteBackTmp = uint64(in.Uint64()) + case "shared": + out.Shared = uint64(in.Uint64()) + case "slab": + out.Slab = uint64(in.Uint64()) + case "sreclaimable": + out.Sreclaimable = uint64(in.Uint64()) + case "sunreclaim": + out.Sunreclaim = uint64(in.Uint64()) + case "pageTables": + out.PageTables = uint64(in.Uint64()) + case "swapCached": + out.SwapCached = uint64(in.Uint64()) + case "commitLimit": + out.CommitLimit = uint64(in.Uint64()) + case "committedAS": + out.CommittedAS = uint64(in.Uint64()) + case "highTotal": + out.HighTotal = uint64(in.Uint64()) + case "highFree": + out.HighFree = uint64(in.Uint64()) + case "lowTotal": + out.LowTotal = uint64(in.Uint64()) + case "lowFree": + out.LowFree = uint64(in.Uint64()) + case "swapTotal": + out.SwapTotal = uint64(in.Uint64()) + case "swapFree": + out.SwapFree = uint64(in.Uint64()) + case "mapped": + out.Mapped = uint64(in.Uint64()) + case "vmallocTotal": + out.VmallocTotal = uint64(in.Uint64()) + case "vmallocUsed": + out.VmallocUsed = uint64(in.Uint64()) + case "vmallocChunk": + out.VmallocChunk = uint64(in.Uint64()) + case "hugePagesTotal": + out.HugePagesTotal = uint64(in.Uint64()) + case "hugePagesFree": + out.HugePagesFree = uint64(in.Uint64()) + case "hugePagesRsvd": + out.HugePagesRsvd = uint64(in.Uint64()) + case "hugePagesSurp": + out.HugePagesSurp = uint64(in.Uint64()) + case "hugePageSize": + out.HugePageSize = uint64(in.Uint64()) + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC80ae7adEncode2(out *jwriter.Writer, in struct { + Total uint64 `json:"total"` + Available uint64 `json:"available"` + Used uint64 `json:"used"` + UsedPercent float64 `json:"usedPercent"` + Free uint64 `json:"free"` + Active uint64 `json:"active"` + Inactive uint64 `json:"inactive"` + Wired uint64 `json:"wired"` + Laundry uint64 `json:"laundry"` + Buffers uint64 `json:"buffers"` + Cached uint64 `json:"cached"` + WriteBack uint64 `json:"writeBack"` + Dirty uint64 `json:"dirty"` + WriteBackTmp uint64 `json:"writeBackTmp"` + Shared uint64 `json:"shared"` + Slab uint64 `json:"slab"` + Sreclaimable uint64 `json:"sreclaimable"` + Sunreclaim uint64 `json:"sunreclaim"` + PageTables uint64 `json:"pageTables"` + SwapCached uint64 `json:"swapCached"` + CommitLimit uint64 `json:"commitLimit"` + CommittedAS uint64 `json:"committedAS"` + HighTotal uint64 `json:"highTotal"` + HighFree uint64 `json:"highFree"` + LowTotal uint64 `json:"lowTotal"` + LowFree uint64 `json:"lowFree"` + SwapTotal uint64 `json:"swapTotal"` + SwapFree uint64 `json:"swapFree"` + Mapped uint64 `json:"mapped"` + VmallocTotal uint64 `json:"vmallocTotal"` + VmallocUsed uint64 `json:"vmallocUsed"` + VmallocChunk uint64 `json:"vmallocChunk"` + HugePagesTotal uint64 `json:"hugePagesTotal"` + HugePagesFree uint64 `json:"hugePagesFree"` + HugePagesRsvd uint64 `json:"hugePagesRsvd"` + HugePagesSurp uint64 `json:"hugePagesSurp"` + HugePageSize uint64 `json:"hugePageSize"` +}) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"total\":" + out.RawString(prefix[1:]) + out.Uint64(uint64(in.Total)) + } + { + const prefix string = ",\"available\":" + out.RawString(prefix) + out.Uint64(uint64(in.Available)) + } + { + const prefix string = ",\"used\":" + out.RawString(prefix) + out.Uint64(uint64(in.Used)) + } + { + const prefix string = ",\"usedPercent\":" + out.RawString(prefix) + out.Float64(float64(in.UsedPercent)) + } + { + const prefix string = ",\"free\":" + out.RawString(prefix) + out.Uint64(uint64(in.Free)) + } + { + const prefix string = ",\"active\":" + out.RawString(prefix) + out.Uint64(uint64(in.Active)) + } + { + const prefix string = ",\"inactive\":" + out.RawString(prefix) + out.Uint64(uint64(in.Inactive)) + } + { + const prefix string = ",\"wired\":" + out.RawString(prefix) + out.Uint64(uint64(in.Wired)) + } + { + const prefix string = ",\"laundry\":" + out.RawString(prefix) + out.Uint64(uint64(in.Laundry)) + } + { + const prefix string = ",\"buffers\":" + out.RawString(prefix) + out.Uint64(uint64(in.Buffers)) + } + { + const prefix string = ",\"cached\":" + out.RawString(prefix) + out.Uint64(uint64(in.Cached)) + } + { + const prefix string = ",\"writeBack\":" + out.RawString(prefix) + out.Uint64(uint64(in.WriteBack)) + } + { + const prefix string = ",\"dirty\":" + out.RawString(prefix) + out.Uint64(uint64(in.Dirty)) + } + { + const prefix string = ",\"writeBackTmp\":" + out.RawString(prefix) + out.Uint64(uint64(in.WriteBackTmp)) + } + { + const prefix string = ",\"shared\":" + out.RawString(prefix) + out.Uint64(uint64(in.Shared)) + } + { + const prefix string = ",\"slab\":" + out.RawString(prefix) + out.Uint64(uint64(in.Slab)) + } + { + const prefix string = ",\"sreclaimable\":" + out.RawString(prefix) + out.Uint64(uint64(in.Sreclaimable)) + } + { + const prefix string = ",\"sunreclaim\":" + out.RawString(prefix) + out.Uint64(uint64(in.Sunreclaim)) + } + { + const prefix string = ",\"pageTables\":" + out.RawString(prefix) + out.Uint64(uint64(in.PageTables)) + } + { + const prefix string = ",\"swapCached\":" + out.RawString(prefix) + out.Uint64(uint64(in.SwapCached)) + } + { + const prefix string = ",\"commitLimit\":" + out.RawString(prefix) + out.Uint64(uint64(in.CommitLimit)) + } + { + const prefix string = ",\"committedAS\":" + out.RawString(prefix) + out.Uint64(uint64(in.CommittedAS)) + } + { + const prefix string = ",\"highTotal\":" + out.RawString(prefix) + out.Uint64(uint64(in.HighTotal)) + } + { + const prefix string = ",\"highFree\":" + out.RawString(prefix) + out.Uint64(uint64(in.HighFree)) + } + { + const prefix string = ",\"lowTotal\":" + out.RawString(prefix) + out.Uint64(uint64(in.LowTotal)) + } + { + const prefix string = ",\"lowFree\":" + out.RawString(prefix) + out.Uint64(uint64(in.LowFree)) + } + { + const prefix string = ",\"swapTotal\":" + out.RawString(prefix) + out.Uint64(uint64(in.SwapTotal)) + } + { + const prefix string = ",\"swapFree\":" + out.RawString(prefix) + out.Uint64(uint64(in.SwapFree)) + } + { + const prefix string = ",\"mapped\":" + out.RawString(prefix) + out.Uint64(uint64(in.Mapped)) + } + { + const prefix string = ",\"vmallocTotal\":" + out.RawString(prefix) + out.Uint64(uint64(in.VmallocTotal)) + } + { + const prefix string = ",\"vmallocUsed\":" + out.RawString(prefix) + out.Uint64(uint64(in.VmallocUsed)) + } + { + const prefix string = ",\"vmallocChunk\":" + out.RawString(prefix) + out.Uint64(uint64(in.VmallocChunk)) + } + { + const prefix string = ",\"hugePagesTotal\":" + out.RawString(prefix) + out.Uint64(uint64(in.HugePagesTotal)) + } + { + const prefix string = ",\"hugePagesFree\":" + out.RawString(prefix) + out.Uint64(uint64(in.HugePagesFree)) + } + { + const prefix string = ",\"hugePagesRsvd\":" + out.RawString(prefix) + out.Uint64(uint64(in.HugePagesRsvd)) + } + { + const prefix string = ",\"hugePagesSurp\":" + out.RawString(prefix) + out.Uint64(uint64(in.HugePagesSurp)) + } + { + const prefix string = ",\"hugePageSize\":" + out.RawString(prefix) + out.Uint64(uint64(in.HugePageSize)) + } + out.RawByte('}') +} +func easyjsonC80ae7adDecode1(in *jlexer.Lexer, out *struct { + Total uint64 `json:"total"` + Used uint64 `json:"used"` + Free uint64 `json:"free"` + UsedPercent float64 `json:"usedPercent"` + Sin uint64 `json:"sin"` + Sout uint64 `json:"sout"` + PgIn uint64 `json:"pgIn"` + PgOut uint64 `json:"pgOut"` + PgFault uint64 `json:"pgFault"` + PgMajFault uint64 `json:"pgMajFault"` +}) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeFieldName(false) + in.WantColon() + if in.IsNull() { + in.Skip() + in.WantComma() + continue + } + switch key { + case "total": + out.Total = uint64(in.Uint64()) + case "used": + out.Used = uint64(in.Uint64()) + case "free": + out.Free = uint64(in.Uint64()) + case "usedPercent": + out.UsedPercent = float64(in.Float64()) + case "sin": + out.Sin = uint64(in.Uint64()) + case "sout": + out.Sout = uint64(in.Uint64()) + case "pgIn": + out.PgIn = uint64(in.Uint64()) + case "pgOut": + out.PgOut = uint64(in.Uint64()) + case "pgFault": + out.PgFault = uint64(in.Uint64()) + case "pgMajFault": + out.PgMajFault = uint64(in.Uint64()) + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC80ae7adEncode1(out *jwriter.Writer, in struct { + Total uint64 `json:"total"` + Used uint64 `json:"used"` + Free uint64 `json:"free"` + UsedPercent float64 `json:"usedPercent"` + Sin uint64 `json:"sin"` + Sout uint64 `json:"sout"` + PgIn uint64 `json:"pgIn"` + PgOut uint64 `json:"pgOut"` + PgFault uint64 `json:"pgFault"` + PgMajFault uint64 `json:"pgMajFault"` +}) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"total\":" + out.RawString(prefix[1:]) + out.Uint64(uint64(in.Total)) + } + { + const prefix string = ",\"used\":" + out.RawString(prefix) + out.Uint64(uint64(in.Used)) + } + { + const prefix string = ",\"free\":" + out.RawString(prefix) + out.Uint64(uint64(in.Free)) + } + { + const prefix string = ",\"usedPercent\":" + out.RawString(prefix) + out.Float64(float64(in.UsedPercent)) + } + { + const prefix string = ",\"sin\":" + out.RawString(prefix) + out.Uint64(uint64(in.Sin)) + } + { + const prefix string = ",\"sout\":" + out.RawString(prefix) + out.Uint64(uint64(in.Sout)) + } + { + const prefix string = ",\"pgIn\":" + out.RawString(prefix) + out.Uint64(uint64(in.PgIn)) + } + { + const prefix string = ",\"pgOut\":" + out.RawString(prefix) + out.Uint64(uint64(in.PgOut)) + } + { + const prefix string = ",\"pgFault\":" + out.RawString(prefix) + out.Uint64(uint64(in.PgFault)) + } + { + const prefix string = ",\"pgMajFault\":" + out.RawString(prefix) + out.Uint64(uint64(in.PgMajFault)) + } + out.RawByte('}') +} +func easyjsonC80ae7adDecode(in *jlexer.Lexer, out *struct { + Name string `json:"name"` + UsedBytes uint64 `json:"usedBytes"` + FreeBytes uint64 `json:"freeBytes"` +}) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeFieldName(false) + in.WantColon() + if in.IsNull() { + in.Skip() + in.WantComma() + continue + } + switch key { + case "name": + out.Name = string(in.String()) + case "usedBytes": + out.UsedBytes = uint64(in.Uint64()) + case "freeBytes": + out.FreeBytes = uint64(in.Uint64()) + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC80ae7adEncode(out *jwriter.Writer, in struct { + Name string `json:"name"` + UsedBytes uint64 `json:"usedBytes"` + FreeBytes uint64 `json:"freeBytes"` +}) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"name\":" + out.RawString(prefix[1:]) + out.String(string(in.Name)) + } + { + const prefix string = ",\"usedBytes\":" + out.RawString(prefix) + out.Uint64(uint64(in.UsedBytes)) + } + { + const prefix string = ",\"freeBytes\":" + out.RawString(prefix) + out.Uint64(uint64(in.FreeBytes)) + } + out.RawByte('}') +} +func easyjsonC80ae7adDecodeYuiProtoLibrarySystemInfoExport1(in *jlexer.Lexer, out *CpuInfo) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeFieldName(false) + in.WantColon() + if in.IsNull() { + in.Skip() + in.WantComma() + continue + } + switch key { + case "CPU": + if in.IsNull() { + in.Skip() + out.CPU = nil + } else { + in.Delim('[') + if out.CPU == nil { + if !in.IsDelim(']') { + out.CPU = make([]CPUStat, 0, 0) + } else { + out.CPU = []CPUStat{} + } + } else { + out.CPU = (out.CPU)[:0] + } + for !in.IsDelim(']') { + var v4 CPUStat + easyjsonC80ae7adDecodeYuiProtoLibrarySystemInfoExport2(in, &v4) + out.CPU = append(out.CPU, v4) + in.WantComma() + } + in.Delim(']') + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC80ae7adEncodeYuiProtoLibrarySystemInfoExport1(out *jwriter.Writer, in CpuInfo) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"CPU\":" + out.RawString(prefix[1:]) + if in.CPU == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v5, v6 := range in.CPU { + if v5 > 0 { + out.RawByte(',') + } + easyjsonC80ae7adEncodeYuiProtoLibrarySystemInfoExport2(out, v6) + } + out.RawByte(']') + } + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v CpuInfo) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC80ae7adEncodeYuiProtoLibrarySystemInfoExport1(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v CpuInfo) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC80ae7adEncodeYuiProtoLibrarySystemInfoExport1(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *CpuInfo) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC80ae7adDecodeYuiProtoLibrarySystemInfoExport1(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *CpuInfo) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC80ae7adDecodeYuiProtoLibrarySystemInfoExport1(l, v) +} +func easyjsonC80ae7adDecodeYuiProtoLibrarySystemInfoExport2(in *jlexer.Lexer, out *CPUStat) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeFieldName(false) + in.WantColon() + if in.IsNull() { + in.Skip() + in.WantComma() + continue + } + switch key { + case "cpu": + out.CPU = int32(in.Int32()) + case "vendorId": + out.VendorID = string(in.String()) + case "family": + out.Family = string(in.String()) + case "model": + out.Model = string(in.String()) + case "stepping": + out.Stepping = int32(in.Int32()) + case "physicalId": + out.PhysicalID = string(in.String()) + case "coreId": + out.CoreID = string(in.String()) + case "cores": + out.Cores = int32(in.Int32()) + case "modelName": + out.ModelName = string(in.String()) + case "mhz": + out.Mhz = float64(in.Float64()) + case "cacheSize": + out.CacheSize = int32(in.Int32()) + case "flags": + if in.IsNull() { + in.Skip() + out.Flags = nil + } else { + in.Delim('[') + if out.Flags == nil { + if !in.IsDelim(']') { + out.Flags = make([]string, 0, 4) + } else { + out.Flags = []string{} + } + } else { + out.Flags = (out.Flags)[:0] + } + for !in.IsDelim(']') { + var v7 string + v7 = string(in.String()) + out.Flags = append(out.Flags, v7) + in.WantComma() + } + in.Delim(']') + } + case "microcode": + out.Microcode = string(in.String()) + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC80ae7adEncodeYuiProtoLibrarySystemInfoExport2(out *jwriter.Writer, in CPUStat) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"cpu\":" + out.RawString(prefix[1:]) + out.Int32(int32(in.CPU)) + } + { + const prefix string = ",\"vendorId\":" + out.RawString(prefix) + out.String(string(in.VendorID)) + } + { + const prefix string = ",\"family\":" + out.RawString(prefix) + out.String(string(in.Family)) + } + { + const prefix string = ",\"model\":" + out.RawString(prefix) + out.String(string(in.Model)) + } + { + const prefix string = ",\"stepping\":" + out.RawString(prefix) + out.Int32(int32(in.Stepping)) + } + { + const prefix string = ",\"physicalId\":" + out.RawString(prefix) + out.String(string(in.PhysicalID)) + } + { + const prefix string = ",\"coreId\":" + out.RawString(prefix) + out.String(string(in.CoreID)) + } + { + const prefix string = ",\"cores\":" + out.RawString(prefix) + out.Int32(int32(in.Cores)) + } + { + const prefix string = ",\"modelName\":" + out.RawString(prefix) + out.String(string(in.ModelName)) + } + { + const prefix string = ",\"mhz\":" + out.RawString(prefix) + out.Float64(float64(in.Mhz)) + } + { + const prefix string = ",\"cacheSize\":" + out.RawString(prefix) + out.Int32(int32(in.CacheSize)) + } + { + const prefix string = ",\"flags\":" + out.RawString(prefix) + if in.Flags == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v8, v9 := range in.Flags { + if v8 > 0 { + out.RawByte(',') + } + out.String(string(v9)) + } + out.RawByte(']') + } + } + { + const prefix string = ",\"microcode\":" + out.RawString(prefix) + out.String(string(in.Microcode)) + } + out.RawByte('}') +} diff --git a/proto/library/systemInfo/export/systemInfo.pb.go b/proto/library/systemInfo/export/systemInfo.pb.go new file mode 100644 index 0000000..8db66ec --- /dev/null +++ b/proto/library/systemInfo/export/systemInfo.pb.go @@ -0,0 +1,46 @@ +// Code generated by protoc-gen-go-plugin. DO NOT EDIT. +// versions: +// protoc-gen-go-plugin v0.1.0 +// protoc v3.19.4 +// source: proto/library/systemInfo/export/systemInfo.proto + +package export + +import ( + context "context" + emptypb "github.com/knqyf263/go-plugin/types/known/emptypb" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type SystemInfoReply struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` +} + +func (x *SystemInfoReply) ProtoReflect() protoreflect.Message { + panic(`not implemented`) +} + +func (x *SystemInfoReply) GetData() []byte { + if x != nil { + return x.Data + } + return nil +} + +// go:plugin type=host module=systemInfo +type SystemInfo interface { + CpuInfo(context.Context, *emptypb.Empty) (*SystemInfoReply, error) + MemInfo(context.Context, *emptypb.Empty) (*SystemInfoReply, error) +} diff --git a/proto/library/systemInfo/export/systemInfo.proto b/proto/library/systemInfo/export/systemInfo.proto new file mode 100644 index 0000000..70e78b8 --- /dev/null +++ b/proto/library/systemInfo/export/systemInfo.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; +import "google/protobuf/empty.proto"; +package proto; + +option go_package = "Yui/proto/library/systemInfo/export"; + +// go:plugin type=host module=systemInfo +service SystemInfo { + rpc CpuInfo(google.protobuf.Empty) returns (SystemInfoReply) {} + rpc MemInfo(google.protobuf.Empty) returns (SystemInfoReply) {} +} + +message SystemInfoReply { + bytes data = 1; +} diff --git a/proto/library/systemInfo/export/systemInfo_host.pb.go b/proto/library/systemInfo/export/systemInfo_host.pb.go new file mode 100644 index 0000000..71371ab --- /dev/null +++ b/proto/library/systemInfo/export/systemInfo_host.pb.go @@ -0,0 +1,99 @@ +//go:build !tinygo.wasm + +// Code generated by protoc-gen-go-plugin. DO NOT EDIT. +// versions: +// protoc-gen-go-plugin v0.1.0 +// protoc v3.19.4 +// source: proto/library/systemInfo/export/systemInfo.proto + +package export + +import ( + context "context" + emptypb "github.com/knqyf263/go-plugin/types/known/emptypb" + wasm "github.com/knqyf263/go-plugin/wasm" + wazero "github.com/tetratelabs/wazero" + api "github.com/tetratelabs/wazero/api" +) + +const ( + i32 = api.ValueTypeI32 + i64 = api.ValueTypeI64 +) + +type _systemInfo struct { + SystemInfo +} + +// Instantiate a Go-defined module named "systemInfo" that exports host functions. +func Instantiate(ctx context.Context, r wazero.Runtime, hostFunctions SystemInfo) error { + envBuilder := r.NewHostModuleBuilder("systemInfo") + h := _systemInfo{hostFunctions} + + envBuilder.NewFunctionBuilder(). + WithGoModuleFunction(api.GoModuleFunc(h._CpuInfo), []api.ValueType{i32, i32}, []api.ValueType{i64}). + WithParameterNames("offset", "size"). + Export("cpu_info") + + envBuilder.NewFunctionBuilder(). + WithGoModuleFunction(api.GoModuleFunc(h._MemInfo), []api.ValueType{i32, i32}, []api.ValueType{i64}). + WithParameterNames("offset", "size"). + Export("mem_info") + + _, err := envBuilder.Instantiate(ctx) + return err +} + +func (h _systemInfo) _CpuInfo(ctx context.Context, m api.Module, stack []uint64) { + offset, size := uint32(stack[0]), uint32(stack[1]) + buf, err := wasm.ReadMemory(m.Memory(), offset, size) + if err != nil { + panic(err) + } + request := new(emptypb.Empty) + err = request.UnmarshalVT(buf) + if err != nil { + panic(err) + } + resp, err := h.CpuInfo(ctx, request) + if err != nil { + panic(err) + } + buf, err = resp.MarshalVT() + if err != nil { + panic(err) + } + ptr, err := wasm.WriteMemory(ctx, m, buf) + if err != nil { + panic(err) + } + ptrLen := (ptr << uint64(32)) | uint64(len(buf)) + stack[0] = ptrLen +} + +func (h _systemInfo) _MemInfo(ctx context.Context, m api.Module, stack []uint64) { + offset, size := uint32(stack[0]), uint32(stack[1]) + buf, err := wasm.ReadMemory(m.Memory(), offset, size) + if err != nil { + panic(err) + } + request := new(emptypb.Empty) + err = request.UnmarshalVT(buf) + if err != nil { + panic(err) + } + resp, err := h.MemInfo(ctx, request) + if err != nil { + panic(err) + } + buf, err = resp.MarshalVT() + if err != nil { + panic(err) + } + ptr, err := wasm.WriteMemory(ctx, m, buf) + if err != nil { + panic(err) + } + ptrLen := (ptr << uint64(32)) | uint64(len(buf)) + stack[0] = ptrLen +} diff --git a/proto/library/systemInfo/export/systemInfo_plugin.pb.go b/proto/library/systemInfo/export/systemInfo_plugin.pb.go new file mode 100644 index 0000000..b85c182 --- /dev/null +++ b/proto/library/systemInfo/export/systemInfo_plugin.pb.go @@ -0,0 +1,72 @@ +//go:build tinygo.wasm + +// Code generated by protoc-gen-go-plugin. DO NOT EDIT. +// versions: +// protoc-gen-go-plugin v0.1.0 +// protoc v3.19.4 +// source: proto/library/systemInfo/export/systemInfo.proto + +package export + +import ( + context "context" + emptypb "github.com/knqyf263/go-plugin/types/known/emptypb" + wasm "github.com/knqyf263/go-plugin/wasm" + _ "unsafe" +) + +type systemInfo struct{} + +func NewSystemInfo() SystemInfo { + return systemInfo{} +} + +//go:wasm-module systemInfo +//export cpu_info +//go:linkname _cpu_info +func _cpu_info(ptr uint32, size uint32) uint64 + +func (h systemInfo) CpuInfo(ctx context.Context, request *emptypb.Empty) (*SystemInfoReply, error) { + buf, err := request.MarshalVT() + if err != nil { + return nil, err + } + ptr, size := wasm.ByteToPtr(buf) + ptrSize := _cpu_info(ptr, size) + wasm.FreePtr(ptr) + + ptr = uint32(ptrSize >> 32) + size = uint32(ptrSize) + buf = wasm.PtrToByte(ptr, size) + + response := new(SystemInfoReply) + if err = response.UnmarshalVT(buf); err != nil { + return nil, err + } + return response, nil +} + +//go:wasm-module systemInfo +//export mem_info +//go:linkname _mem_info +func _mem_info(ptr uint32, size uint32) uint64 + +func (h systemInfo) MemInfo(ctx context.Context, request *emptypb.Empty) (*SystemInfoReply, error) { + buf, err := request.MarshalVT() + if err != nil { + return nil, err + } + ptr, size := wasm.ByteToPtr(buf) + ptrSize := _mem_info(ptr, size) + wasm.FreePtr(ptr) + + ptr = uint32(ptrSize >> 32) + size = uint32(ptrSize) + buf = wasm.PtrToByte(ptr, size) + + response := new(SystemInfoReply) + if err = response.UnmarshalVT(buf); err != nil { + return nil, err + } + return response, nil +} diff --git a/proto/library/systemInfo/export/systemInfo_vtproto.pb.go b/proto/library/systemInfo/export/systemInfo_vtproto.pb.go new file mode 100644 index 0000000..6e533f4 --- /dev/null +++ b/proto/library/systemInfo/export/systemInfo_vtproto.pb.go @@ -0,0 +1,264 @@ +// Code generated by protoc-gen-go-plugin. DO NOT EDIT. +// versions: +// protoc-gen-go-plugin v0.1.0 +// protoc v3.19.4 +// source: proto/library/systemInfo/export/systemInfo.proto + +package export + +import ( + fmt "fmt" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + bits "math/bits" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +func (m *SystemInfoReply) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SystemInfoReply) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *SystemInfoReply) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarint(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarint(dAtA []byte, offset int, v uint64) int { + offset -= sov(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *SystemInfoReply) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Data) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + if m.unknownFields != nil { + n += len(m.unknownFields) + } + return n +} + +func sov(x uint64) (n int) { + return (bits.Len64(x|1) + 6) / 7 +} +func soz(x uint64) (n int) { + return sov(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *SystemInfoReply) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SystemInfoReply: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SystemInfoReply: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) + if m.Data == nil { + m.Data = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skip(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflow + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflow + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflow + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLength + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroup + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLength + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLength = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflow = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroup = fmt.Errorf("proto: unexpected end of group") +) diff --git a/proto/library/systemInfo/systemInfo.go b/proto/library/systemInfo/systemInfo.go new file mode 100644 index 0000000..7760e54 --- /dev/null +++ b/proto/library/systemInfo/systemInfo.go @@ -0,0 +1,101 @@ +package systemInfo + +import ( + "Yui/plugin/meta" + "Yui/proto/library/systemInfo/export" + "context" + "fmt" + "github.com/knqyf263/go-plugin/types/known/emptypb" + "github.com/shirou/gopsutil/v3/cpu" + "github.com/shirou/gopsutil/v3/mem" +) + +type SystemInfo struct { + PluginInfo meta.PluginMeta +} + +func (s SystemInfo) CpuInfo(ctx context.Context, empty *emptypb.Empty) (*export.SystemInfoReply, error) { + if s.PluginInfo.Permissions&meta.SystemInfoPermission == 0 { + return nil, fmt.Errorf("缺少获取系统信息权限") + } + result, err := cpu.Info() + if err != nil { + return nil, err + } + cpuInfo := make([]export.CPUStat, len(result)) + for i := range result { + cpuInfo[i] = export.CPUStat(result[i]) + } + data, err := (&export.CpuInfo{CPU: cpuInfo}).MarshalJSON() + if err != nil { + return nil, err + } + return &export.SystemInfoReply{Data: data}, nil +} +func (s SystemInfo) MemInfo(ctx context.Context, empty *emptypb.Empty) (*export.SystemInfoReply, error) { + if s.PluginInfo.Permissions&meta.SystemInfoPermission == 0 { + return nil, fmt.Errorf("缺少获取系统信息权限") + } + virtualMemory, err := mem.VirtualMemory() + if err != nil { + return nil, err + } + swapMemory, err := mem.SwapMemory() + if err != nil { + return nil, err + } + data, err := (&export.MemInfo{VirtualMemory: (*struct { + Total uint64 `json:"total"` + Available uint64 `json:"available"` + Used uint64 `json:"used"` + UsedPercent float64 `json:"usedPercent"` + Free uint64 `json:"free"` + Active uint64 `json:"active"` + Inactive uint64 `json:"inactive"` + Wired uint64 `json:"wired"` + Laundry uint64 `json:"laundry"` + Buffers uint64 `json:"buffers"` + Cached uint64 `json:"cached"` + WriteBack uint64 `json:"writeBack"` + Dirty uint64 `json:"dirty"` + WriteBackTmp uint64 `json:"writeBackTmp"` + Shared uint64 `json:"shared"` + Slab uint64 `json:"slab"` + Sreclaimable uint64 `json:"sreclaimable"` + Sunreclaim uint64 `json:"sunreclaim"` + PageTables uint64 `json:"pageTables"` + SwapCached uint64 `json:"swapCached"` + CommitLimit uint64 `json:"commitLimit"` + CommittedAS uint64 `json:"committedAS"` + HighTotal uint64 `json:"highTotal"` + HighFree uint64 `json:"highFree"` + LowTotal uint64 `json:"lowTotal"` + LowFree uint64 `json:"lowFree"` + SwapTotal uint64 `json:"swapTotal"` + SwapFree uint64 `json:"swapFree"` + Mapped uint64 `json:"mapped"` + VmallocTotal uint64 `json:"vmallocTotal"` + VmallocUsed uint64 `json:"vmallocUsed"` + VmallocChunk uint64 `json:"vmallocChunk"` + HugePagesTotal uint64 `json:"hugePagesTotal"` + HugePagesFree uint64 `json:"hugePagesFree"` + HugePagesRsvd uint64 `json:"hugePagesRsvd"` + HugePagesSurp uint64 `json:"hugePagesSurp"` + HugePageSize uint64 `json:"hugePageSize"` + })(virtualMemory), SwapMemory: (*struct { + Total uint64 `json:"total"` + Used uint64 `json:"used"` + Free uint64 `json:"free"` + UsedPercent float64 `json:"usedPercent"` + Sin uint64 `json:"sin"` + Sout uint64 `json:"sout"` + PgIn uint64 `json:"pgIn"` + PgOut uint64 `json:"pgOut"` + PgFault uint64 `json:"pgFault"` + PgMajFault uint64 `json:"pgMajFault"` + })(swapMemory)}).MarshalJSON() + if err != nil { + return nil, err + } + return &export.SystemInfoReply{Data: data}, nil +} diff --git a/proto/opq.pb.go b/proto/opq.pb.go new file mode 100644 index 0000000..d01fc9f --- /dev/null +++ b/proto/opq.pb.go @@ -0,0 +1,834 @@ +// Code generated by protoc-gen-go-plugin. DO NOT EDIT. +// versions: +// protoc-gen-go-plugin v0.1.0 +// protoc v3.19.4 +// source: proto/opq.proto + +package proto + +import ( + context "context" + emptypb "github.com/knqyf263/go-plugin/types/known/emptypb" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type LogType int32 + +const ( + LogType_Debug LogType = 0 + LogType_Info LogType = 1 + LogType_Warn LogType = 2 + LogType_Error LogType = 3 +) + +// Enum value maps for LogType. +var ( + LogType_name = map[int32]string{ + 0: "Debug", + 1: "Info", + 2: "Warn", + 3: "Error", + } + LogType_value = map[string]int32{ + "Debug": 0, + "Info": 1, + "Warn": 2, + "Error": 3, + } +) + +func (x LogType) Enum() *LogType { + p := new(LogType) + *p = x + return p +} + +type HttpMethod int32 + +const ( + HttpMethod_GET HttpMethod = 0 + HttpMethod_POST HttpMethod = 1 + HttpMethod_PUT HttpMethod = 2 + HttpMethod_DELETE HttpMethod = 3 +) + +// Enum value maps for HttpMethod. +var ( + HttpMethod_name = map[int32]string{ + 0: "GET", + 1: "POST", + 2: "PUT", + 3: "DELETE", + } + HttpMethod_value = map[string]int32{ + "GET": 0, + "POST": 1, + "PUT": 2, + "DELETE": 3, + } +) + +func (x HttpMethod) Enum() *HttpMethod { + p := new(HttpMethod) + *p = x + return p +} + +type UploadId int32 + +const ( + UploadId_Group UploadId = 0 + UploadId_Friend UploadId = 1 +) + +// Enum value maps for UploadId. +var ( + UploadId_name = map[int32]string{ + 0: "Group", + 1: "Friend", + } + UploadId_value = map[string]int32{ + "Group": 0, + "Friend": 1, + } +) + +func (x UploadId) Enum() *UploadId { + p := new(UploadId) + *p = x + return p +} + +type RemoteCallReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SrcPluginName string `protobuf:"bytes,1,opt,name=srcPluginName,proto3" json:"srcPluginName,omitempty"` + DstPluginName string `protobuf:"bytes,2,opt,name=dstPluginName,proto3" json:"dstPluginName,omitempty"` + CallPath string `protobuf:"bytes,3,opt,name=callPath,proto3" json:"callPath,omitempty"` + Args []byte `protobuf:"bytes,4,opt,name=args,proto3" json:"args,omitempty"` +} + +func (x *RemoteCallReq) ProtoReflect() protoreflect.Message { + panic(`not implemented`) +} + +func (x *RemoteCallReq) GetSrcPluginName() string { + if x != nil { + return x.SrcPluginName + } + return "" +} + +func (x *RemoteCallReq) GetDstPluginName() string { + if x != nil { + return x.DstPluginName + } + return "" +} + +func (x *RemoteCallReq) GetCallPath() string { + if x != nil { + return x.CallPath + } + return "" +} + +func (x *RemoteCallReq) GetArgs() []byte { + if x != nil { + return x.Args + } + return nil +} + +type RemoteCallReply struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` +} + +func (x *RemoteCallReply) ProtoReflect() protoreflect.Message { + panic(`not implemented`) +} + +func (x *RemoteCallReply) GetData() []byte { + if x != nil { + return x.Data + } + return nil +} + +type CronEventReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *CronEventReq) ProtoReflect() protoreflect.Message { + panic(`not implemented`) +} + +func (x *CronEventReq) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type InitReply struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // 是否初始化成功? + Ok bool `protobuf:"varint,1,opt,name=ok,proto3" json:"ok,omitempty"` + // 初始化失败信息 + Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` +} + +func (x *InitReply) ProtoReflect() protoreflect.Message { + panic(`not implemented`) +} + +func (x *InitReply) GetOk() bool { + if x != nil { + return x.Ok + } + return false +} + +func (x *InitReply) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type CommonMsg struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Time int64 `protobuf:"varint,1,opt,name=time,proto3" json:"time,omitempty"` // 消息发送的时间戳 + SelfId int64 `protobuf:"varint,2,opt,name=selfId,proto3" json:"selfId,omitempty"` // 机器人QQ号 + FromUin int64 `protobuf:"varint,3,opt,name=fromUin,proto3" json:"fromUin,omitempty"` // 消息来源 ID + SenderUin int64 `protobuf:"varint,4,opt,name=senderUin,proto3" json:"senderUin,omitempty"` // 消息来源 ID + Message string `protobuf:"bytes,5,opt,name=message,proto3" json:"message,omitempty"` // 消息内容 + RawMessage []byte `protobuf:"bytes,6,opt,name=rawMessage,proto3" json:"rawMessage,omitempty"` // 原始消息 + MessageId int32 `protobuf:"varint,7,opt,name=messageId,proto3" json:"messageId,omitempty"` // 消息ID + MessageType int32 `protobuf:"varint,8,opt,name=messageType,proto3" json:"messageType,omitempty"` // 消息类型 +} + +func (x *CommonMsg) ProtoReflect() protoreflect.Message { + panic(`not implemented`) +} + +func (x *CommonMsg) GetTime() int64 { + if x != nil { + return x.Time + } + return 0 +} + +func (x *CommonMsg) GetSelfId() int64 { + if x != nil { + return x.SelfId + } + return 0 +} + +func (x *CommonMsg) GetFromUin() int64 { + if x != nil { + return x.FromUin + } + return 0 +} + +func (x *CommonMsg) GetSenderUin() int64 { + if x != nil { + return x.SenderUin + } + return 0 +} + +func (x *CommonMsg) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *CommonMsg) GetRawMessage() []byte { + if x != nil { + return x.RawMessage + } + return nil +} + +func (x *CommonMsg) GetMessageId() int32 { + if x != nil { + return x.MessageId + } + return 0 +} + +func (x *CommonMsg) GetMessageType() int32 { + if x != nil { + return x.MessageType + } + return 0 +} + +type CronJob struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Spec string `protobuf:"bytes,1,opt,name=spec,proto3" json:"spec,omitempty"` + Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *CronJob) ProtoReflect() protoreflect.Message { + panic(`not implemented`) +} + +func (x *CronJob) GetSpec() string { + if x != nil { + return x.Spec + } + return "" +} + +func (x *CronJob) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type LogReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + LogType LogType `protobuf:"varint,1,opt,name=logType,proto3,enum=proto.LogType" json:"logType,omitempty"` + Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"` +} + +func (x *LogReq) ProtoReflect() protoreflect.Message { + panic(`not implemented`) +} + +func (x *LogReq) GetLogType() LogType { + if x != nil { + return x.LogType + } + return LogType_Debug +} + +func (x *LogReq) GetMsg() string { + if x != nil { + return x.Msg + } + return "" +} + +type HttpReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"` + Method HttpMethod `protobuf:"varint,2,opt,name=method,proto3,enum=proto.HttpMethod" json:"method,omitempty"` + Header map[string]string `protobuf:"bytes,3,rep,name=header,proto3" json:"header,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Content []byte `protobuf:"bytes,4,opt,name=content,proto3" json:"content,omitempty"` +} + +func (x *HttpReq) ProtoReflect() protoreflect.Message { + panic(`not implemented`) +} + +func (x *HttpReq) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +func (x *HttpReq) GetMethod() HttpMethod { + if x != nil { + return x.Method + } + return HttpMethod_GET +} + +func (x *HttpReq) GetHeader() map[string]string { + if x != nil { + return x.Header + } + return nil +} + +func (x *HttpReq) GetContent() []byte { + if x != nil { + return x.Content + } + return nil +} + +type HttpRes struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Header string `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + StatusCode int32 `protobuf:"varint,2,opt,name=statusCode,proto3" json:"statusCode,omitempty"` + Content []byte `protobuf:"bytes,3,opt,name=content,proto3" json:"content,omitempty"` +} + +func (x *HttpRes) ProtoReflect() protoreflect.Message { + panic(`not implemented`) +} + +func (x *HttpRes) GetHeader() string { + if x != nil { + return x.Header + } + return "" +} + +func (x *HttpRes) GetStatusCode() int32 { + if x != nil { + return x.StatusCode + } + return 0 +} + +func (x *HttpRes) GetContent() []byte { + if x != nil { + return x.Content + } + return nil +} + +type TextMsg struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Text string `protobuf:"bytes,1,opt,name=text,proto3" json:"text,omitempty"` +} + +func (x *TextMsg) ProtoReflect() protoreflect.Message { + panic(`not implemented`) +} + +func (x *TextMsg) GetText() string { + if x != nil { + return x.Text + } + return "" +} + +type File struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + FileId int64 `protobuf:"varint,1,opt,name=fileId,proto3" json:"fileId,omitempty"` + FileMd5 string `protobuf:"bytes,2,opt,name=fileMd5,proto3" json:"fileMd5,omitempty"` + FileSize int32 `protobuf:"varint,3,opt,name=fileSize,proto3" json:"fileSize,omitempty"` + FileToken string `protobuf:"bytes,4,opt,name=fileToken,proto3" json:"fileToken,omitempty"` +} + +func (x *File) ProtoReflect() protoreflect.Message { + panic(`not implemented`) +} + +func (x *File) GetFileId() int64 { + if x != nil { + return x.FileId + } + return 0 +} + +func (x *File) GetFileMd5() string { + if x != nil { + return x.FileMd5 + } + return "" +} + +func (x *File) GetFileSize() int32 { + if x != nil { + return x.FileSize + } + return 0 +} + +func (x *File) GetFileToken() string { + if x != nil { + return x.FileToken + } + return "" +} + +type Files struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + File []*File `protobuf:"bytes,1,rep,name=file,proto3" json:"file,omitempty"` +} + +func (x *Files) ProtoReflect() protoreflect.Message { + panic(`not implemented`) +} + +func (x *Files) GetFile() []*File { + if x != nil { + return x.File + } + return nil +} + +type JsonMsg struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Json string `protobuf:"bytes,1,opt,name=json,proto3" json:"json,omitempty"` +} + +func (x *JsonMsg) ProtoReflect() protoreflect.Message { + panic(`not implemented`) +} + +func (x *JsonMsg) GetJson() string { + if x != nil { + return x.Json + } + return "" +} + +type XmlMsg struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Xml string `protobuf:"bytes,1,opt,name=xml,proto3" json:"xml,omitempty"` +} + +func (x *XmlMsg) ProtoReflect() protoreflect.Message { + panic(`not implemented`) +} + +func (x *XmlMsg) GetXml() string { + if x != nil { + return x.Xml + } + return "" +} + +type MsgReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ToUin int64 `protobuf:"varint,1,opt,name=toUin,proto3" json:"toUin,omitempty"` + // Types that are assignable to Msg: + // + // *MsgReq_TextMsg + // *MsgReq_PicMsg + // *MsgReq_XmlMsg + // *MsgReq_JsonMsg + Msg isMsgReq_Msg `protobuf_oneof:"msg"` + AtUin []int64 `protobuf:"varint,3,rep,packed,name=atUin,proto3" json:"atUin,omitempty"` + BotUin int64 `protobuf:"varint,4,opt,name=botUin,proto3" json:"botUin,omitempty"` + GroupCode *int64 `protobuf:"varint,9,opt,name=groupCode,proto3,oneof" json:"groupCode,omitempty"` +} + +func (x *MsgReq) ProtoReflect() protoreflect.Message { + panic(`not implemented`) +} + +func (x *MsgReq) GetToUin() int64 { + if x != nil { + return x.ToUin + } + return 0 +} + +func (m *MsgReq) GetMsg() isMsgReq_Msg { + if m != nil { + return m.Msg + } + return nil +} + +func (x *MsgReq) GetTextMsg() *TextMsg { + if x, ok := x.GetMsg().(*MsgReq_TextMsg); ok { + return x.TextMsg + } + return nil +} + +func (x *MsgReq) GetPicMsg() *Files { + if x, ok := x.GetMsg().(*MsgReq_PicMsg); ok { + return x.PicMsg + } + return nil +} + +func (x *MsgReq) GetXmlMsg() *XmlMsg { + if x, ok := x.GetMsg().(*MsgReq_XmlMsg); ok { + return x.XmlMsg + } + return nil +} + +func (x *MsgReq) GetJsonMsg() *JsonMsg { + if x, ok := x.GetMsg().(*MsgReq_JsonMsg); ok { + return x.JsonMsg + } + return nil +} + +func (x *MsgReq) GetAtUin() []int64 { + if x != nil { + return x.AtUin + } + return nil +} + +func (x *MsgReq) GetBotUin() int64 { + if x != nil { + return x.BotUin + } + return 0 +} + +func (x *MsgReq) GetGroupCode() int64 { + if x != nil && x.GroupCode != nil { + return *x.GroupCode + } + return 0 +} + +type isMsgReq_Msg interface { + isMsgReq_Msg() +} + +type MsgReq_TextMsg struct { + TextMsg *TextMsg `protobuf:"bytes,5,opt,name=textMsg,proto3,oneof"` +} + +type MsgReq_PicMsg struct { + PicMsg *Files `protobuf:"bytes,6,opt,name=picMsg,proto3,oneof"` +} + +type MsgReq_XmlMsg struct { + XmlMsg *XmlMsg `protobuf:"bytes,7,opt,name=xmlMsg,proto3,oneof"` +} + +type MsgReq_JsonMsg struct { + JsonMsg *JsonMsg `protobuf:"bytes,8,opt,name=jsonMsg,proto3,oneof"` +} + +func (*MsgReq_TextMsg) isMsgReq_Msg() {} + +func (*MsgReq_PicMsg) isMsgReq_Msg() {} + +func (*MsgReq_XmlMsg) isMsgReq_Msg() {} + +func (*MsgReq_JsonMsg) isMsgReq_Msg() {} + +type SendReply struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Ret int32 `protobuf:"varint,1,opt,name=Ret,proto3" json:"Ret,omitempty"` + ErrMsg *string `protobuf:"bytes,2,opt,name=ErrMsg,proto3,oneof" json:"ErrMsg,omitempty"` +} + +func (x *SendReply) ProtoReflect() protoreflect.Message { + panic(`not implemented`) +} + +func (x *SendReply) GetRet() int32 { + if x != nil { + return x.Ret + } + return 0 +} + +func (x *SendReply) GetErrMsg() string { + if x != nil && x.ErrMsg != nil { + return *x.ErrMsg + } + return "" +} + +type UploadReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to File: + // + // *UploadReq_Path + // *UploadReq_Url + // *UploadReq_Base64Buf + File isUploadReq_File `protobuf_oneof:"file"` + BotUin int64 `protobuf:"varint,4,opt,name=botUin,proto3" json:"botUin,omitempty"` + UploadId UploadId `protobuf:"varint,5,opt,name=uploadId,proto3,enum=proto.UploadId" json:"uploadId,omitempty"` +} + +func (x *UploadReq) ProtoReflect() protoreflect.Message { + panic(`not implemented`) +} + +func (m *UploadReq) GetFile() isUploadReq_File { + if m != nil { + return m.File + } + return nil +} + +func (x *UploadReq) GetPath() string { + if x, ok := x.GetFile().(*UploadReq_Path); ok { + return x.Path + } + return "" +} + +func (x *UploadReq) GetUrl() string { + if x, ok := x.GetFile().(*UploadReq_Url); ok { + return x.Url + } + return "" +} + +func (x *UploadReq) GetBase64Buf() string { + if x, ok := x.GetFile().(*UploadReq_Base64Buf); ok { + return x.Base64Buf + } + return "" +} + +func (x *UploadReq) GetBotUin() int64 { + if x != nil { + return x.BotUin + } + return 0 +} + +func (x *UploadReq) GetUploadId() UploadId { + if x != nil { + return x.UploadId + } + return UploadId_Group +} + +type isUploadReq_File interface { + isUploadReq_File() +} + +type UploadReq_Path struct { + Path string `protobuf:"bytes,1,opt,name=path,proto3,oneof"` +} + +type UploadReq_Url struct { + Url string `protobuf:"bytes,2,opt,name=url,proto3,oneof"` +} + +type UploadReq_Base64Buf struct { + Base64Buf string `protobuf:"bytes,3,opt,name=base64buf,proto3,oneof"` +} + +func (*UploadReq_Path) isUploadReq_File() {} + +func (*UploadReq_Url) isUploadReq_File() {} + +func (*UploadReq_Base64Buf) isUploadReq_File() {} + +type UploadReply struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Ret int32 `protobuf:"varint,1,opt,name=Ret,proto3" json:"Ret,omitempty"` + ErrMsg *string `protobuf:"bytes,2,opt,name=ErrMsg,proto3,oneof" json:"ErrMsg,omitempty"` + File *File `protobuf:"bytes,3,opt,name=file,proto3,oneof" json:"file,omitempty"` +} + +func (x *UploadReply) ProtoReflect() protoreflect.Message { + panic(`not implemented`) +} + +func (x *UploadReply) GetRet() int32 { + if x != nil { + return x.Ret + } + return 0 +} + +func (x *UploadReply) GetErrMsg() string { + if x != nil && x.ErrMsg != nil { + return *x.ErrMsg + } + return "" +} + +func (x *UploadReply) GetFile() *File { + if x != nil { + return x.File + } + return nil +} + +// go:plugin type=plugin version=1 +type Event interface { + // 插件初始化 + Init(context.Context, *emptypb.Empty) (*InitReply, error) + // 群消息 + OnGroupMsg(context.Context, *CommonMsg) (*emptypb.Empty, error) + // 好友消息 + OnFriendMsg(context.Context, *CommonMsg) (*emptypb.Empty, error) + // 私聊消息 + OnPrivateMsg(context.Context, *CommonMsg) (*emptypb.Empty, error) + // 插件卸载 保存资料 最大等待 2s + Unload(context.Context, *emptypb.Empty) (*emptypb.Empty, error) + // 周期任务唤醒 + OnCronEvent(context.Context, *CronEventReq) (*emptypb.Empty, error) + // 其他插件调用本插件事件 + OnRemoteCallEvent(context.Context, *RemoteCallReq) (*RemoteCallReply, error) +} + +// go:plugin type=host +type Api interface { + Log(context.Context, *LogReq) (*emptypb.Empty, error) + Http(context.Context, *HttpReq) (*HttpRes, error) + SendGroupMsg(context.Context, *MsgReq) (*SendReply, error) + SendFriendMsg(context.Context, *MsgReq) (*SendReply, error) + SendPrivateMsg(context.Context, *MsgReq) (*SendReply, error) + Upload(context.Context, *UploadReq) (*UploadReply, error) + RegisterCronJob(context.Context, *CronJob) (*emptypb.Empty, error) + RemoveCronJob(context.Context, *CronJob) (*emptypb.Empty, error) + // 调用其他插件功能 + RemoteCall(context.Context, *RemoteCallReq) (*RemoteCallReply, error) +} diff --git a/proto/opq.proto b/proto/opq.proto new file mode 100644 index 0000000..91a8e7c --- /dev/null +++ b/proto/opq.proto @@ -0,0 +1,157 @@ +syntax = "proto3"; +import "google/protobuf/empty.proto"; +package proto; + +option go_package = "Yui/proto"; + +// go:plugin type=plugin version=1 +service Event { + // 插件初始化 + rpc Init(google.protobuf.Empty) returns (InitReply) {} + // 群消息 + rpc OnGroupMsg(CommonMsg) returns (google.protobuf.Empty) {} + // 好友消息 + rpc OnFriendMsg(CommonMsg) returns (google.protobuf.Empty) {} + // 私聊消息 + rpc OnPrivateMsg(CommonMsg) returns (google.protobuf.Empty) {} + // 插件卸载 保存资料 最大等待 2s + rpc Unload(google.protobuf.Empty) returns (google.protobuf.Empty) {} + // 周期任务唤醒 + rpc OnCronEvent(CronEventReq) returns (google.protobuf.Empty) {} + // 其他插件调用本插件事件 + rpc OnRemoteCallEvent(RemoteCallReq) returns (RemoteCallReply) {} +} +message RemoteCallReq { + string srcPluginName = 1; + string dstPluginName = 2; + string callPath = 3; + bytes args = 4; +} +message RemoteCallReply { + bytes data = 1; +} +message CronEventReq { + string id = 1; +} + +message InitReply { + // 是否初始化成功? + bool ok = 1; + // 初始化失败信息 + string message = 2; +} + +message CommonMsg { + int64 time = 1; // 消息发送的时间戳 + int64 selfId = 2; // 机器人QQ号 + int64 fromUin = 3; // 消息来源 ID + int64 senderUin = 4; // 消息来源 ID + string message = 5; // 消息内容 + bytes rawMessage =6; // 原始消息 + int32 messageId = 7; // 消息ID + int32 messageType = 8; // 消息类型 +} + +enum LogType //枚举消息类型 +{ + Debug = 0; + Info = 1; + Warn =2; + Error = 3; +} +enum HttpMethod //Http请求类型 +{ + GET = 0; + POST = 1; + PUT =2; + DELETE = 3; +} +enum UploadId +{ + Group = 0; + Friend = 1; +} +// go:plugin type=host +service Api { + rpc Log(LogReq) returns (google.protobuf.Empty){} + rpc Http(HttpReq) returns (HttpRes){} + rpc SendGroupMsg(MsgReq) returns (SendReply){} + rpc SendFriendMsg(MsgReq) returns (SendReply){} + rpc SendPrivateMsg(MsgReq) returns (SendReply){} + rpc Upload(UploadReq) returns (UploadReply){} + rpc RegisterCronJob(CronJob) returns (google.protobuf.Empty) {} + rpc RemoveCronJob(CronJob) returns (google.protobuf.Empty) {} + // 调用其他插件功能 + rpc RemoteCall(RemoteCallReq) returns (RemoteCallReply) {} +} + +message CronJob { + string spec = 1; + string id = 2; +} +message LogReq{ + LogType logType = 1; + string msg = 2; +} + +message HttpReq{ + string url = 1; + HttpMethod method = 2; + map header = 3; + bytes content = 4; +} +message HttpRes{ + string header = 1; + int32 statusCode = 2; + bytes content = 3; +} +message TextMsg { + string text = 1; +} +message File{ + int64 fileId = 1; + string fileMd5 = 2; + int32 fileSize = 3; + string fileToken = 4; +} +message Files { + repeated File file = 1; + +} +message JsonMsg { + string json = 1; +} +message XmlMsg { + string xml = 1; +} +message MsgReq { + int64 toUin = 1; + oneof msg { + TextMsg textMsg = 5; + Files picMsg = 6; + XmlMsg xmlMsg = 7; + JsonMsg jsonMsg = 8; + } + repeated int64 atUin = 3; + int64 botUin = 4; + optional int64 groupCode =9; +} +message SendReply{ + int32 Ret = 1; + optional string ErrMsg = 2; +} + +message UploadReq{ + oneof file { + string path = 1; + string url = 2; + string base64buf = 3; + } + int64 botUin = 4; + UploadId uploadId = 5; +} +message UploadReply{ + int32 Ret = 1; + optional string ErrMsg = 2; + optional File file = 3; +} \ No newline at end of file diff --git a/proto/opq_host.pb.go b/proto/opq_host.pb.go new file mode 100644 index 0000000..4e699a9 --- /dev/null +++ b/proto/opq_host.pb.go @@ -0,0 +1,904 @@ +//go:build !tinygo.wasm + +// Code generated by protoc-gen-go-plugin. DO NOT EDIT. +// versions: +// protoc-gen-go-plugin v0.1.0 +// protoc v3.19.4 +// source: proto/opq.proto + +package proto + +import ( + context "context" + errors "errors" + fmt "fmt" + emptypb "github.com/knqyf263/go-plugin/types/known/emptypb" + wasm "github.com/knqyf263/go-plugin/wasm" + wazero "github.com/tetratelabs/wazero" + api "github.com/tetratelabs/wazero/api" + sys "github.com/tetratelabs/wazero/sys" +) + +const ( + i32 = api.ValueTypeI32 + i64 = api.ValueTypeI64 +) + +type _api struct { + Api +} + +// Instantiate a Go-defined module named "env" that exports host functions. +func (h _api) Instantiate(ctx context.Context, r wazero.Runtime) error { + envBuilder := r.NewHostModuleBuilder("env") + + envBuilder.NewFunctionBuilder(). + WithGoModuleFunction(api.GoModuleFunc(h._Log), []api.ValueType{i32, i32}, []api.ValueType{i64}). + WithParameterNames("offset", "size"). + Export("log") + + envBuilder.NewFunctionBuilder(). + WithGoModuleFunction(api.GoModuleFunc(h._Http), []api.ValueType{i32, i32}, []api.ValueType{i64}). + WithParameterNames("offset", "size"). + Export("http") + + envBuilder.NewFunctionBuilder(). + WithGoModuleFunction(api.GoModuleFunc(h._SendGroupMsg), []api.ValueType{i32, i32}, []api.ValueType{i64}). + WithParameterNames("offset", "size"). + Export("send_group_msg") + + envBuilder.NewFunctionBuilder(). + WithGoModuleFunction(api.GoModuleFunc(h._SendFriendMsg), []api.ValueType{i32, i32}, []api.ValueType{i64}). + WithParameterNames("offset", "size"). + Export("send_friend_msg") + + envBuilder.NewFunctionBuilder(). + WithGoModuleFunction(api.GoModuleFunc(h._SendPrivateMsg), []api.ValueType{i32, i32}, []api.ValueType{i64}). + WithParameterNames("offset", "size"). + Export("send_private_msg") + + envBuilder.NewFunctionBuilder(). + WithGoModuleFunction(api.GoModuleFunc(h._Upload), []api.ValueType{i32, i32}, []api.ValueType{i64}). + WithParameterNames("offset", "size"). + Export("upload") + + envBuilder.NewFunctionBuilder(). + WithGoModuleFunction(api.GoModuleFunc(h._RegisterCronJob), []api.ValueType{i32, i32}, []api.ValueType{i64}). + WithParameterNames("offset", "size"). + Export("register_cron_job") + + envBuilder.NewFunctionBuilder(). + WithGoModuleFunction(api.GoModuleFunc(h._RemoveCronJob), []api.ValueType{i32, i32}, []api.ValueType{i64}). + WithParameterNames("offset", "size"). + Export("remove_cron_job") + + envBuilder.NewFunctionBuilder(). + WithGoModuleFunction(api.GoModuleFunc(h._RemoteCall), []api.ValueType{i32, i32}, []api.ValueType{i64}). + WithParameterNames("offset", "size"). + Export("remote_call") + + _, err := envBuilder.Instantiate(ctx) + return err +} + +func (h _api) _Log(ctx context.Context, m api.Module, stack []uint64) { + offset, size := uint32(stack[0]), uint32(stack[1]) + buf, err := wasm.ReadMemory(m.Memory(), offset, size) + if err != nil { + panic(err) + } + request := new(LogReq) + err = request.UnmarshalVT(buf) + if err != nil { + panic(err) + } + resp, err := h.Log(ctx, request) + if err != nil { + panic(err) + } + buf, err = resp.MarshalVT() + if err != nil { + panic(err) + } + ptr, err := wasm.WriteMemory(ctx, m, buf) + if err != nil { + panic(err) + } + ptrLen := (ptr << uint64(32)) | uint64(len(buf)) + stack[0] = ptrLen +} + +func (h _api) _Http(ctx context.Context, m api.Module, stack []uint64) { + offset, size := uint32(stack[0]), uint32(stack[1]) + buf, err := wasm.ReadMemory(m.Memory(), offset, size) + if err != nil { + panic(err) + } + request := new(HttpReq) + err = request.UnmarshalVT(buf) + if err != nil { + panic(err) + } + resp, err := h.Http(ctx, request) + if err != nil { + panic(err) + } + buf, err = resp.MarshalVT() + if err != nil { + panic(err) + } + ptr, err := wasm.WriteMemory(ctx, m, buf) + if err != nil { + panic(err) + } + ptrLen := (ptr << uint64(32)) | uint64(len(buf)) + stack[0] = ptrLen +} + +func (h _api) _SendGroupMsg(ctx context.Context, m api.Module, stack []uint64) { + offset, size := uint32(stack[0]), uint32(stack[1]) + buf, err := wasm.ReadMemory(m.Memory(), offset, size) + if err != nil { + panic(err) + } + request := new(MsgReq) + err = request.UnmarshalVT(buf) + if err != nil { + panic(err) + } + resp, err := h.SendGroupMsg(ctx, request) + if err != nil { + panic(err) + } + buf, err = resp.MarshalVT() + if err != nil { + panic(err) + } + ptr, err := wasm.WriteMemory(ctx, m, buf) + if err != nil { + panic(err) + } + ptrLen := (ptr << uint64(32)) | uint64(len(buf)) + stack[0] = ptrLen +} + +func (h _api) _SendFriendMsg(ctx context.Context, m api.Module, stack []uint64) { + offset, size := uint32(stack[0]), uint32(stack[1]) + buf, err := wasm.ReadMemory(m.Memory(), offset, size) + if err != nil { + panic(err) + } + request := new(MsgReq) + err = request.UnmarshalVT(buf) + if err != nil { + panic(err) + } + resp, err := h.SendFriendMsg(ctx, request) + if err != nil { + panic(err) + } + buf, err = resp.MarshalVT() + if err != nil { + panic(err) + } + ptr, err := wasm.WriteMemory(ctx, m, buf) + if err != nil { + panic(err) + } + ptrLen := (ptr << uint64(32)) | uint64(len(buf)) + stack[0] = ptrLen +} + +func (h _api) _SendPrivateMsg(ctx context.Context, m api.Module, stack []uint64) { + offset, size := uint32(stack[0]), uint32(stack[1]) + buf, err := wasm.ReadMemory(m.Memory(), offset, size) + if err != nil { + panic(err) + } + request := new(MsgReq) + err = request.UnmarshalVT(buf) + if err != nil { + panic(err) + } + resp, err := h.SendPrivateMsg(ctx, request) + if err != nil { + panic(err) + } + buf, err = resp.MarshalVT() + if err != nil { + panic(err) + } + ptr, err := wasm.WriteMemory(ctx, m, buf) + if err != nil { + panic(err) + } + ptrLen := (ptr << uint64(32)) | uint64(len(buf)) + stack[0] = ptrLen +} + +func (h _api) _Upload(ctx context.Context, m api.Module, stack []uint64) { + offset, size := uint32(stack[0]), uint32(stack[1]) + buf, err := wasm.ReadMemory(m.Memory(), offset, size) + if err != nil { + panic(err) + } + request := new(UploadReq) + err = request.UnmarshalVT(buf) + if err != nil { + panic(err) + } + resp, err := h.Upload(ctx, request) + if err != nil { + panic(err) + } + buf, err = resp.MarshalVT() + if err != nil { + panic(err) + } + ptr, err := wasm.WriteMemory(ctx, m, buf) + if err != nil { + panic(err) + } + ptrLen := (ptr << uint64(32)) | uint64(len(buf)) + stack[0] = ptrLen +} + +func (h _api) _RegisterCronJob(ctx context.Context, m api.Module, stack []uint64) { + offset, size := uint32(stack[0]), uint32(stack[1]) + buf, err := wasm.ReadMemory(m.Memory(), offset, size) + if err != nil { + panic(err) + } + request := new(CronJob) + err = request.UnmarshalVT(buf) + if err != nil { + panic(err) + } + resp, err := h.RegisterCronJob(ctx, request) + if err != nil { + panic(err) + } + buf, err = resp.MarshalVT() + if err != nil { + panic(err) + } + ptr, err := wasm.WriteMemory(ctx, m, buf) + if err != nil { + panic(err) + } + ptrLen := (ptr << uint64(32)) | uint64(len(buf)) + stack[0] = ptrLen +} + +func (h _api) _RemoveCronJob(ctx context.Context, m api.Module, stack []uint64) { + offset, size := uint32(stack[0]), uint32(stack[1]) + buf, err := wasm.ReadMemory(m.Memory(), offset, size) + if err != nil { + panic(err) + } + request := new(CronJob) + err = request.UnmarshalVT(buf) + if err != nil { + panic(err) + } + resp, err := h.RemoveCronJob(ctx, request) + if err != nil { + panic(err) + } + buf, err = resp.MarshalVT() + if err != nil { + panic(err) + } + ptr, err := wasm.WriteMemory(ctx, m, buf) + if err != nil { + panic(err) + } + ptrLen := (ptr << uint64(32)) | uint64(len(buf)) + stack[0] = ptrLen +} + +// 调用其他插件功能 + +func (h _api) _RemoteCall(ctx context.Context, m api.Module, stack []uint64) { + offset, size := uint32(stack[0]), uint32(stack[1]) + buf, err := wasm.ReadMemory(m.Memory(), offset, size) + if err != nil { + panic(err) + } + request := new(RemoteCallReq) + err = request.UnmarshalVT(buf) + if err != nil { + panic(err) + } + resp, err := h.RemoteCall(ctx, request) + if err != nil { + panic(err) + } + buf, err = resp.MarshalVT() + if err != nil { + panic(err) + } + ptr, err := wasm.WriteMemory(ctx, m, buf) + if err != nil { + panic(err) + } + ptrLen := (ptr << uint64(32)) | uint64(len(buf)) + stack[0] = ptrLen +} + +const EventPluginAPIVersion = 1 + +type EventPlugin struct { + newRuntime func(context.Context) (wazero.Runtime, error) + moduleConfig wazero.ModuleConfig +} + +func NewEventPlugin(ctx context.Context, opts ...wazeroConfigOption) (*EventPlugin, error) { + o := &WazeroConfig{ + newRuntime: DefaultWazeroRuntime(), + moduleConfig: wazero.NewModuleConfig(), + } + + for _, opt := range opts { + opt(o) + } + + return &EventPlugin{ + newRuntime: o.newRuntime, + moduleConfig: o.moduleConfig, + }, nil +} + +type event interface { + Close(ctx context.Context) error + Event +} + +func (p *EventPlugin) LoadWithBytes(ctx context.Context, b []byte, hostFunctions Api) (event, error) { + + // Create a new runtime so that multiple modules will not conflict + r, err := p.newRuntime(ctx) + if err != nil { + return nil, err + } + + h := _api{hostFunctions} + + if err := h.Instantiate(ctx, r); err != nil { + return nil, err + } + + // Compile the WebAssembly module using the default configuration. + code, err := r.CompileModule(ctx, b) + if err != nil { + return nil, err + } + + // InstantiateModule runs the "_start" function, WASI's "main". + module, err := r.InstantiateModule(ctx, code, p.moduleConfig) + if err != nil { + // Note: Most compilers do not exit the module after running "_start", + // unless there was an Error. This allows you to call exported functions. + if exitErr, ok := err.(*sys.ExitError); ok && exitErr.ExitCode() != 0 { + return nil, fmt.Errorf("unexpected exit_code: %d", exitErr.ExitCode()) + } else if !ok { + return nil, err + } + } + + // Compare API versions with the loading plugin + apiVersion := module.ExportedFunction("event_api_version") + if apiVersion == nil { + return nil, errors.New("event_api_version is not exported") + } + results, err := apiVersion.Call(ctx) + if err != nil { + return nil, err + } else if len(results) != 1 { + return nil, errors.New("invalid event_api_version signature") + } + if results[0] != EventPluginAPIVersion { + return nil, fmt.Errorf("API version mismatch, host: %d, plugin: %d", EventPluginAPIVersion, results[0]) + } + + init := module.ExportedFunction("event_init") + if init == nil { + return nil, errors.New("event_init is not exported") + } + ongroupmsg := module.ExportedFunction("event_on_group_msg") + if ongroupmsg == nil { + return nil, errors.New("event_on_group_msg is not exported") + } + onfriendmsg := module.ExportedFunction("event_on_friend_msg") + if onfriendmsg == nil { + return nil, errors.New("event_on_friend_msg is not exported") + } + onprivatemsg := module.ExportedFunction("event_on_private_msg") + if onprivatemsg == nil { + return nil, errors.New("event_on_private_msg is not exported") + } + unload := module.ExportedFunction("event_unload") + if unload == nil { + return nil, errors.New("event_unload is not exported") + } + oncronevent := module.ExportedFunction("event_on_cron_event") + if oncronevent == nil { + return nil, errors.New("event_on_cron_event is not exported") + } + onremotecallevent := module.ExportedFunction("event_on_remote_call_event") + if onremotecallevent == nil { + return nil, errors.New("event_on_remote_call_event is not exported") + } + + malloc := module.ExportedFunction("malloc") + if malloc == nil { + return nil, errors.New("malloc is not exported") + } + + free := module.ExportedFunction("free") + if free == nil { + return nil, errors.New("free is not exported") + } + return &eventPlugin{ + runtime: r, + module: module, + malloc: malloc, + free: free, + init: init, + ongroupmsg: ongroupmsg, + onfriendmsg: onfriendmsg, + onprivatemsg: onprivatemsg, + unload: unload, + oncronevent: oncronevent, + onremotecallevent: onremotecallevent, + }, nil +} + +func (p *eventPlugin) Close(ctx context.Context) (err error) { + if r := p.runtime; r != nil { + r.Close(ctx) + } + return +} + +type eventPlugin struct { + runtime wazero.Runtime + module api.Module + malloc api.Function + free api.Function + init api.Function + ongroupmsg api.Function + onfriendmsg api.Function + onprivatemsg api.Function + unload api.Function + oncronevent api.Function + onremotecallevent api.Function +} + +func (p *eventPlugin) Init(ctx context.Context, request *emptypb.Empty) (*InitReply, error) { + data, err := request.MarshalVT() + if err != nil { + return nil, err + } + dataSize := uint64(len(data)) + + var dataPtr uint64 + // If the input data is not empty, we must allocate the in-Wasm memory to store it, and pass to the plugin. + if dataSize != 0 { + results, err := p.malloc.Call(ctx, dataSize) + if err != nil { + return nil, err + } + dataPtr = results[0] + // This pointer is managed by TinyGo, but TinyGo is unaware of external usage. + // So, we have to free it when finished + defer p.free.Call(ctx, dataPtr) + + // The pointer is a linear memory offset, which is where we write the name. + if !p.module.Memory().Write(uint32(dataPtr), data) { + return nil, fmt.Errorf("Memory.Write(%d, %d) out of range of memory size %d", dataPtr, dataSize, p.module.Memory().Size()) + } + } + + ptrSize, err := p.init.Call(ctx, dataPtr, dataSize) + if err != nil { + return nil, err + } + + resPtr := uint32(ptrSize[0] >> 32) + resSize := uint32(ptrSize[0]) + var isErrResponse bool + if (resSize & (1 << 31)) > 0 { + isErrResponse = true + resSize &^= (1 << 31) + } + + // We don't need the memory after deserialization: make sure it is freed. + if resPtr != 0 { + defer p.free.Call(ctx, uint64(resPtr)) + } + + // The pointer is a linear memory offset, which is where we write the name. + bytes, ok := p.module.Memory().Read(resPtr, resSize) + if !ok { + return nil, fmt.Errorf("Memory.Read(%d, %d) out of range of memory size %d", + resPtr, resSize, p.module.Memory().Size()) + } + + if isErrResponse { + return nil, errors.New(string(bytes)) + } + + response := new(InitReply) + if err = response.UnmarshalVT(bytes); err != nil { + return nil, err + } + + return response, nil +} +func (p *eventPlugin) OnGroupMsg(ctx context.Context, request *CommonMsg) (*emptypb.Empty, error) { + data, err := request.MarshalVT() + if err != nil { + return nil, err + } + dataSize := uint64(len(data)) + + var dataPtr uint64 + // If the input data is not empty, we must allocate the in-Wasm memory to store it, and pass to the plugin. + if dataSize != 0 { + results, err := p.malloc.Call(ctx, dataSize) + if err != nil { + return nil, err + } + dataPtr = results[0] + // This pointer is managed by TinyGo, but TinyGo is unaware of external usage. + // So, we have to free it when finished + defer p.free.Call(ctx, dataPtr) + + // The pointer is a linear memory offset, which is where we write the name. + if !p.module.Memory().Write(uint32(dataPtr), data) { + return nil, fmt.Errorf("Memory.Write(%d, %d) out of range of memory size %d", dataPtr, dataSize, p.module.Memory().Size()) + } + } + + ptrSize, err := p.ongroupmsg.Call(ctx, dataPtr, dataSize) + if err != nil { + return nil, err + } + + resPtr := uint32(ptrSize[0] >> 32) + resSize := uint32(ptrSize[0]) + var isErrResponse bool + if (resSize & (1 << 31)) > 0 { + isErrResponse = true + resSize &^= (1 << 31) + } + + // We don't need the memory after deserialization: make sure it is freed. + if resPtr != 0 { + defer p.free.Call(ctx, uint64(resPtr)) + } + + // The pointer is a linear memory offset, which is where we write the name. + bytes, ok := p.module.Memory().Read(resPtr, resSize) + if !ok { + return nil, fmt.Errorf("Memory.Read(%d, %d) out of range of memory size %d", + resPtr, resSize, p.module.Memory().Size()) + } + + if isErrResponse { + return nil, errors.New(string(bytes)) + } + + response := new(emptypb.Empty) + if err = response.UnmarshalVT(bytes); err != nil { + return nil, err + } + + return response, nil +} +func (p *eventPlugin) OnFriendMsg(ctx context.Context, request *CommonMsg) (*emptypb.Empty, error) { + data, err := request.MarshalVT() + if err != nil { + return nil, err + } + dataSize := uint64(len(data)) + + var dataPtr uint64 + // If the input data is not empty, we must allocate the in-Wasm memory to store it, and pass to the plugin. + if dataSize != 0 { + results, err := p.malloc.Call(ctx, dataSize) + if err != nil { + return nil, err + } + dataPtr = results[0] + // This pointer is managed by TinyGo, but TinyGo is unaware of external usage. + // So, we have to free it when finished + defer p.free.Call(ctx, dataPtr) + + // The pointer is a linear memory offset, which is where we write the name. + if !p.module.Memory().Write(uint32(dataPtr), data) { + return nil, fmt.Errorf("Memory.Write(%d, %d) out of range of memory size %d", dataPtr, dataSize, p.module.Memory().Size()) + } + } + + ptrSize, err := p.onfriendmsg.Call(ctx, dataPtr, dataSize) + if err != nil { + return nil, err + } + + resPtr := uint32(ptrSize[0] >> 32) + resSize := uint32(ptrSize[0]) + var isErrResponse bool + if (resSize & (1 << 31)) > 0 { + isErrResponse = true + resSize &^= (1 << 31) + } + + // We don't need the memory after deserialization: make sure it is freed. + if resPtr != 0 { + defer p.free.Call(ctx, uint64(resPtr)) + } + + // The pointer is a linear memory offset, which is where we write the name. + bytes, ok := p.module.Memory().Read(resPtr, resSize) + if !ok { + return nil, fmt.Errorf("Memory.Read(%d, %d) out of range of memory size %d", + resPtr, resSize, p.module.Memory().Size()) + } + + if isErrResponse { + return nil, errors.New(string(bytes)) + } + + response := new(emptypb.Empty) + if err = response.UnmarshalVT(bytes); err != nil { + return nil, err + } + + return response, nil +} +func (p *eventPlugin) OnPrivateMsg(ctx context.Context, request *CommonMsg) (*emptypb.Empty, error) { + data, err := request.MarshalVT() + if err != nil { + return nil, err + } + dataSize := uint64(len(data)) + + var dataPtr uint64 + // If the input data is not empty, we must allocate the in-Wasm memory to store it, and pass to the plugin. + if dataSize != 0 { + results, err := p.malloc.Call(ctx, dataSize) + if err != nil { + return nil, err + } + dataPtr = results[0] + // This pointer is managed by TinyGo, but TinyGo is unaware of external usage. + // So, we have to free it when finished + defer p.free.Call(ctx, dataPtr) + + // The pointer is a linear memory offset, which is where we write the name. + if !p.module.Memory().Write(uint32(dataPtr), data) { + return nil, fmt.Errorf("Memory.Write(%d, %d) out of range of memory size %d", dataPtr, dataSize, p.module.Memory().Size()) + } + } + + ptrSize, err := p.onprivatemsg.Call(ctx, dataPtr, dataSize) + if err != nil { + return nil, err + } + + resPtr := uint32(ptrSize[0] >> 32) + resSize := uint32(ptrSize[0]) + var isErrResponse bool + if (resSize & (1 << 31)) > 0 { + isErrResponse = true + resSize &^= (1 << 31) + } + + // We don't need the memory after deserialization: make sure it is freed. + if resPtr != 0 { + defer p.free.Call(ctx, uint64(resPtr)) + } + + // The pointer is a linear memory offset, which is where we write the name. + bytes, ok := p.module.Memory().Read(resPtr, resSize) + if !ok { + return nil, fmt.Errorf("Memory.Read(%d, %d) out of range of memory size %d", + resPtr, resSize, p.module.Memory().Size()) + } + + if isErrResponse { + return nil, errors.New(string(bytes)) + } + + response := new(emptypb.Empty) + if err = response.UnmarshalVT(bytes); err != nil { + return nil, err + } + + return response, nil +} +func (p *eventPlugin) Unload(ctx context.Context, request *emptypb.Empty) (*emptypb.Empty, error) { + data, err := request.MarshalVT() + if err != nil { + return nil, err + } + dataSize := uint64(len(data)) + + var dataPtr uint64 + // If the input data is not empty, we must allocate the in-Wasm memory to store it, and pass to the plugin. + if dataSize != 0 { + results, err := p.malloc.Call(ctx, dataSize) + if err != nil { + return nil, err + } + dataPtr = results[0] + // This pointer is managed by TinyGo, but TinyGo is unaware of external usage. + // So, we have to free it when finished + defer p.free.Call(ctx, dataPtr) + + // The pointer is a linear memory offset, which is where we write the name. + if !p.module.Memory().Write(uint32(dataPtr), data) { + return nil, fmt.Errorf("Memory.Write(%d, %d) out of range of memory size %d", dataPtr, dataSize, p.module.Memory().Size()) + } + } + + ptrSize, err := p.unload.Call(ctx, dataPtr, dataSize) + if err != nil { + return nil, err + } + + resPtr := uint32(ptrSize[0] >> 32) + resSize := uint32(ptrSize[0]) + var isErrResponse bool + if (resSize & (1 << 31)) > 0 { + isErrResponse = true + resSize &^= (1 << 31) + } + + // We don't need the memory after deserialization: make sure it is freed. + if resPtr != 0 { + defer p.free.Call(ctx, uint64(resPtr)) + } + + // The pointer is a linear memory offset, which is where we write the name. + bytes, ok := p.module.Memory().Read(resPtr, resSize) + if !ok { + return nil, fmt.Errorf("Memory.Read(%d, %d) out of range of memory size %d", + resPtr, resSize, p.module.Memory().Size()) + } + + if isErrResponse { + return nil, errors.New(string(bytes)) + } + + response := new(emptypb.Empty) + if err = response.UnmarshalVT(bytes); err != nil { + return nil, err + } + + return response, nil +} +func (p *eventPlugin) OnCronEvent(ctx context.Context, request *CronEventReq) (*emptypb.Empty, error) { + data, err := request.MarshalVT() + if err != nil { + return nil, err + } + dataSize := uint64(len(data)) + + var dataPtr uint64 + // If the input data is not empty, we must allocate the in-Wasm memory to store it, and pass to the plugin. + if dataSize != 0 { + results, err := p.malloc.Call(ctx, dataSize) + if err != nil { + return nil, err + } + dataPtr = results[0] + // This pointer is managed by TinyGo, but TinyGo is unaware of external usage. + // So, we have to free it when finished + defer p.free.Call(ctx, dataPtr) + + // The pointer is a linear memory offset, which is where we write the name. + if !p.module.Memory().Write(uint32(dataPtr), data) { + return nil, fmt.Errorf("Memory.Write(%d, %d) out of range of memory size %d", dataPtr, dataSize, p.module.Memory().Size()) + } + } + + ptrSize, err := p.oncronevent.Call(ctx, dataPtr, dataSize) + if err != nil { + return nil, err + } + + resPtr := uint32(ptrSize[0] >> 32) + resSize := uint32(ptrSize[0]) + var isErrResponse bool + if (resSize & (1 << 31)) > 0 { + isErrResponse = true + resSize &^= (1 << 31) + } + + // We don't need the memory after deserialization: make sure it is freed. + if resPtr != 0 { + defer p.free.Call(ctx, uint64(resPtr)) + } + + // The pointer is a linear memory offset, which is where we write the name. + bytes, ok := p.module.Memory().Read(resPtr, resSize) + if !ok { + return nil, fmt.Errorf("Memory.Read(%d, %d) out of range of memory size %d", + resPtr, resSize, p.module.Memory().Size()) + } + + if isErrResponse { + return nil, errors.New(string(bytes)) + } + + response := new(emptypb.Empty) + if err = response.UnmarshalVT(bytes); err != nil { + return nil, err + } + + return response, nil +} +func (p *eventPlugin) OnRemoteCallEvent(ctx context.Context, request *RemoteCallReq) (*RemoteCallReply, error) { + data, err := request.MarshalVT() + if err != nil { + return nil, err + } + dataSize := uint64(len(data)) + + var dataPtr uint64 + // If the input data is not empty, we must allocate the in-Wasm memory to store it, and pass to the plugin. + if dataSize != 0 { + results, err := p.malloc.Call(ctx, dataSize) + if err != nil { + return nil, err + } + dataPtr = results[0] + // This pointer is managed by TinyGo, but TinyGo is unaware of external usage. + // So, we have to free it when finished + defer p.free.Call(ctx, dataPtr) + + // The pointer is a linear memory offset, which is where we write the name. + if !p.module.Memory().Write(uint32(dataPtr), data) { + return nil, fmt.Errorf("Memory.Write(%d, %d) out of range of memory size %d", dataPtr, dataSize, p.module.Memory().Size()) + } + } + + ptrSize, err := p.onremotecallevent.Call(ctx, dataPtr, dataSize) + if err != nil { + return nil, err + } + + resPtr := uint32(ptrSize[0] >> 32) + resSize := uint32(ptrSize[0]) + var isErrResponse bool + if (resSize & (1 << 31)) > 0 { + isErrResponse = true + resSize &^= (1 << 31) + } + + // We don't need the memory after deserialization: make sure it is freed. + if resPtr != 0 { + defer p.free.Call(ctx, uint64(resPtr)) + } + + // The pointer is a linear memory offset, which is where we write the name. + bytes, ok := p.module.Memory().Read(resPtr, resSize) + if !ok { + return nil, fmt.Errorf("Memory.Read(%d, %d) out of range of memory size %d", + resPtr, resSize, p.module.Memory().Size()) + } + + if isErrResponse { + return nil, errors.New(string(bytes)) + } + + response := new(RemoteCallReply) + if err = response.UnmarshalVT(bytes); err != nil { + return nil, err + } + + return response, nil +} diff --git a/proto/opq_options.pb.go b/proto/opq_options.pb.go new file mode 100644 index 0000000..0027a8b --- /dev/null +++ b/proto/opq_options.pb.go @@ -0,0 +1,47 @@ +//go:build !tinygo.wasm + +// Code generated by protoc-gen-go-plugin. DO NOT EDIT. +// versions: +// protoc-gen-go-plugin v0.1.0 +// protoc v3.19.4 +// source: proto/opq.proto + +package proto + +import ( + context "context" + wazero "github.com/tetratelabs/wazero" + wasi_snapshot_preview1 "github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1" +) + +type wazeroConfigOption func(plugin *WazeroConfig) + +type WazeroNewRuntime func(context.Context) (wazero.Runtime, error) + +type WazeroConfig struct { + newRuntime func(context.Context) (wazero.Runtime, error) + moduleConfig wazero.ModuleConfig +} + +func WazeroRuntime(newRuntime WazeroNewRuntime) wazeroConfigOption { + return func(h *WazeroConfig) { + h.newRuntime = newRuntime + } +} + +func DefaultWazeroRuntime() WazeroNewRuntime { + return func(ctx context.Context) (wazero.Runtime, error) { + r := wazero.NewRuntime(ctx) + if _, err := wasi_snapshot_preview1.Instantiate(ctx, r); err != nil { + return nil, err + } + + return r, nil + } +} + +func WazeroModuleConfig(moduleConfig wazero.ModuleConfig) wazeroConfigOption { + return func(h *WazeroConfig) { + h.moduleConfig = moduleConfig + } +} diff --git a/proto/opq_plugin.pb.go b/proto/opq_plugin.pb.go new file mode 100644 index 0000000..daef502 --- /dev/null +++ b/proto/opq_plugin.pb.go @@ -0,0 +1,428 @@ +//go:build tinygo.wasm + +// Code generated by protoc-gen-go-plugin. DO NOT EDIT. +// versions: +// protoc-gen-go-plugin v0.1.0 +// protoc v3.19.4 +// source: proto/opq.proto + +package proto + +import ( + context "context" + emptypb "github.com/knqyf263/go-plugin/types/known/emptypb" + wasm "github.com/knqyf263/go-plugin/wasm" + _ "unsafe" +) + +const EventPluginAPIVersion = 1 + +//export event_api_version +func _event_api_version() uint64 { + return EventPluginAPIVersion +} + +var event Event + +func RegisterEvent(p Event) { + event = p +} + +//export event_init +func _event_init(ptr, size uint32) uint64 { + b := wasm.PtrToByte(ptr, size) + req := new(emptypb.Empty) + if err := req.UnmarshalVT(b); err != nil { + return 0 + } + response, err := event.Init(context.Background(), req) + if err != nil { + ptr, size = wasm.ByteToPtr([]byte(err.Error())) + return (uint64(ptr) << uint64(32)) | uint64(size) | + // Indicate that this is the error string by setting the 32-th bit, assuming that + // no data exceeds 31-bit size (2 GiB). + (1 << 31) + } + + b, err = response.MarshalVT() + if err != nil { + return 0 + } + ptr, size = wasm.ByteToPtr(b) + return (uint64(ptr) << uint64(32)) | uint64(size) +} + +//export event_on_group_msg +func _event_on_group_msg(ptr, size uint32) uint64 { + b := wasm.PtrToByte(ptr, size) + req := new(CommonMsg) + if err := req.UnmarshalVT(b); err != nil { + return 0 + } + response, err := event.OnGroupMsg(context.Background(), req) + if err != nil { + ptr, size = wasm.ByteToPtr([]byte(err.Error())) + return (uint64(ptr) << uint64(32)) | uint64(size) | + // Indicate that this is the error string by setting the 32-th bit, assuming that + // no data exceeds 31-bit size (2 GiB). + (1 << 31) + } + + b, err = response.MarshalVT() + if err != nil { + return 0 + } + ptr, size = wasm.ByteToPtr(b) + return (uint64(ptr) << uint64(32)) | uint64(size) +} + +//export event_on_friend_msg +func _event_on_friend_msg(ptr, size uint32) uint64 { + b := wasm.PtrToByte(ptr, size) + req := new(CommonMsg) + if err := req.UnmarshalVT(b); err != nil { + return 0 + } + response, err := event.OnFriendMsg(context.Background(), req) + if err != nil { + ptr, size = wasm.ByteToPtr([]byte(err.Error())) + return (uint64(ptr) << uint64(32)) | uint64(size) | + // Indicate that this is the error string by setting the 32-th bit, assuming that + // no data exceeds 31-bit size (2 GiB). + (1 << 31) + } + + b, err = response.MarshalVT() + if err != nil { + return 0 + } + ptr, size = wasm.ByteToPtr(b) + return (uint64(ptr) << uint64(32)) | uint64(size) +} + +//export event_on_private_msg +func _event_on_private_msg(ptr, size uint32) uint64 { + b := wasm.PtrToByte(ptr, size) + req := new(CommonMsg) + if err := req.UnmarshalVT(b); err != nil { + return 0 + } + response, err := event.OnPrivateMsg(context.Background(), req) + if err != nil { + ptr, size = wasm.ByteToPtr([]byte(err.Error())) + return (uint64(ptr) << uint64(32)) | uint64(size) | + // Indicate that this is the error string by setting the 32-th bit, assuming that + // no data exceeds 31-bit size (2 GiB). + (1 << 31) + } + + b, err = response.MarshalVT() + if err != nil { + return 0 + } + ptr, size = wasm.ByteToPtr(b) + return (uint64(ptr) << uint64(32)) | uint64(size) +} + +//export event_unload +func _event_unload(ptr, size uint32) uint64 { + b := wasm.PtrToByte(ptr, size) + req := new(emptypb.Empty) + if err := req.UnmarshalVT(b); err != nil { + return 0 + } + response, err := event.Unload(context.Background(), req) + if err != nil { + ptr, size = wasm.ByteToPtr([]byte(err.Error())) + return (uint64(ptr) << uint64(32)) | uint64(size) | + // Indicate that this is the error string by setting the 32-th bit, assuming that + // no data exceeds 31-bit size (2 GiB). + (1 << 31) + } + + b, err = response.MarshalVT() + if err != nil { + return 0 + } + ptr, size = wasm.ByteToPtr(b) + return (uint64(ptr) << uint64(32)) | uint64(size) +} + +//export event_on_cron_event +func _event_on_cron_event(ptr, size uint32) uint64 { + b := wasm.PtrToByte(ptr, size) + req := new(CronEventReq) + if err := req.UnmarshalVT(b); err != nil { + return 0 + } + response, err := event.OnCronEvent(context.Background(), req) + if err != nil { + ptr, size = wasm.ByteToPtr([]byte(err.Error())) + return (uint64(ptr) << uint64(32)) | uint64(size) | + // Indicate that this is the error string by setting the 32-th bit, assuming that + // no data exceeds 31-bit size (2 GiB). + (1 << 31) + } + + b, err = response.MarshalVT() + if err != nil { + return 0 + } + ptr, size = wasm.ByteToPtr(b) + return (uint64(ptr) << uint64(32)) | uint64(size) +} + +//export event_on_remote_call_event +func _event_on_remote_call_event(ptr, size uint32) uint64 { + b := wasm.PtrToByte(ptr, size) + req := new(RemoteCallReq) + if err := req.UnmarshalVT(b); err != nil { + return 0 + } + response, err := event.OnRemoteCallEvent(context.Background(), req) + if err != nil { + ptr, size = wasm.ByteToPtr([]byte(err.Error())) + return (uint64(ptr) << uint64(32)) | uint64(size) | + // Indicate that this is the error string by setting the 32-th bit, assuming that + // no data exceeds 31-bit size (2 GiB). + (1 << 31) + } + + b, err = response.MarshalVT() + if err != nil { + return 0 + } + ptr, size = wasm.ByteToPtr(b) + return (uint64(ptr) << uint64(32)) | uint64(size) +} + +type api struct{} + +func NewApi() Api { + return api{} +} + +//go:wasm-module env +//export log +//go:linkname _log +func _log(ptr uint32, size uint32) uint64 + +func (h api) Log(ctx context.Context, request *LogReq) (*emptypb.Empty, error) { + buf, err := request.MarshalVT() + if err != nil { + return nil, err + } + ptr, size := wasm.ByteToPtr(buf) + ptrSize := _log(ptr, size) + wasm.FreePtr(ptr) + + ptr = uint32(ptrSize >> 32) + size = uint32(ptrSize) + buf = wasm.PtrToByte(ptr, size) + + response := new(emptypb.Empty) + if err = response.UnmarshalVT(buf); err != nil { + return nil, err + } + return response, nil +} + +//go:wasm-module env +//export http +//go:linkname _http +func _http(ptr uint32, size uint32) uint64 + +func (h api) Http(ctx context.Context, request *HttpReq) (*HttpRes, error) { + buf, err := request.MarshalVT() + if err != nil { + return nil, err + } + ptr, size := wasm.ByteToPtr(buf) + ptrSize := _http(ptr, size) + wasm.FreePtr(ptr) + + ptr = uint32(ptrSize >> 32) + size = uint32(ptrSize) + buf = wasm.PtrToByte(ptr, size) + + response := new(HttpRes) + if err = response.UnmarshalVT(buf); err != nil { + return nil, err + } + return response, nil +} + +//go:wasm-module env +//export send_group_msg +//go:linkname _send_group_msg +func _send_group_msg(ptr uint32, size uint32) uint64 + +func (h api) SendGroupMsg(ctx context.Context, request *MsgReq) (*SendReply, error) { + buf, err := request.MarshalVT() + if err != nil { + return nil, err + } + ptr, size := wasm.ByteToPtr(buf) + ptrSize := _send_group_msg(ptr, size) + wasm.FreePtr(ptr) + + ptr = uint32(ptrSize >> 32) + size = uint32(ptrSize) + buf = wasm.PtrToByte(ptr, size) + + response := new(SendReply) + if err = response.UnmarshalVT(buf); err != nil { + return nil, err + } + return response, nil +} + +//go:wasm-module env +//export send_friend_msg +//go:linkname _send_friend_msg +func _send_friend_msg(ptr uint32, size uint32) uint64 + +func (h api) SendFriendMsg(ctx context.Context, request *MsgReq) (*SendReply, error) { + buf, err := request.MarshalVT() + if err != nil { + return nil, err + } + ptr, size := wasm.ByteToPtr(buf) + ptrSize := _send_friend_msg(ptr, size) + wasm.FreePtr(ptr) + + ptr = uint32(ptrSize >> 32) + size = uint32(ptrSize) + buf = wasm.PtrToByte(ptr, size) + + response := new(SendReply) + if err = response.UnmarshalVT(buf); err != nil { + return nil, err + } + return response, nil +} + +//go:wasm-module env +//export send_private_msg +//go:linkname _send_private_msg +func _send_private_msg(ptr uint32, size uint32) uint64 + +func (h api) SendPrivateMsg(ctx context.Context, request *MsgReq) (*SendReply, error) { + buf, err := request.MarshalVT() + if err != nil { + return nil, err + } + ptr, size := wasm.ByteToPtr(buf) + ptrSize := _send_private_msg(ptr, size) + wasm.FreePtr(ptr) + + ptr = uint32(ptrSize >> 32) + size = uint32(ptrSize) + buf = wasm.PtrToByte(ptr, size) + + response := new(SendReply) + if err = response.UnmarshalVT(buf); err != nil { + return nil, err + } + return response, nil +} + +//go:wasm-module env +//export upload +//go:linkname _upload +func _upload(ptr uint32, size uint32) uint64 + +func (h api) Upload(ctx context.Context, request *UploadReq) (*UploadReply, error) { + buf, err := request.MarshalVT() + if err != nil { + return nil, err + } + ptr, size := wasm.ByteToPtr(buf) + ptrSize := _upload(ptr, size) + wasm.FreePtr(ptr) + + ptr = uint32(ptrSize >> 32) + size = uint32(ptrSize) + buf = wasm.PtrToByte(ptr, size) + + response := new(UploadReply) + if err = response.UnmarshalVT(buf); err != nil { + return nil, err + } + return response, nil +} + +//go:wasm-module env +//export register_cron_job +//go:linkname _register_cron_job +func _register_cron_job(ptr uint32, size uint32) uint64 + +func (h api) RegisterCronJob(ctx context.Context, request *CronJob) (*emptypb.Empty, error) { + buf, err := request.MarshalVT() + if err != nil { + return nil, err + } + ptr, size := wasm.ByteToPtr(buf) + ptrSize := _register_cron_job(ptr, size) + wasm.FreePtr(ptr) + + ptr = uint32(ptrSize >> 32) + size = uint32(ptrSize) + buf = wasm.PtrToByte(ptr, size) + + response := new(emptypb.Empty) + if err = response.UnmarshalVT(buf); err != nil { + return nil, err + } + return response, nil +} + +//go:wasm-module env +//export remove_cron_job +//go:linkname _remove_cron_job +func _remove_cron_job(ptr uint32, size uint32) uint64 + +func (h api) RemoveCronJob(ctx context.Context, request *CronJob) (*emptypb.Empty, error) { + buf, err := request.MarshalVT() + if err != nil { + return nil, err + } + ptr, size := wasm.ByteToPtr(buf) + ptrSize := _remove_cron_job(ptr, size) + wasm.FreePtr(ptr) + + ptr = uint32(ptrSize >> 32) + size = uint32(ptrSize) + buf = wasm.PtrToByte(ptr, size) + + response := new(emptypb.Empty) + if err = response.UnmarshalVT(buf); err != nil { + return nil, err + } + return response, nil +} + +//go:wasm-module env +//export remote_call +//go:linkname _remote_call +func _remote_call(ptr uint32, size uint32) uint64 + +func (h api) RemoteCall(ctx context.Context, request *RemoteCallReq) (*RemoteCallReply, error) { + buf, err := request.MarshalVT() + if err != nil { + return nil, err + } + ptr, size := wasm.ByteToPtr(buf) + ptrSize := _remote_call(ptr, size) + wasm.FreePtr(ptr) + + ptr = uint32(ptrSize >> 32) + size = uint32(ptrSize) + buf = wasm.PtrToByte(ptr, size) + + response := new(RemoteCallReply) + if err = response.UnmarshalVT(buf); err != nil { + return nil, err + } + return response, nil +} diff --git a/proto/opq_vtproto.pb.go b/proto/opq_vtproto.pb.go new file mode 100644 index 0000000..4e31759 --- /dev/null +++ b/proto/opq_vtproto.pb.go @@ -0,0 +1,4218 @@ +// Code generated by protoc-gen-go-plugin. DO NOT EDIT. +// versions: +// protoc-gen-go-plugin v0.1.0 +// protoc v3.19.4 +// source: proto/opq.proto + +package proto + +import ( + fmt "fmt" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + bits "math/bits" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +func (m *RemoteCallReq) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RemoteCallReq) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *RemoteCallReq) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.Args) > 0 { + i -= len(m.Args) + copy(dAtA[i:], m.Args) + i = encodeVarint(dAtA, i, uint64(len(m.Args))) + i-- + dAtA[i] = 0x22 + } + if len(m.CallPath) > 0 { + i -= len(m.CallPath) + copy(dAtA[i:], m.CallPath) + i = encodeVarint(dAtA, i, uint64(len(m.CallPath))) + i-- + dAtA[i] = 0x1a + } + if len(m.DstPluginName) > 0 { + i -= len(m.DstPluginName) + copy(dAtA[i:], m.DstPluginName) + i = encodeVarint(dAtA, i, uint64(len(m.DstPluginName))) + i-- + dAtA[i] = 0x12 + } + if len(m.SrcPluginName) > 0 { + i -= len(m.SrcPluginName) + copy(dAtA[i:], m.SrcPluginName) + i = encodeVarint(dAtA, i, uint64(len(m.SrcPluginName))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *RemoteCallReply) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RemoteCallReply) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *RemoteCallReply) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarint(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *CronEventReq) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CronEventReq) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *CronEventReq) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.Id) > 0 { + i -= len(m.Id) + copy(dAtA[i:], m.Id) + i = encodeVarint(dAtA, i, uint64(len(m.Id))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *InitReply) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *InitReply) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *InitReply) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.Message) > 0 { + i -= len(m.Message) + copy(dAtA[i:], m.Message) + i = encodeVarint(dAtA, i, uint64(len(m.Message))) + i-- + dAtA[i] = 0x12 + } + if m.Ok { + i-- + if m.Ok { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *CommonMsg) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CommonMsg) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *CommonMsg) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.MessageType != 0 { + i = encodeVarint(dAtA, i, uint64(m.MessageType)) + i-- + dAtA[i] = 0x40 + } + if m.MessageId != 0 { + i = encodeVarint(dAtA, i, uint64(m.MessageId)) + i-- + dAtA[i] = 0x38 + } + if len(m.RawMessage) > 0 { + i -= len(m.RawMessage) + copy(dAtA[i:], m.RawMessage) + i = encodeVarint(dAtA, i, uint64(len(m.RawMessage))) + i-- + dAtA[i] = 0x32 + } + if len(m.Message) > 0 { + i -= len(m.Message) + copy(dAtA[i:], m.Message) + i = encodeVarint(dAtA, i, uint64(len(m.Message))) + i-- + dAtA[i] = 0x2a + } + if m.SenderUin != 0 { + i = encodeVarint(dAtA, i, uint64(m.SenderUin)) + i-- + dAtA[i] = 0x20 + } + if m.FromUin != 0 { + i = encodeVarint(dAtA, i, uint64(m.FromUin)) + i-- + dAtA[i] = 0x18 + } + if m.SelfId != 0 { + i = encodeVarint(dAtA, i, uint64(m.SelfId)) + i-- + dAtA[i] = 0x10 + } + if m.Time != 0 { + i = encodeVarint(dAtA, i, uint64(m.Time)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *CronJob) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CronJob) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *CronJob) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.Id) > 0 { + i -= len(m.Id) + copy(dAtA[i:], m.Id) + i = encodeVarint(dAtA, i, uint64(len(m.Id))) + i-- + dAtA[i] = 0x12 + } + if len(m.Spec) > 0 { + i -= len(m.Spec) + copy(dAtA[i:], m.Spec) + i = encodeVarint(dAtA, i, uint64(len(m.Spec))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *LogReq) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *LogReq) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *LogReq) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.Msg) > 0 { + i -= len(m.Msg) + copy(dAtA[i:], m.Msg) + i = encodeVarint(dAtA, i, uint64(len(m.Msg))) + i-- + dAtA[i] = 0x12 + } + if m.LogType != 0 { + i = encodeVarint(dAtA, i, uint64(m.LogType)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *HttpReq) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *HttpReq) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *HttpReq) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.Content) > 0 { + i -= len(m.Content) + copy(dAtA[i:], m.Content) + i = encodeVarint(dAtA, i, uint64(len(m.Content))) + i-- + dAtA[i] = 0x22 + } + if len(m.Header) > 0 { + for k := range m.Header { + v := m.Header[k] + baseI := i + i -= len(v) + copy(dAtA[i:], v) + i = encodeVarint(dAtA, i, uint64(len(v))) + i-- + dAtA[i] = 0x12 + i -= len(k) + copy(dAtA[i:], k) + i = encodeVarint(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = encodeVarint(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0x1a + } + } + if m.Method != 0 { + i = encodeVarint(dAtA, i, uint64(m.Method)) + i-- + dAtA[i] = 0x10 + } + if len(m.Url) > 0 { + i -= len(m.Url) + copy(dAtA[i:], m.Url) + i = encodeVarint(dAtA, i, uint64(len(m.Url))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *HttpRes) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *HttpRes) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *HttpRes) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.Content) > 0 { + i -= len(m.Content) + copy(dAtA[i:], m.Content) + i = encodeVarint(dAtA, i, uint64(len(m.Content))) + i-- + dAtA[i] = 0x1a + } + if m.StatusCode != 0 { + i = encodeVarint(dAtA, i, uint64(m.StatusCode)) + i-- + dAtA[i] = 0x10 + } + if len(m.Header) > 0 { + i -= len(m.Header) + copy(dAtA[i:], m.Header) + i = encodeVarint(dAtA, i, uint64(len(m.Header))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *TextMsg) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TextMsg) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *TextMsg) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.Text) > 0 { + i -= len(m.Text) + copy(dAtA[i:], m.Text) + i = encodeVarint(dAtA, i, uint64(len(m.Text))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *File) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *File) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *File) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.FileToken) > 0 { + i -= len(m.FileToken) + copy(dAtA[i:], m.FileToken) + i = encodeVarint(dAtA, i, uint64(len(m.FileToken))) + i-- + dAtA[i] = 0x22 + } + if m.FileSize != 0 { + i = encodeVarint(dAtA, i, uint64(m.FileSize)) + i-- + dAtA[i] = 0x18 + } + if len(m.FileMd5) > 0 { + i -= len(m.FileMd5) + copy(dAtA[i:], m.FileMd5) + i = encodeVarint(dAtA, i, uint64(len(m.FileMd5))) + i-- + dAtA[i] = 0x12 + } + if m.FileId != 0 { + i = encodeVarint(dAtA, i, uint64(m.FileId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *Files) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Files) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *Files) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.File) > 0 { + for iNdEx := len(m.File) - 1; iNdEx >= 0; iNdEx-- { + size, err := m.File[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *JsonMsg) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *JsonMsg) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *JsonMsg) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.Json) > 0 { + i -= len(m.Json) + copy(dAtA[i:], m.Json) + i = encodeVarint(dAtA, i, uint64(len(m.Json))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *XmlMsg) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *XmlMsg) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *XmlMsg) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.Xml) > 0 { + i -= len(m.Xml) + copy(dAtA[i:], m.Xml) + i = encodeVarint(dAtA, i, uint64(len(m.Xml))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgReq) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgReq) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *MsgReq) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if vtmsg, ok := m.Msg.(interface { + MarshalToVT([]byte) (int, error) + SizeVT() int + }); ok { + { + size := vtmsg.SizeVT() + i -= size + if _, err := vtmsg.MarshalToVT(dAtA[i:]); err != nil { + return 0, err + } + } + } + if m.GroupCode != nil { + i = encodeVarint(dAtA, i, uint64(*m.GroupCode)) + i-- + dAtA[i] = 0x48 + } + if m.BotUin != 0 { + i = encodeVarint(dAtA, i, uint64(m.BotUin)) + i-- + dAtA[i] = 0x20 + } + if len(m.AtUin) > 0 { + var pksize2 int + for _, num := range m.AtUin { + pksize2 += sov(uint64(num)) + } + i -= pksize2 + j1 := i + for _, num1 := range m.AtUin { + num := uint64(num1) + for num >= 1<<7 { + dAtA[j1] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j1++ + } + dAtA[j1] = uint8(num) + j1++ + } + i = encodeVarint(dAtA, i, uint64(pksize2)) + i-- + dAtA[i] = 0x1a + } + if m.ToUin != 0 { + i = encodeVarint(dAtA, i, uint64(m.ToUin)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *MsgReq_TextMsg) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *MsgReq_TextMsg) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + i := len(dAtA) + if m.TextMsg != nil { + size, err := m.TextMsg.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x2a + } + return len(dAtA) - i, nil +} +func (m *MsgReq_PicMsg) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *MsgReq_PicMsg) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + i := len(dAtA) + if m.PicMsg != nil { + size, err := m.PicMsg.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x32 + } + return len(dAtA) - i, nil +} +func (m *MsgReq_XmlMsg) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *MsgReq_XmlMsg) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + i := len(dAtA) + if m.XmlMsg != nil { + size, err := m.XmlMsg.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x3a + } + return len(dAtA) - i, nil +} +func (m *MsgReq_JsonMsg) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *MsgReq_JsonMsg) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + i := len(dAtA) + if m.JsonMsg != nil { + size, err := m.JsonMsg.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x42 + } + return len(dAtA) - i, nil +} +func (m *SendReply) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SendReply) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *SendReply) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.ErrMsg != nil { + i -= len(*m.ErrMsg) + copy(dAtA[i:], *m.ErrMsg) + i = encodeVarint(dAtA, i, uint64(len(*m.ErrMsg))) + i-- + dAtA[i] = 0x12 + } + if m.Ret != 0 { + i = encodeVarint(dAtA, i, uint64(m.Ret)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *UploadReq) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *UploadReq) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *UploadReq) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if vtmsg, ok := m.File.(interface { + MarshalToVT([]byte) (int, error) + SizeVT() int + }); ok { + { + size := vtmsg.SizeVT() + i -= size + if _, err := vtmsg.MarshalToVT(dAtA[i:]); err != nil { + return 0, err + } + } + } + if m.UploadId != 0 { + i = encodeVarint(dAtA, i, uint64(m.UploadId)) + i-- + dAtA[i] = 0x28 + } + if m.BotUin != 0 { + i = encodeVarint(dAtA, i, uint64(m.BotUin)) + i-- + dAtA[i] = 0x20 + } + return len(dAtA) - i, nil +} + +func (m *UploadReq_Path) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *UploadReq_Path) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + i := len(dAtA) + i -= len(m.Path) + copy(dAtA[i:], m.Path) + i = encodeVarint(dAtA, i, uint64(len(m.Path))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} +func (m *UploadReq_Url) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *UploadReq_Url) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + i := len(dAtA) + i -= len(m.Url) + copy(dAtA[i:], m.Url) + i = encodeVarint(dAtA, i, uint64(len(m.Url))) + i-- + dAtA[i] = 0x12 + return len(dAtA) - i, nil +} +func (m *UploadReq_Base64Buf) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *UploadReq_Base64Buf) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + i := len(dAtA) + i -= len(m.Base64Buf) + copy(dAtA[i:], m.Base64Buf) + i = encodeVarint(dAtA, i, uint64(len(m.Base64Buf))) + i-- + dAtA[i] = 0x1a + return len(dAtA) - i, nil +} +func (m *UploadReply) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *UploadReply) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *UploadReply) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.File != nil { + size, err := m.File.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x1a + } + if m.ErrMsg != nil { + i -= len(*m.ErrMsg) + copy(dAtA[i:], *m.ErrMsg) + i = encodeVarint(dAtA, i, uint64(len(*m.ErrMsg))) + i-- + dAtA[i] = 0x12 + } + if m.Ret != 0 { + i = encodeVarint(dAtA, i, uint64(m.Ret)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarint(dAtA []byte, offset int, v uint64) int { + offset -= sov(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *RemoteCallReq) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.SrcPluginName) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + l = len(m.DstPluginName) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + l = len(m.CallPath) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + l = len(m.Args) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + if m.unknownFields != nil { + n += len(m.unknownFields) + } + return n +} + +func (m *RemoteCallReply) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Data) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + if m.unknownFields != nil { + n += len(m.unknownFields) + } + return n +} + +func (m *CronEventReq) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Id) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + if m.unknownFields != nil { + n += len(m.unknownFields) + } + return n +} + +func (m *InitReply) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Ok { + n += 2 + } + l = len(m.Message) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + if m.unknownFields != nil { + n += len(m.unknownFields) + } + return n +} + +func (m *CommonMsg) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Time != 0 { + n += 1 + sov(uint64(m.Time)) + } + if m.SelfId != 0 { + n += 1 + sov(uint64(m.SelfId)) + } + if m.FromUin != 0 { + n += 1 + sov(uint64(m.FromUin)) + } + if m.SenderUin != 0 { + n += 1 + sov(uint64(m.SenderUin)) + } + l = len(m.Message) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + l = len(m.RawMessage) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + if m.MessageId != 0 { + n += 1 + sov(uint64(m.MessageId)) + } + if m.MessageType != 0 { + n += 1 + sov(uint64(m.MessageType)) + } + if m.unknownFields != nil { + n += len(m.unknownFields) + } + return n +} + +func (m *CronJob) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Spec) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + l = len(m.Id) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + if m.unknownFields != nil { + n += len(m.unknownFields) + } + return n +} + +func (m *LogReq) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.LogType != 0 { + n += 1 + sov(uint64(m.LogType)) + } + l = len(m.Msg) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + if m.unknownFields != nil { + n += len(m.unknownFields) + } + return n +} + +func (m *HttpReq) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Url) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + if m.Method != 0 { + n += 1 + sov(uint64(m.Method)) + } + if len(m.Header) > 0 { + for k, v := range m.Header { + _ = k + _ = v + mapEntrySize := 1 + len(k) + sov(uint64(len(k))) + 1 + len(v) + sov(uint64(len(v))) + n += mapEntrySize + 1 + sov(uint64(mapEntrySize)) + } + } + l = len(m.Content) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + if m.unknownFields != nil { + n += len(m.unknownFields) + } + return n +} + +func (m *HttpRes) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Header) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + if m.StatusCode != 0 { + n += 1 + sov(uint64(m.StatusCode)) + } + l = len(m.Content) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + if m.unknownFields != nil { + n += len(m.unknownFields) + } + return n +} + +func (m *TextMsg) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Text) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + if m.unknownFields != nil { + n += len(m.unknownFields) + } + return n +} + +func (m *File) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.FileId != 0 { + n += 1 + sov(uint64(m.FileId)) + } + l = len(m.FileMd5) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + if m.FileSize != 0 { + n += 1 + sov(uint64(m.FileSize)) + } + l = len(m.FileToken) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + if m.unknownFields != nil { + n += len(m.unknownFields) + } + return n +} + +func (m *Files) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.File) > 0 { + for _, e := range m.File { + l = e.SizeVT() + n += 1 + l + sov(uint64(l)) + } + } + if m.unknownFields != nil { + n += len(m.unknownFields) + } + return n +} + +func (m *JsonMsg) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Json) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + if m.unknownFields != nil { + n += len(m.unknownFields) + } + return n +} + +func (m *XmlMsg) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Xml) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + if m.unknownFields != nil { + n += len(m.unknownFields) + } + return n +} + +func (m *MsgReq) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ToUin != 0 { + n += 1 + sov(uint64(m.ToUin)) + } + if len(m.AtUin) > 0 { + l = 0 + for _, e := range m.AtUin { + l += sov(uint64(e)) + } + n += 1 + sov(uint64(l)) + l + } + if m.BotUin != 0 { + n += 1 + sov(uint64(m.BotUin)) + } + if vtmsg, ok := m.Msg.(interface{ SizeVT() int }); ok { + n += vtmsg.SizeVT() + } + if m.GroupCode != nil { + n += 1 + sov(uint64(*m.GroupCode)) + } + if m.unknownFields != nil { + n += len(m.unknownFields) + } + return n +} + +func (m *MsgReq_TextMsg) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.TextMsg != nil { + l = m.TextMsg.SizeVT() + n += 1 + l + sov(uint64(l)) + } + return n +} +func (m *MsgReq_PicMsg) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.PicMsg != nil { + l = m.PicMsg.SizeVT() + n += 1 + l + sov(uint64(l)) + } + return n +} +func (m *MsgReq_XmlMsg) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.XmlMsg != nil { + l = m.XmlMsg.SizeVT() + n += 1 + l + sov(uint64(l)) + } + return n +} +func (m *MsgReq_JsonMsg) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.JsonMsg != nil { + l = m.JsonMsg.SizeVT() + n += 1 + l + sov(uint64(l)) + } + return n +} +func (m *SendReply) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Ret != 0 { + n += 1 + sov(uint64(m.Ret)) + } + if m.ErrMsg != nil { + l = len(*m.ErrMsg) + n += 1 + l + sov(uint64(l)) + } + if m.unknownFields != nil { + n += len(m.unknownFields) + } + return n +} + +func (m *UploadReq) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if vtmsg, ok := m.File.(interface{ SizeVT() int }); ok { + n += vtmsg.SizeVT() + } + if m.BotUin != 0 { + n += 1 + sov(uint64(m.BotUin)) + } + if m.UploadId != 0 { + n += 1 + sov(uint64(m.UploadId)) + } + if m.unknownFields != nil { + n += len(m.unknownFields) + } + return n +} + +func (m *UploadReq_Path) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Path) + n += 1 + l + sov(uint64(l)) + return n +} +func (m *UploadReq_Url) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Url) + n += 1 + l + sov(uint64(l)) + return n +} +func (m *UploadReq_Base64Buf) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Base64Buf) + n += 1 + l + sov(uint64(l)) + return n +} +func (m *UploadReply) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Ret != 0 { + n += 1 + sov(uint64(m.Ret)) + } + if m.ErrMsg != nil { + l = len(*m.ErrMsg) + n += 1 + l + sov(uint64(l)) + } + if m.File != nil { + l = m.File.SizeVT() + n += 1 + l + sov(uint64(l)) + } + if m.unknownFields != nil { + n += len(m.unknownFields) + } + return n +} + +func sov(x uint64) (n int) { + return (bits.Len64(x|1) + 6) / 7 +} +func soz(x uint64) (n int) { + return sov(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *RemoteCallReq) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RemoteCallReq: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RemoteCallReq: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SrcPluginName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SrcPluginName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DstPluginName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DstPluginName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CallPath", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CallPath = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Args", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Args = append(m.Args[:0], dAtA[iNdEx:postIndex]...) + if m.Args == nil { + m.Args = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RemoteCallReply) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RemoteCallReply: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RemoteCallReply: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) + if m.Data == nil { + m.Data = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CronEventReq) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CronEventReq: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CronEventReq: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Id = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *InitReply) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: InitReply: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: InitReply: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Ok", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Ok = bool(v != 0) + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Message", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Message = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CommonMsg) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CommonMsg: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CommonMsg: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Time", wireType) + } + m.Time = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Time |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SelfId", wireType) + } + m.SelfId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SelfId |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field FromUin", wireType) + } + m.FromUin = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.FromUin |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SenderUin", wireType) + } + m.SenderUin = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SenderUin |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Message", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Message = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RawMessage", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RawMessage = append(m.RawMessage[:0], dAtA[iNdEx:postIndex]...) + if m.RawMessage == nil { + m.RawMessage = []byte{} + } + iNdEx = postIndex + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MessageId", wireType) + } + m.MessageId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MessageId |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MessageType", wireType) + } + m.MessageType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MessageType |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CronJob) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CronJob: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CronJob: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Spec = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Id = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *LogReq) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: LogReq: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: LogReq: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LogType", wireType) + } + m.LogType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LogType |= LogType(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Msg", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Msg = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *HttpReq) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: HttpReq: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: HttpReq: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Url", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Url = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Method", wireType) + } + m.Method = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Method |= HttpMethod(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Header == nil { + m.Header = make(map[string]string) + } + var mapkey string + var mapvalue string + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLength + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLength + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var stringLenmapvalue uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapvalue |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapvalue := int(stringLenmapvalue) + if intStringLenmapvalue < 0 { + return ErrInvalidLength + } + postStringIndexmapvalue := iNdEx + intStringLenmapvalue + if postStringIndexmapvalue < 0 { + return ErrInvalidLength + } + if postStringIndexmapvalue > l { + return io.ErrUnexpectedEOF + } + mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) + iNdEx = postStringIndexmapvalue + } else { + iNdEx = entryPreIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.Header[mapkey] = mapvalue + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Content", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Content = append(m.Content[:0], dAtA[iNdEx:postIndex]...) + if m.Content == nil { + m.Content = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *HttpRes) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: HttpRes: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: HttpRes: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Header = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field StatusCode", wireType) + } + m.StatusCode = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.StatusCode |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Content", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Content = append(m.Content[:0], dAtA[iNdEx:postIndex]...) + if m.Content == nil { + m.Content = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TextMsg) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TextMsg: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TextMsg: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Text", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Text = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *File) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: File: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: File: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field FileId", wireType) + } + m.FileId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.FileId |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FileMd5", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FileMd5 = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field FileSize", wireType) + } + m.FileSize = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.FileSize |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FileToken", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FileToken = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Files) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Files: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Files: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field File", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.File = append(m.File, &File{}) + if err := m.File[len(m.File)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *JsonMsg) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: JsonMsg: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: JsonMsg: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Json", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Json = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *XmlMsg) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: XmlMsg: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: XmlMsg: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Xml", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Xml = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgReq) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgReq: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgReq: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ToUin", wireType) + } + m.ToUin = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ToUin |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType == 0 { + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.AtUin = append(m.AtUin, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.AtUin) == 0 { + m.AtUin = make([]int64, 0, elementCount) + } + for iNdEx < postIndex { + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.AtUin = append(m.AtUin, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field AtUin", wireType) + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BotUin", wireType) + } + m.BotUin = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BotUin |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TextMsg", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if oneof, ok := m.Msg.(*MsgReq_TextMsg); ok { + if err := oneof.TextMsg.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + v := &TextMsg{} + if err := v.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Msg = &MsgReq_TextMsg{v} + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PicMsg", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if oneof, ok := m.Msg.(*MsgReq_PicMsg); ok { + if err := oneof.PicMsg.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + v := &Files{} + if err := v.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Msg = &MsgReq_PicMsg{v} + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field XmlMsg", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if oneof, ok := m.Msg.(*MsgReq_XmlMsg); ok { + if err := oneof.XmlMsg.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + v := &XmlMsg{} + if err := v.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Msg = &MsgReq_XmlMsg{v} + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field JsonMsg", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if oneof, ok := m.Msg.(*MsgReq_JsonMsg); ok { + if err := oneof.JsonMsg.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + v := &JsonMsg{} + if err := v.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Msg = &MsgReq_JsonMsg{v} + } + iNdEx = postIndex + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field GroupCode", wireType) + } + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.GroupCode = &v + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SendReply) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SendReply: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SendReply: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Ret", wireType) + } + m.Ret = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Ret |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ErrMsg", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.ErrMsg = &s + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *UploadReq) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: UploadReq: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UploadReq: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Path", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.File = &UploadReq_Path{string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Url", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.File = &UploadReq_Url{string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Base64Buf", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.File = &UploadReq_Base64Buf{string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BotUin", wireType) + } + m.BotUin = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BotUin |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field UploadId", wireType) + } + m.UploadId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.UploadId |= UploadId(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *UploadReply) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: UploadReply: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UploadReply: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Ret", wireType) + } + m.Ret = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Ret |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ErrMsg", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.ErrMsg = &s + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field File", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.File == nil { + m.File = &File{} + } + if err := m.File.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skip(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflow + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflow + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflow + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLength + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroup + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLength + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLength = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflow = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroup = fmt.Errorf("proto: unexpected end of group") +) diff --git a/session/session.go b/session/session.go new file mode 100644 index 0000000..92666f6 --- /dev/null +++ b/session/session.go @@ -0,0 +1,20 @@ +package session + +import ( + "github.com/charmbracelet/log" + "github.com/mcoo/OPQBot/session" + _ "github.com/mcoo/OPQBot/session/provider" +) + +var ( + S *session.Manager +) + +func init() { + var err error + S, err = session.NewManager("qq", 600) + if err != nil { + log.Fatal(err) + } + S.GC() +} diff --git "a/web/docs/guide/\345\274\200\345\247\213.md" "b/web/docs/guide/\345\274\200\345\247\213.md" new file mode 100644 index 0000000..50befc8 --- /dev/null +++ "b/web/docs/guide/\345\274\200\345\247\213.md" @@ -0,0 +1,16 @@ +# 开始使用 +## 下载Yui +- [Github Release](https://github.com/opq-osc/Yui/releases/) + +## 配置文件 +config.yaml + +<<< @../../../config.yaml + +## 运行 +```bash +./yui.exe // [!code hl] + +2023/04/30 10:32:02 INFO Yui 欢迎使用 Version:v0.0.1 (commit:xxxxxxxxxxxxxxx) +2023/04/30 10:32:02 INFO 连接成功 +``` \ No newline at end of file diff --git "a/web/docs/guide/\347\256\241\347\220\206\345\221\230\345\221\275\344\273\244.md" "b/web/docs/guide/\347\256\241\347\220\206\345\221\230\345\221\275\344\273\244.md" new file mode 100644 index 0000000..8d9ec9c --- /dev/null +++ "b/web/docs/guide/\347\256\241\347\220\206\345\221\230\345\221\275\344\273\244.md" @@ -0,0 +1,45 @@ +# 管理员命令 + +插件内置了一些管理员的命令,这些命令以 `.admin` 开头 + +## list +命令 `.admin list` + +列出已经加载的插件列表 + +输出 +```bash +systemInfoPlugin 作者:enjoy 说明:用于获取系统信息的插件 权限:540673 签名:true +``` + +## load +命令 `.admin load <插件文件路径>` + +加载插件 + +例子 `.admin load plugins/systemInfo.opq` + +```bash +是否加载插件 [systemInfoPlugin] 作者: enjoy +说明:用于获取系统信息的插件 +它需要的权限有: +发送群消息权限 +接收群消息事件权限 +获取系统信息权限 +``` +您可以回复`是`将载入该插件 + +## unload +命令 `.admin load <插件名>` + +卸载插件 + +例子 `.admin unload systemInfoPlugin` + +## permission + +命令 `.admin permission <插件名>` + +获取插件需要的权限 + +例子 `.admin permission systemInfoPlugin` \ No newline at end of file diff --git a/web/docs/index.md b/web/docs/index.md new file mode 100644 index 0000000..553550d --- /dev/null +++ b/web/docs/index.md @@ -0,0 +1,28 @@ +--- +layout: home + +hero: + name: Yui + text: OPQBot 的 golang 版本的插件实现 + tagline: 插件管理,权限控制,安全... +# image: +# src: /opq.png +# alt: OPQ + actions: + - theme: brand + text: 开始使用 + link: /guide/开始 + - theme: alt + text: GitHub + link: +features: + - icon: 🍭 + title: 简单,易用 + details: 小白只需要下载对应平台文件,配置OPQ链接,即可运行 + - icon: 🛡 + title: 安全 + details: 插件运行于WASI沙箱中,所有API调用均需要在Meta文件中申请 + - icon: 🚀 + title: 低开发成本 + details: 插件编译为OPQ文件后可以在所有Yui支持的平台上运行,无须再次编译 +--- \ No newline at end of file diff --git a/web/docs/public/opq.png b/web/docs/public/opq.png new file mode 100644 index 0000000000000000000000000000000000000000..87cd5d86953e76fb8b7428886f1695066d497594 GIT binary patch literal 34287 zcmeFY^;cBy8#cO$0i=;Z8bm(|NO!k@(jg@hN=u0}3=E=x(u&e8h$xLT%n(x2-3;BG zGcXKi^L@|x3(l`EYwfjI#5~Vk*L~fwKk4bHQ;;%|0suhq^vPob0KgBqc}R%BpOE); z-v@vY;OS$fXMUDDbHp#8zPM|T+dOygvC`!2gf>ASkOV(I-@3EQt37^SKkfx z@4VsC0yAfEn`~n`-?VwY8UGWbzDQ z)x~}@6~~7*J5xH67`O#p0 z9WoCykkj*azE(lAo~aY*%}(e)8J z`Zq04=UB?4PWnhAo67cIhf}XkClg-vCBJ{wH+k;#Dr{Ql`0w-(GH>9@TvNN*v7;z6 zp_KhZZa$4CBG6q#>u}cK)UdSJ==xy#1>;^_-CLPHbcw>m_V`C8x@VnNr9d$XQZg__p9MXs@+ZpP zsqh@lGvOTM0s9Y*Zg;> zE*^DMAi4E6{NDr>kgZ-Gsu&Y5v)S-!J`Y9WpOD0O{Lr0-^dbB%R7Z=B^x?OtFxmmq zumpLV`~=3|PH9_bDSu7J{t_F`$Lr;02m7uvg! zg`tcLcat@8?EhE_M&lkAF*6H{#+a!bCz>i;aCTgTI28>!B*SDBA9&TTtGkQ^2DlZa zuGUpuD9F}~_MT50H1#=au3APS6D-YtX*luwxt7$g)#a!9?@G2c`ef$Y-9L_W7u0AUs=_5us>z#o>@z@#t08jjOn#e3EL>o!4mN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UZJQpqF%i;+#u4V6_> z^>)t<1@6S0Sjc7rM9!(#Lr`wkh-YCi`$_uZ=)qmx0$>A3_|If#Cqn0U>`CZQ2-ZFsU ziK+>DL#rx#X_bceWfFazz49UaZk;-5Ed8js;GTo=dtnD-*RW&mTY@{w8p9|bA?_c} zxp$btHhP%)M#7oB>-Se0VwH_}Pt5)pU(%Sq6{9vSH#AcV0@0Lesy#N|(A+I}4&qE% zLW-^Y$yA}y$T>rN=^II6WgRY?k&o)&D0oNZpQf}0|A`M^juN75%y7de@$07de-TI( z$Z#yjCh?afBUy;|KZy|BQeyeT(S%0qicX!0M;y>#FPMjV6{`EA@|C;UKyDi4PJO!jUtME`# zukj3;QIOFls$EsD*BdkoTZKK^TWQ#vd^xVDy&gW>y7lFJA-y0k%`NT4hj}xR6f}%S z3F)S}&E{?WD^yX#oeY~!UV}?Q8Aa#bZS|8{M`TF>Kc?eHpV5hn&xDyJQaZEZ>b;X-ssK#1@ zaHQ6QQxBnw9EjSOHK}P)45@Xo0&nQ>wH~v^Pl>i;U!vST!2f!oo1l*Ph@77CjpgIq z#Ql}qZ|T2?u`h(Y+_q(oAU}vaarmFc1M95du=E0Q&)2f1DwIr*pA%tXKTfjusFo+m zzpgs#G9REi0K2O3e2Ap}!_y1sTWaH>MgbgrdQcTGWjH`VC+@7{Ye|vH=h5@OPTM7j z_{=v$EV@Rzxn5a>4K)$_OCZqbMu{%r?t5LMMM9;xk)ED!mNx;x42jFhRXY3j8}+29 zgin|`Lh{>1utWszF$D-TM-?W(73O$Cz8e#ev5ER$RcsD6 literal 0 HcmV?d00001 diff --git "a/web/docs/\346\217\222\344\273\266\347\274\226\345\206\231/\344\272\213\344\273\266.md" "b/web/docs/\346\217\222\344\273\266\347\274\226\345\206\231/\344\272\213\344\273\266.md" new file mode 100644 index 0000000..b1838ee --- /dev/null +++ "b/web/docs/\346\217\222\344\273\266\347\274\226\345\206\231/\344\272\213\344\273\266.md" @@ -0,0 +1,19 @@ +# 插件事件 +```proto +service Event { + // 插件初始化 + rpc Init(google.protobuf.Empty) returns (InitReply) {} + // 群消息 + rpc OnGroupMsg(CommonMsg) returns (google.protobuf.Empty) {} + // 好友消息 + rpc OnFriendMsg(CommonMsg) returns (google.protobuf.Empty) {} + // 私聊消息 + rpc OnPrivateMsg(CommonMsg) returns (google.protobuf.Empty) {} + // 插件卸载 保存资料 最大等待 2s + rpc Unload(google.protobuf.Empty) returns (google.protobuf.Empty) {} + // 周期任务唤醒 + rpc OnCronEvent(CronEventReq) returns (google.protobuf.Empty) {} + // 其他插件调用本插件事件 + rpc OnRemoteCallEvent(RemoteCallReq) returns (RemoteCallReply) {} +} +``` \ No newline at end of file diff --git "a/web/docs/\346\217\222\344\273\266\347\274\226\345\206\231/\346\217\222\344\273\266API.md" "b/web/docs/\346\217\222\344\273\266\347\274\226\345\206\231/\346\217\222\344\273\266API.md" new file mode 100644 index 0000000..2b9229b --- /dev/null +++ "b/web/docs/\346\217\222\344\273\266\347\274\226\345\206\231/\346\217\222\344\273\266API.md" @@ -0,0 +1,49 @@ +# 插件API + +## Log +打印日志信息 +```go +proto.NewApi().Log(ctx, &proto.LogReq{ + LogType: proto.LogType_Info, + Msg: "来自插件的消息欧~", +}) +``` + +## Http +对外发送 HTTP 请求 +```go +proto.NewApi().Http(ctx, &proto.HttpReq{ + Url: url, + Method: proto.HttpMethod_GET, + Header: header, + Content: nil, +}) +``` + +## SendGroupMsg +发送群消息 +```go +_, _ = api.SendGroupMsg(ctx, &proto.MsgReq{ + ToUin: msg.FromUin, + Msg: &proto.MsgReq_TextMsg{TextMsg: &proto.TextMsg{Text: "周期任务测试"}}, + BotUin: msg.SelfId, +}) +``` + +## SendFriendMsg +发送好友消息 + +## SendPrivateMsg +发送私聊消息 + +## Upload +上传文件到tx服务器 + +## RegisterCronJob +注册周期任务 + +## RemoveCronJob +移除周期任务 + +## RemoteCall +调用其他插件的功能 \ No newline at end of file diff --git "a/web/docs/\346\217\222\344\273\266\347\274\226\345\206\231/\346\235\203\351\231\220\347\224\263\350\257\267.md" "b/web/docs/\346\217\222\344\273\266\347\274\226\345\206\231/\346\235\203\351\231\220\347\224\263\350\257\267.md" new file mode 100644 index 0000000..0a5c854 --- /dev/null +++ "b/web/docs/\346\217\222\344\273\266\347\274\226\345\206\231/\346\235\203\351\231\220\347\224\263\350\257\267.md" @@ -0,0 +1,12 @@ +# 权限申请 + +可以查看到Meta文件,也就是插件源代码目录下的 `meta.json` + +<<< @../../../plugins/example/meta.json + +其中`Permissions`就是声明插件需要申请的权限,具体权限有: + +<<< @../../../plugin/meta/meta.go{go} + +## 特殊说明 +`RemoteCallEventPermission`远程调用权限调用插件与被调用插件都需要申请该权限 diff --git "a/web/docs/\346\217\222\344\273\266\347\274\226\345\206\231/\347\216\257\345\242\203\351\205\215\347\275\256.md" "b/web/docs/\346\217\222\344\273\266\347\274\226\345\206\231/\347\216\257\345\242\203\351\205\215\347\275\256.md" new file mode 100644 index 0000000..62e0e1a --- /dev/null +++ "b/web/docs/\346\217\222\344\273\266\347\274\226\345\206\231/\347\216\257\345\242\203\351\205\215\347\275\256.md" @@ -0,0 +1,38 @@ +# 环境配置 + +## tinygo 安装 + +[tinyGO官网](https://tinygo.org/getting-started/install/) + +当出现下面错误时 + +`error: could not find wasm-opt, set the WASMOPT environment variable to override` + +你可以尝试下面的方法 +::: code-group +```bash [Linux] +sudo npm i wasm-opt -g +``` +```bash [Windows] +下载 https://github.com/WebAssembly/binaryen/releases 对应文件 +解压到 tinyGo 根目录 +``` +::: + +## Yui-Cli + +[Github Release](https://github.com/opq-osc/Yui/releases/) + +::: details 若想编译 Yui 还需要安装下面的依赖 +- [grpc protoc](https://grpc.io/docs/protoc-installation/) + +- [go grpc plugin](https://grpc.io/docs/languages/go/quickstart/) + +- [knqyf263/go-plugin Github](https://github.com/knqyf263/go-plugin#installation) +::: + +## 编译 +```bash +yui-cli build ./plugins/signPlugin/signPlugin.go +``` +编译完成后会在plugins目录下生成 `signPlugin.opq` 文件 \ No newline at end of file diff --git a/web/package.json b/web/package.json new file mode 100644 index 0000000..198c473 --- /dev/null +++ b/web/package.json @@ -0,0 +1,18 @@ +{ + "name": "web", + "version": "1.0.0", + "description": "Yui文档站", + "author": "enjoy", + "license": "MIT", + "devDependencies": { + "vitepress": "^1.0.0-alpha.74" + }, + "scripts": { + "docs:dev": "vitepress dev docs", + "docs:build": "vitepress build docs", + "docs:serve": "vitepress serve docs" + }, + "compilerOptions": { + "lib": ["ES2021", "dom"] + } +} diff --git a/web/tsconfig.json b/web/tsconfig.json new file mode 100644 index 0000000..60b3983 --- /dev/null +++ b/web/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "esnext", + "target": "esnext", + "moduleResolution": "node", + "esModuleInterop": true, + "strict": true, + "skipLibCheck": true, + "noUnusedLocals": true, + "resolveJsonModule": true, + "verbatimModuleSyntax": true, + "jsx": "preserve", + "lib": ["esnext", "dom", "dom.iterable"] + }, + "exclude": ["**/node_modules/**", "**/dist/**", "template"] +} \ No newline at end of file diff --git a/web/yarn.lock b/web/yarn.lock new file mode 100644 index 0000000..9f0d20b --- /dev/null +++ b/web/yarn.lock @@ -0,0 +1,596 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@algolia/autocomplete-core@1.8.2": + version "1.8.2" + resolved "https://registry.npmmirror.com/@algolia/autocomplete-core/-/autocomplete-core-1.8.2.tgz#8d758c8652742e2761450d2b615a841fca24e10e" + integrity sha512-mTeshsyFhAqw/ebqNsQpMtbnjr+qVOSKXArEj4K0d7sqc8It1XD0gkASwecm9mF/jlOQ4Z9RNg1HbdA8JPdRwQ== + dependencies: + "@algolia/autocomplete-shared" "1.8.2" + +"@algolia/autocomplete-preset-algolia@1.8.2": + version "1.8.2" + resolved "https://registry.npmmirror.com/@algolia/autocomplete-preset-algolia/-/autocomplete-preset-algolia-1.8.2.tgz#706e87f94c5f198c0e90502b97af09adeeddcc79" + integrity sha512-J0oTx4me6ZM9kIKPuL3lyU3aB8DEvpVvR6xWmHVROx5rOYJGQcZsdG4ozxwcOyiiu3qxMkIbzntnV1S1VWD8yA== + dependencies: + "@algolia/autocomplete-shared" "1.8.2" + +"@algolia/autocomplete-shared@1.8.2": + version "1.8.2" + resolved "https://registry.npmmirror.com/@algolia/autocomplete-shared/-/autocomplete-shared-1.8.2.tgz#e6972df5c6935a241f16e4909aa82902338e029d" + integrity sha512-b6Z/X4MczChMcfhk6kfRmBzPgjoPzuS9KGR4AFsiLulLNRAAqhP+xZTKtMnZGhLuc61I20d5WqlId02AZvcO6g== + +"@algolia/cache-browser-local-storage@4.17.0": + version "4.17.0" + resolved "https://registry.npmmirror.com/@algolia/cache-browser-local-storage/-/cache-browser-local-storage-4.17.0.tgz#4c54a9b1795dcc1cd9f9533144f7df3057984d39" + integrity sha512-myRSRZDIMYB8uCkO+lb40YKiYHi0fjpWRtJpR/dgkaiBlSD0plRyB6lLOh1XIfmMcSeBOqDE7y9m8xZMrXYfyQ== + dependencies: + "@algolia/cache-common" "4.17.0" + +"@algolia/cache-common@4.17.0": + version "4.17.0" + resolved "https://registry.npmmirror.com/@algolia/cache-common/-/cache-common-4.17.0.tgz#bc3da15548df585b44d76c55e66b0056a2b3f917" + integrity sha512-g8mXzkrcUBIPZaulAuqE7xyHhLAYAcF2xSch7d9dABheybaU3U91LjBX6eJTEB7XVhEsgK4Smi27vWtAJRhIKQ== + +"@algolia/cache-in-memory@4.17.0": + version "4.17.0" + resolved "https://registry.npmmirror.com/@algolia/cache-in-memory/-/cache-in-memory-4.17.0.tgz#eb55a92cb8eb8641903a2b23fd6d05ebdaca2010" + integrity sha512-PT32ciC/xI8z919d0oknWVu3kMfTlhQn3MKxDln3pkn+yA7F7xrxSALysxquv+MhFfNAcrtQ/oVvQVBAQSHtdw== + dependencies: + "@algolia/cache-common" "4.17.0" + +"@algolia/client-account@4.17.0": + version "4.17.0" + resolved "https://registry.npmmirror.com/@algolia/client-account/-/client-account-4.17.0.tgz#4b13e5a8e50a06be1f3289d9db337096ebc66b73" + integrity sha512-sSEHx9GA6m7wrlsSMNBGfyzlIfDT2fkz2u7jqfCCd6JEEwmxt8emGmxAU/0qBfbhRSuGvzojoLJlr83BSZAKjA== + dependencies: + "@algolia/client-common" "4.17.0" + "@algolia/client-search" "4.17.0" + "@algolia/transporter" "4.17.0" + +"@algolia/client-analytics@4.17.0": + version "4.17.0" + resolved "https://registry.npmmirror.com/@algolia/client-analytics/-/client-analytics-4.17.0.tgz#1b36ffbe913b7b4d8900bc15982ca431f47a473c" + integrity sha512-84ooP8QA3mQ958hQ9wozk7hFUbAO+81CX1CjAuerxBqjKIInh1fOhXKTaku05O/GHBvcfExpPLIQuSuLYziBXQ== + dependencies: + "@algolia/client-common" "4.17.0" + "@algolia/client-search" "4.17.0" + "@algolia/requester-common" "4.17.0" + "@algolia/transporter" "4.17.0" + +"@algolia/client-common@4.17.0": + version "4.17.0" + resolved "https://registry.npmmirror.com/@algolia/client-common/-/client-common-4.17.0.tgz#67fd898006e3ac359ea3e3ed61abfc26147ffa53" + integrity sha512-jHMks0ZFicf8nRDn6ma8DNNsdwGgP/NKiAAL9z6rS7CymJ7L0+QqTJl3rYxRW7TmBhsUH40wqzmrG6aMIN/DrQ== + dependencies: + "@algolia/requester-common" "4.17.0" + "@algolia/transporter" "4.17.0" + +"@algolia/client-personalization@4.17.0": + version "4.17.0" + resolved "https://registry.npmmirror.com/@algolia/client-personalization/-/client-personalization-4.17.0.tgz#428d9f4762c22856b6062bb54351eb31834db6c1" + integrity sha512-RMzN4dZLIta1YuwT7QC9o+OeGz2cU6eTOlGNE/6RcUBLOU3l9tkCOdln5dPE2jp8GZXPl2yk54b2nSs1+pAjqw== + dependencies: + "@algolia/client-common" "4.17.0" + "@algolia/requester-common" "4.17.0" + "@algolia/transporter" "4.17.0" + +"@algolia/client-search@4.17.0": + version "4.17.0" + resolved "https://registry.npmmirror.com/@algolia/client-search/-/client-search-4.17.0.tgz#0053c682f5f588e006c20791c27e8bcb0aa5b53c" + integrity sha512-x4P2wKrrRIXszT8gb7eWsMHNNHAJs0wE7/uqbufm4tZenAp+hwU/hq5KVsY50v+PfwM0LcDwwn/1DroujsTFoA== + dependencies: + "@algolia/client-common" "4.17.0" + "@algolia/requester-common" "4.17.0" + "@algolia/transporter" "4.17.0" + +"@algolia/logger-common@4.17.0": + version "4.17.0" + resolved "https://registry.npmmirror.com/@algolia/logger-common/-/logger-common-4.17.0.tgz#0fcea39c9485554edb4cdbfd965c5748b0b837ac" + integrity sha512-DGuoZqpTmIKJFDeyAJ7M8E/LOenIjWiOsg1XJ1OqAU/eofp49JfqXxbfgctlVZVmDABIyOz8LqEoJ6ZP4DTyvw== + +"@algolia/logger-console@4.17.0": + version "4.17.0" + resolved "https://registry.npmmirror.com/@algolia/logger-console/-/logger-console-4.17.0.tgz#8ac56ef4259c4fa3eb9eb6586c7b4b4ed942e8da" + integrity sha512-zMPvugQV/gbXUvWBCzihw6m7oxIKp48w37QBIUu/XqQQfxhjoOE9xyfJr1KldUt5FrYOKZJVsJaEjTsu+bIgQg== + dependencies: + "@algolia/logger-common" "4.17.0" + +"@algolia/requester-browser-xhr@4.17.0": + version "4.17.0" + resolved "https://registry.npmmirror.com/@algolia/requester-browser-xhr/-/requester-browser-xhr-4.17.0.tgz#f52fdeeac2f3c531f00838920af33a73066a159b" + integrity sha512-aSOX/smauyTkP21Pf52pJ1O2LmNFJ5iHRIzEeTh0mwBeADO4GdG94cAWDILFA9rNblq/nK3EDh3+UyHHjplZ1A== + dependencies: + "@algolia/requester-common" "4.17.0" + +"@algolia/requester-common@4.17.0": + version "4.17.0" + resolved "https://registry.npmmirror.com/@algolia/requester-common/-/requester-common-4.17.0.tgz#746020d2cbc829213e7cede8eef2182c7a71e32b" + integrity sha512-XJjmWFEUlHu0ijvcHBoixuXfEoiRUdyzQM6YwTuB8usJNIgShua8ouFlRWF8iCeag0vZZiUm4S2WCVBPkdxFgg== + +"@algolia/requester-node-http@4.17.0": + version "4.17.0" + resolved "https://registry.npmmirror.com/@algolia/requester-node-http/-/requester-node-http-4.17.0.tgz#262276d94c25a4ec2128b1bdfb9471529528d8b9" + integrity sha512-bpb/wDA1aC6WxxM8v7TsFspB7yBN3nqCGs2H1OADolQR/hiAIjAxusbuMxVbRFOdaUvAIqioIIkWvZdpYNIn8w== + dependencies: + "@algolia/requester-common" "4.17.0" + +"@algolia/transporter@4.17.0": + version "4.17.0" + resolved "https://registry.npmmirror.com/@algolia/transporter/-/transporter-4.17.0.tgz#6aabdbc20c475d72d83c8e6519f1191f1a51fb37" + integrity sha512-6xL6H6fe+Fi0AEP3ziSgC+G04RK37iRb4uUUqVAH9WPYFI8g+LYFq6iv5HS8Cbuc5TTut+Bwj6G+dh/asdb9uA== + dependencies: + "@algolia/cache-common" "4.17.0" + "@algolia/logger-common" "4.17.0" + "@algolia/requester-common" "4.17.0" + +"@babel/parser@^7.16.4": + version "7.21.5" + resolved "https://registry.npmmirror.com/@babel/parser/-/parser-7.21.5.tgz#821bb520118fd25b982eaf8d37421cf5c64a312b" + integrity sha512-J+IxH2IsxV4HbnTrSWgMAQj0UEo61hDA4Ny8h8PCX0MLXiibqHbqIOVneqdocemSBc22VpBKxt4J6FQzy9HarQ== + +"@docsearch/css@3.3.4", "@docsearch/css@^3.3.3": + version "3.3.4" + resolved "https://registry.npmmirror.com/@docsearch/css/-/css-3.3.4.tgz#533719eac0aa3934318074e7e981e633727ad2fd" + integrity sha512-vDwCDoVXDgopw/hvr0zEADew2wWaGP8Qq0Bxhgii1Ewz2t4fQeyJwIRN/mWADeLFYPVkpz8TpEbxya/i6Tm0WA== + +"@docsearch/js@^3.3.3": + version "3.3.4" + resolved "https://registry.npmmirror.com/@docsearch/js/-/js-3.3.4.tgz#9ac4192f55535904a4c4235ee936ef11a109461c" + integrity sha512-Xd2saBziXJ1UuVpcDz94zAFEFAM6ap993agh0za2e3LDZLhaW993b1f9gyUL4e1CZLsR076tztG2un2gVncvpA== + dependencies: + "@docsearch/react" "3.3.4" + preact "^10.0.0" + +"@docsearch/react@3.3.4": + version "3.3.4" + resolved "https://registry.npmmirror.com/@docsearch/react/-/react-3.3.4.tgz#d49cf9e5d939145c9fe688113c5bdf41975d8ae7" + integrity sha512-aeOf1WC5zMzBEi2SI6WWznOmIo9rnpN4p7a3zHXxowVciqlI4HsZGtOR9nFOufLeolv7HibwLlaM0oyUqJxasw== + dependencies: + "@algolia/autocomplete-core" "1.8.2" + "@algolia/autocomplete-preset-algolia" "1.8.2" + "@docsearch/css" "3.3.4" + algoliasearch "^4.0.0" + +"@esbuild/android-arm64@0.17.18": + version "0.17.18" + resolved "https://registry.npmmirror.com/@esbuild/android-arm64/-/android-arm64-0.17.18.tgz#4aa8d8afcffb4458736ca9b32baa97d7cb5861ea" + integrity sha512-/iq0aK0eeHgSC3z55ucMAHO05OIqmQehiGay8eP5l/5l+iEr4EIbh4/MI8xD9qRFjqzgkc0JkX0LculNC9mXBw== + +"@esbuild/android-arm@0.17.18": + version "0.17.18" + resolved "https://registry.npmmirror.com/@esbuild/android-arm/-/android-arm-0.17.18.tgz#74a7e95af4ee212ebc9db9baa87c06a594f2a427" + integrity sha512-EmwL+vUBZJ7mhFCs5lA4ZimpUH3WMAoqvOIYhVQwdIgSpHC8ImHdsRyhHAVxpDYUSm0lWvd63z0XH1IlImS2Qw== + +"@esbuild/android-x64@0.17.18": + version "0.17.18" + resolved "https://registry.npmmirror.com/@esbuild/android-x64/-/android-x64-0.17.18.tgz#1dcd13f201997c9fe0b204189d3a0da4eb4eb9b6" + integrity sha512-x+0efYNBF3NPW2Xc5bFOSFW7tTXdAcpfEg2nXmxegm4mJuVeS+i109m/7HMiOQ6M12aVGGFlqJX3RhNdYM2lWg== + +"@esbuild/darwin-arm64@0.17.18": + version "0.17.18" + resolved "https://registry.npmmirror.com/@esbuild/darwin-arm64/-/darwin-arm64-0.17.18.tgz#444f3b961d4da7a89eb9bd35cfa4415141537c2a" + integrity sha512-6tY+djEAdF48M1ONWnQb1C+6LiXrKjmqjzPNPWXhu/GzOHTHX2nh8Mo2ZAmBFg0kIodHhciEgUBtcYCAIjGbjQ== + +"@esbuild/darwin-x64@0.17.18": + version "0.17.18" + resolved "https://registry.npmmirror.com/@esbuild/darwin-x64/-/darwin-x64-0.17.18.tgz#a6da308d0ac8a498c54d62e0b2bfb7119b22d315" + integrity sha512-Qq84ykvLvya3dO49wVC9FFCNUfSrQJLbxhoQk/TE1r6MjHo3sFF2tlJCwMjhkBVq3/ahUisj7+EpRSz0/+8+9A== + +"@esbuild/freebsd-arm64@0.17.18": + version "0.17.18" + resolved "https://registry.npmmirror.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.17.18.tgz#b83122bb468889399d0d63475d5aea8d6829c2c2" + integrity sha512-fw/ZfxfAzuHfaQeMDhbzxp9mc+mHn1Y94VDHFHjGvt2Uxl10mT4CDavHm+/L9KG441t1QdABqkVYwakMUeyLRA== + +"@esbuild/freebsd-x64@0.17.18": + version "0.17.18" + resolved "https://registry.npmmirror.com/@esbuild/freebsd-x64/-/freebsd-x64-0.17.18.tgz#af59e0e03fcf7f221b34d4c5ab14094862c9c864" + integrity sha512-FQFbRtTaEi8ZBi/A6kxOC0V0E9B/97vPdYjY9NdawyLd4Qk5VD5g2pbWN2VR1c0xhzcJm74HWpObPszWC+qTew== + +"@esbuild/linux-arm64@0.17.18": + version "0.17.18" + resolved "https://registry.npmmirror.com/@esbuild/linux-arm64/-/linux-arm64-0.17.18.tgz#8551d72ba540c5bce4bab274a81c14ed01eafdcf" + integrity sha512-R7pZvQZFOY2sxUG8P6A21eq6q+eBv7JPQYIybHVf1XkQYC+lT7nDBdC7wWKTrbvMXKRaGudp/dzZCwL/863mZQ== + +"@esbuild/linux-arm@0.17.18": + version "0.17.18" + resolved "https://registry.npmmirror.com/@esbuild/linux-arm/-/linux-arm-0.17.18.tgz#e09e76e526df4f665d4d2720d28ff87d15cdf639" + integrity sha512-jW+UCM40LzHcouIaqv3e/oRs0JM76JfhHjCavPxMUti7VAPh8CaGSlS7cmyrdpzSk7A+8f0hiedHqr/LMnfijg== + +"@esbuild/linux-ia32@0.17.18": + version "0.17.18" + resolved "https://registry.npmmirror.com/@esbuild/linux-ia32/-/linux-ia32-0.17.18.tgz#47878860ce4fe73a36fd8627f5647bcbbef38ba4" + integrity sha512-ygIMc3I7wxgXIxk6j3V00VlABIjq260i967Cp9BNAk5pOOpIXmd1RFQJQX9Io7KRsthDrQYrtcx7QCof4o3ZoQ== + +"@esbuild/linux-loong64@0.17.18": + version "0.17.18" + resolved "https://registry.npmmirror.com/@esbuild/linux-loong64/-/linux-loong64-0.17.18.tgz#3f8fbf5267556fc387d20b2e708ce115de5c967a" + integrity sha512-bvPG+MyFs5ZlwYclCG1D744oHk1Pv7j8psF5TfYx7otCVmcJsEXgFEhQkbhNW8otDHL1a2KDINW20cfCgnzgMQ== + +"@esbuild/linux-mips64el@0.17.18": + version "0.17.18" + resolved "https://registry.npmmirror.com/@esbuild/linux-mips64el/-/linux-mips64el-0.17.18.tgz#9d896d8f3c75f6c226cbeb840127462e37738226" + integrity sha512-oVqckATOAGuiUOa6wr8TXaVPSa+6IwVJrGidmNZS1cZVx0HqkTMkqFGD2HIx9H1RvOwFeWYdaYbdY6B89KUMxA== + +"@esbuild/linux-ppc64@0.17.18": + version "0.17.18" + resolved "https://registry.npmmirror.com/@esbuild/linux-ppc64/-/linux-ppc64-0.17.18.tgz#3d9deb60b2d32c9985bdc3e3be090d30b7472783" + integrity sha512-3dLlQO+b/LnQNxgH4l9rqa2/IwRJVN9u/bK63FhOPB4xqiRqlQAU0qDU3JJuf0BmaH0yytTBdoSBHrb2jqc5qQ== + +"@esbuild/linux-riscv64@0.17.18": + version "0.17.18" + resolved "https://registry.npmmirror.com/@esbuild/linux-riscv64/-/linux-riscv64-0.17.18.tgz#8a943cf13fd24ff7ed58aefb940ef178f93386bc" + integrity sha512-/x7leOyDPjZV3TcsdfrSI107zItVnsX1q2nho7hbbQoKnmoeUWjs+08rKKt4AUXju7+3aRZSsKrJtaRmsdL1xA== + +"@esbuild/linux-s390x@0.17.18": + version "0.17.18" + resolved "https://registry.npmmirror.com/@esbuild/linux-s390x/-/linux-s390x-0.17.18.tgz#66cb01f4a06423e5496facabdce4f7cae7cb80e5" + integrity sha512-cX0I8Q9xQkL/6F5zWdYmVf5JSQt+ZfZD2bJudZrWD+4mnUvoZ3TDDXtDX2mUaq6upMFv9FlfIh4Gfun0tbGzuw== + +"@esbuild/linux-x64@0.17.18": + version "0.17.18" + resolved "https://registry.npmmirror.com/@esbuild/linux-x64/-/linux-x64-0.17.18.tgz#23c26050c6c5d1359c7b774823adc32b3883b6c9" + integrity sha512-66RmRsPlYy4jFl0vG80GcNRdirx4nVWAzJmXkevgphP1qf4dsLQCpSKGM3DUQCojwU1hnepI63gNZdrr02wHUA== + +"@esbuild/netbsd-x64@0.17.18": + version "0.17.18" + resolved "https://registry.npmmirror.com/@esbuild/netbsd-x64/-/netbsd-x64-0.17.18.tgz#789a203d3115a52633ff6504f8cbf757f15e703b" + integrity sha512-95IRY7mI2yrkLlTLb1gpDxdC5WLC5mZDi+kA9dmM5XAGxCME0F8i4bYH4jZreaJ6lIZ0B8hTrweqG1fUyW7jbg== + +"@esbuild/openbsd-x64@0.17.18": + version "0.17.18" + resolved "https://registry.npmmirror.com/@esbuild/openbsd-x64/-/openbsd-x64-0.17.18.tgz#d7b998a30878f8da40617a10af423f56f12a5e90" + integrity sha512-WevVOgcng+8hSZ4Q3BKL3n1xTv5H6Nb53cBrtzzEjDbbnOmucEVcZeGCsCOi9bAOcDYEeBZbD2SJNBxlfP3qiA== + +"@esbuild/sunos-x64@0.17.18": + version "0.17.18" + resolved "https://registry.npmmirror.com/@esbuild/sunos-x64/-/sunos-x64-0.17.18.tgz#ecad0736aa7dae07901ba273db9ef3d3e93df31f" + integrity sha512-Rzf4QfQagnwhQXVBS3BYUlxmEbcV7MY+BH5vfDZekU5eYpcffHSyjU8T0xucKVuOcdCsMo+Ur5wmgQJH2GfNrg== + +"@esbuild/win32-arm64@0.17.18": + version "0.17.18" + resolved "https://registry.npmmirror.com/@esbuild/win32-arm64/-/win32-arm64-0.17.18.tgz#58dfc177da30acf956252d7c8ae9e54e424887c4" + integrity sha512-Kb3Ko/KKaWhjeAm2YoT/cNZaHaD1Yk/pa3FTsmqo9uFh1D1Rfco7BBLIPdDOozrObj2sahslFuAQGvWbgWldAg== + +"@esbuild/win32-ia32@0.17.18": + version "0.17.18" + resolved "https://registry.npmmirror.com/@esbuild/win32-ia32/-/win32-ia32-0.17.18.tgz#340f6163172b5272b5ae60ec12c312485f69232b" + integrity sha512-0/xUMIdkVHwkvxfbd5+lfG7mHOf2FRrxNbPiKWg9C4fFrB8H0guClmaM3BFiRUYrznVoyxTIyC/Ou2B7QQSwmw== + +"@esbuild/win32-x64@0.17.18": + version "0.17.18" + resolved "https://registry.npmmirror.com/@esbuild/win32-x64/-/win32-x64-0.17.18.tgz#3a8e57153905308db357fd02f57c180ee3a0a1fa" + integrity sha512-qU25Ma1I3NqTSHJUOKi9sAH1/Mzuvlke0ioMJRthLXKm7JiSKVwFghlGbDLOO2sARECGhja4xYfRAZNPAkooYg== + +"@types/web-bluetooth@^0.0.16": + version "0.0.16" + resolved "https://registry.npmmirror.com/@types/web-bluetooth/-/web-bluetooth-0.0.16.tgz#1d12873a8e49567371f2a75fe3e7f7edca6662d8" + integrity sha512-oh8q2Zc32S6gd/j50GowEjKLoOVOwHP/bWVjKJInBwQqdOYMdPrf1oVlelTlyfFK3CKxL1uahMDAr+vy8T7yMQ== + +"@vitejs/plugin-vue@^4.1.0": + version "4.2.1" + resolved "https://registry.npmmirror.com/@vitejs/plugin-vue/-/plugin-vue-4.2.1.tgz#c3ccce9956e8cdca946f465188777e4e3e488f6a" + integrity sha512-ZTZjzo7bmxTRTkb8GSTwkPOYDIP7pwuyV+RV53c9PYUouwcbkIZIvWvNWlX2b1dYZqtOv7D6iUAnJLVNGcLrSw== + +"@vue/compiler-core@3.2.47": + version "3.2.47" + resolved "https://registry.npmmirror.com/@vue/compiler-core/-/compiler-core-3.2.47.tgz#3e07c684d74897ac9aa5922c520741f3029267f8" + integrity sha512-p4D7FDnQb7+YJmO2iPEv0SQNeNzcbHdGByJDsT4lynf63AFkOTFN07HsiRSvjGo0QrxR/o3d0hUyNCUnBU2Tig== + dependencies: + "@babel/parser" "^7.16.4" + "@vue/shared" "3.2.47" + estree-walker "^2.0.2" + source-map "^0.6.1" + +"@vue/compiler-dom@3.2.47": + version "3.2.47" + resolved "https://registry.npmmirror.com/@vue/compiler-dom/-/compiler-dom-3.2.47.tgz#a0b06caf7ef7056939e563dcaa9cbde30794f305" + integrity sha512-dBBnEHEPoftUiS03a4ggEig74J2YBZ2UIeyfpcRM2tavgMWo4bsEfgCGsu+uJIL/vax9S+JztH8NmQerUo7shQ== + dependencies: + "@vue/compiler-core" "3.2.47" + "@vue/shared" "3.2.47" + +"@vue/compiler-sfc@3.2.47": + version "3.2.47" + resolved "https://registry.npmmirror.com/@vue/compiler-sfc/-/compiler-sfc-3.2.47.tgz#1bdc36f6cdc1643f72e2c397eb1a398f5004ad3d" + integrity sha512-rog05W+2IFfxjMcFw10tM9+f7i/+FFpZJJ5XHX72NP9eC2uRD+42M3pYcQqDXVYoj74kHMSEdQ/WmCjt8JFksQ== + dependencies: + "@babel/parser" "^7.16.4" + "@vue/compiler-core" "3.2.47" + "@vue/compiler-dom" "3.2.47" + "@vue/compiler-ssr" "3.2.47" + "@vue/reactivity-transform" "3.2.47" + "@vue/shared" "3.2.47" + estree-walker "^2.0.2" + magic-string "^0.25.7" + postcss "^8.1.10" + source-map "^0.6.1" + +"@vue/compiler-ssr@3.2.47": + version "3.2.47" + resolved "https://registry.npmmirror.com/@vue/compiler-ssr/-/compiler-ssr-3.2.47.tgz#35872c01a273aac4d6070ab9d8da918ab13057ee" + integrity sha512-wVXC+gszhulcMD8wpxMsqSOpvDZ6xKXSVWkf50Guf/S+28hTAXPDYRTbLQ3EDkOP5Xz/+SY37YiwDquKbJOgZw== + dependencies: + "@vue/compiler-dom" "3.2.47" + "@vue/shared" "3.2.47" + +"@vue/devtools-api@^6.5.0": + version "6.5.0" + resolved "https://registry.npmmirror.com/@vue/devtools-api/-/devtools-api-6.5.0.tgz#98b99425edee70b4c992692628fa1ea2c1e57d07" + integrity sha512-o9KfBeaBmCKl10usN4crU53fYtC1r7jJwdGKjPT24t348rHxgfpZ0xL3Xm/gLUYnc0oTp8LAmrxOeLyu6tbk2Q== + +"@vue/reactivity-transform@3.2.47": + version "3.2.47" + resolved "https://registry.npmmirror.com/@vue/reactivity-transform/-/reactivity-transform-3.2.47.tgz#e45df4d06370f8abf29081a16afd25cffba6d84e" + integrity sha512-m8lGXw8rdnPVVIdIFhf0LeQ/ixyHkH5plYuS83yop5n7ggVJU+z5v0zecwEnX7fa7HNLBhh2qngJJkxpwEEmYA== + dependencies: + "@babel/parser" "^7.16.4" + "@vue/compiler-core" "3.2.47" + "@vue/shared" "3.2.47" + estree-walker "^2.0.2" + magic-string "^0.25.7" + +"@vue/reactivity@3.2.47": + version "3.2.47" + resolved "https://registry.npmmirror.com/@vue/reactivity/-/reactivity-3.2.47.tgz#1d6399074eadfc3ed35c727e2fd707d6881140b6" + integrity sha512-7khqQ/75oyyg+N/e+iwV6lpy1f5wq759NdlS1fpAhFXa8VeAIKGgk2E/C4VF59lx5b+Ezs5fpp/5WsRYXQiKxQ== + dependencies: + "@vue/shared" "3.2.47" + +"@vue/runtime-core@3.2.47": + version "3.2.47" + resolved "https://registry.npmmirror.com/@vue/runtime-core/-/runtime-core-3.2.47.tgz#406ebade3d5551c00fc6409bbc1eeb10f32e121d" + integrity sha512-RZxbLQIRB/K0ev0K9FXhNbBzT32H9iRtYbaXb0ZIz2usLms/D55dJR2t6cIEUn6vyhS3ALNvNthI+Q95C+NOpA== + dependencies: + "@vue/reactivity" "3.2.47" + "@vue/shared" "3.2.47" + +"@vue/runtime-dom@3.2.47": + version "3.2.47" + resolved "https://registry.npmmirror.com/@vue/runtime-dom/-/runtime-dom-3.2.47.tgz#93e760eeaeab84dedfb7c3eaf3ed58d776299382" + integrity sha512-ArXrFTjS6TsDei4qwNvgrdmHtD930KgSKGhS5M+j8QxXrDJYLqYw4RRcDy1bz1m1wMmb6j+zGLifdVHtkXA7gA== + dependencies: + "@vue/runtime-core" "3.2.47" + "@vue/shared" "3.2.47" + csstype "^2.6.8" + +"@vue/server-renderer@3.2.47": + version "3.2.47" + resolved "https://registry.npmmirror.com/@vue/server-renderer/-/server-renderer-3.2.47.tgz#8aa1d1871fc4eb5a7851aa7f741f8f700e6de3c0" + integrity sha512-dN9gc1i8EvmP9RCzvneONXsKfBRgqFeFZLurmHOveL7oH6HiFXJw5OGu294n1nHc/HMgTy6LulU/tv5/A7f/LA== + dependencies: + "@vue/compiler-ssr" "3.2.47" + "@vue/shared" "3.2.47" + +"@vue/shared@3.2.47": + version "3.2.47" + resolved "https://registry.npmmirror.com/@vue/shared/-/shared-3.2.47.tgz#e597ef75086c6e896ff5478a6bfc0a7aa4bbd14c" + integrity sha512-BHGyyGN3Q97EZx0taMQ+OLNuZcW3d37ZEVmEAyeoA9ERdGvm9Irc/0Fua8SNyOtV1w6BS4q25wbMzJujO9HIfQ== + +"@vueuse/core@^10.1.0": + version "10.1.0" + resolved "https://registry.npmmirror.com/@vueuse/core/-/core-10.1.0.tgz#7c3246bea35b24298040b2576de06ce87f38f4c6" + integrity sha512-3Znoa5m5RO+z4/C9w6DRaKTR3wCVJvD5rav8HTDGsr+7rOZRHtcgFJ8NcCs0ZvIpmev2kExTa311ns5j2RbzDQ== + dependencies: + "@types/web-bluetooth" "^0.0.16" + "@vueuse/metadata" "10.1.0" + "@vueuse/shared" "10.1.0" + vue-demi ">=0.14.0" + +"@vueuse/metadata@10.1.0": + version "10.1.0" + resolved "https://registry.npmmirror.com/@vueuse/metadata/-/metadata-10.1.0.tgz#041ab49abb17e760170606199c612c8937d2968f" + integrity sha512-cM28HjDEw5FIrPE9rgSPFZvQ0ZYnOLAOr8hl1XM6tFl80U3WAR5ROdnAqiYybniwP5gt9MKKAJAqd/ab2aHkqg== + +"@vueuse/shared@10.1.0": + version "10.1.0" + resolved "https://registry.npmmirror.com/@vueuse/shared/-/shared-10.1.0.tgz#1158713a69d33b84c473dbd078c0e8c587e6ab5f" + integrity sha512-2X52ogu12i9DkKOQ01yeb/BKg9UO87RNnpm5sXkQvyORlbq8ONS5l39MYkjkeVWWjdT0teJru7a2S41dmHmqjQ== + dependencies: + vue-demi ">=0.14.0" + +algoliasearch@^4.0.0: + version "4.17.0" + resolved "https://registry.npmmirror.com/algoliasearch/-/algoliasearch-4.17.0.tgz#46ed58b2b99509d041f11cd1ea83623edf84355f" + integrity sha512-JMRh2Mw6sEnVMiz6+APsi7lx9a2jiDFF+WUtANaUVCv6uSU9UOLdo5h9K3pdP6frRRybaM2fX8b1u0nqICS9aA== + dependencies: + "@algolia/cache-browser-local-storage" "4.17.0" + "@algolia/cache-common" "4.17.0" + "@algolia/cache-in-memory" "4.17.0" + "@algolia/client-account" "4.17.0" + "@algolia/client-analytics" "4.17.0" + "@algolia/client-common" "4.17.0" + "@algolia/client-personalization" "4.17.0" + "@algolia/client-search" "4.17.0" + "@algolia/logger-common" "4.17.0" + "@algolia/logger-console" "4.17.0" + "@algolia/requester-browser-xhr" "4.17.0" + "@algolia/requester-common" "4.17.0" + "@algolia/requester-node-http" "4.17.0" + "@algolia/transporter" "4.17.0" + +ansi-sequence-parser@^1.1.0: + version "1.1.0" + resolved "https://registry.npmmirror.com/ansi-sequence-parser/-/ansi-sequence-parser-1.1.0.tgz#4d790f31236ac20366b23b3916b789e1bde39aed" + integrity sha512-lEm8mt52to2fT8GhciPCGeCXACSz2UwIN4X2e2LJSnZ5uAbn2/dsYdOmUXq0AtWS5cpAupysIneExOgH0Vd2TQ== + +body-scroll-lock@4.0.0-beta.0: + version "4.0.0-beta.0" + resolved "https://registry.npmmirror.com/body-scroll-lock/-/body-scroll-lock-4.0.0-beta.0.tgz#4f78789d10e6388115c0460cd6d7d4dd2bbc4f7e" + integrity sha512-a7tP5+0Mw3YlUJcGAKUqIBkYYGlYxk2fnCasq/FUph1hadxlTRjF+gAcZksxANnaMnALjxEddmSi/H3OR8ugcQ== + +csstype@^2.6.8: + version "2.6.21" + resolved "https://registry.npmmirror.com/csstype/-/csstype-2.6.21.tgz#2efb85b7cc55c80017c66a5ad7cbd931fda3a90e" + integrity sha512-Z1PhmomIfypOpoMjRQB70jfvy/wxT50qW08YXO5lMIJkrdq4yOTR+AW7FqutScmB9NkLwxo+jU+kZLbofZZq/w== + +esbuild@^0.17.5: + version "0.17.18" + resolved "https://registry.npmmirror.com/esbuild/-/esbuild-0.17.18.tgz#f4f8eb6d77384d68cd71c53eb6601c7efe05e746" + integrity sha512-z1lix43jBs6UKjcZVKOw2xx69ffE2aG0PygLL5qJ9OS/gy0Ewd1gW/PUQIOIQGXBHWNywSc0floSKoMFF8aK2w== + optionalDependencies: + "@esbuild/android-arm" "0.17.18" + "@esbuild/android-arm64" "0.17.18" + "@esbuild/android-x64" "0.17.18" + "@esbuild/darwin-arm64" "0.17.18" + "@esbuild/darwin-x64" "0.17.18" + "@esbuild/freebsd-arm64" "0.17.18" + "@esbuild/freebsd-x64" "0.17.18" + "@esbuild/linux-arm" "0.17.18" + "@esbuild/linux-arm64" "0.17.18" + "@esbuild/linux-ia32" "0.17.18" + "@esbuild/linux-loong64" "0.17.18" + "@esbuild/linux-mips64el" "0.17.18" + "@esbuild/linux-ppc64" "0.17.18" + "@esbuild/linux-riscv64" "0.17.18" + "@esbuild/linux-s390x" "0.17.18" + "@esbuild/linux-x64" "0.17.18" + "@esbuild/netbsd-x64" "0.17.18" + "@esbuild/openbsd-x64" "0.17.18" + "@esbuild/sunos-x64" "0.17.18" + "@esbuild/win32-arm64" "0.17.18" + "@esbuild/win32-ia32" "0.17.18" + "@esbuild/win32-x64" "0.17.18" + +estree-walker@^2.0.2: + version "2.0.2" + resolved "https://registry.npmmirror.com/estree-walker/-/estree-walker-2.0.2.tgz#52f010178c2a4c117a7757cfe942adb7d2da4cac" + integrity sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w== + +fsevents@~2.3.2: + version "2.3.2" + resolved "https://registry.npmmirror.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a" + integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== + +jsonc-parser@^3.2.0: + version "3.2.0" + resolved "https://registry.npmmirror.com/jsonc-parser/-/jsonc-parser-3.2.0.tgz#31ff3f4c2b9793f89c67212627c51c6394f88e76" + integrity sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w== + +magic-string@^0.25.7: + version "0.25.9" + resolved "https://registry.npmmirror.com/magic-string/-/magic-string-0.25.9.tgz#de7f9faf91ef8a1c91d02c2e5314c8277dbcdd1c" + integrity sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ== + dependencies: + sourcemap-codec "^1.4.8" + +mark.js@8.11.1: + version "8.11.1" + resolved "https://registry.npmmirror.com/mark.js/-/mark.js-8.11.1.tgz#180f1f9ebef8b0e638e4166ad52db879beb2ffc5" + integrity sha512-1I+1qpDt4idfgLQG+BNWmrqku+7/2bi5nLf4YwF8y8zXvmfiTBY3PV3ZibfrjBueCByROpuBjLLFCajqkgYoLQ== + +minisearch@^6.0.1: + version "6.0.1" + resolved "https://registry.npmmirror.com/minisearch/-/minisearch-6.0.1.tgz#55e40135e7e6be60f1c1c2f5ee890c334e179a86" + integrity sha512-Ly1w0nHKnlhAAh6/BF/+9NgzXfoJxaJ8nhopFhQ3NcvFJrFIL+iCg9gw9e9UMBD+XIsp/RyznJ/o5UIe5Kw+kg== + +nanoid@^3.3.6: + version "3.3.6" + resolved "https://registry.npmmirror.com/nanoid/-/nanoid-3.3.6.tgz#443380c856d6e9f9824267d960b4236ad583ea4c" + integrity sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA== + +picocolors@^1.0.0: + version "1.0.0" + resolved "https://registry.npmmirror.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" + integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ== + +postcss@^8.1.10, postcss@^8.4.23: + version "8.4.23" + resolved "https://registry.npmmirror.com/postcss/-/postcss-8.4.23.tgz#df0aee9ac7c5e53e1075c24a3613496f9e6552ab" + integrity sha512-bQ3qMcpF6A/YjR55xtoTr0jGOlnPOKAIMdOWiv0EIT6HVPEaJiJB4NLljSbiHoC2RX7DN5Uvjtpbg1NPdwv1oA== + dependencies: + nanoid "^3.3.6" + picocolors "^1.0.0" + source-map-js "^1.0.2" + +preact@^10.0.0: + version "10.13.2" + resolved "https://registry.npmmirror.com/preact/-/preact-10.13.2.tgz#2c40c73d57248b57234c4ae6cd9ab9d8186ebc0a" + integrity sha512-q44QFLhOhty2Bd0Y46fnYW0gD/cbVM9dUVtNTDKPcdXSMA7jfY+Jpd6rk3GB0lcQss0z5s/6CmVP0Z/hV+g6pw== + +rollup@^3.21.0: + version "3.21.1" + resolved "https://registry.npmmirror.com/rollup/-/rollup-3.21.1.tgz#d56f32ee041383b60909e3d3195b54b69912dbb0" + integrity sha512-GpUgqWCw56OSiBKf7lcAITstYiBV1/EKaKYPl9r8HgAxc6/qYAVw1PaHWnvHWFziRaf4HsVCDLq/IGtBi1K/Zw== + optionalDependencies: + fsevents "~2.3.2" + +shiki@^0.14.1: + version "0.14.2" + resolved "https://registry.npmmirror.com/shiki/-/shiki-0.14.2.tgz#d51440800b701392b31ce2336036058e338247a1" + integrity sha512-ltSZlSLOuSY0M0Y75KA+ieRaZ0Trf5Wl3gutE7jzLuIcWxLp5i/uEnLoQWNvgKXQ5OMpGkJnVMRLAuzjc0LJ2A== + dependencies: + ansi-sequence-parser "^1.1.0" + jsonc-parser "^3.2.0" + vscode-oniguruma "^1.7.0" + vscode-textmate "^8.0.0" + +source-map-js@^1.0.2: + version "1.0.2" + resolved "https://registry.npmmirror.com/source-map-js/-/source-map-js-1.0.2.tgz#adbc361d9c62df380125e7f161f71c826f1e490c" + integrity sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw== + +source-map@^0.6.1: + version "0.6.1" + resolved "https://registry.npmmirror.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" + integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== + +sourcemap-codec@^1.4.8: + version "1.4.8" + resolved "https://registry.npmmirror.com/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz#ea804bd94857402e6992d05a38ef1ae35a9ab4c4" + integrity sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA== + +vite@^4.3.1: + version "4.3.3" + resolved "https://registry.npmmirror.com/vite/-/vite-4.3.3.tgz#26adb4aa01439fc4546c480ea547674d87289396" + integrity sha512-MwFlLBO4udZXd+VBcezo3u8mC77YQk+ik+fbc0GZWGgzfbPP+8Kf0fldhARqvSYmtIWoAJ5BXPClUbMTlqFxrA== + dependencies: + esbuild "^0.17.5" + postcss "^8.4.23" + rollup "^3.21.0" + optionalDependencies: + fsevents "~2.3.2" + +vitepress@^1.0.0-alpha.74: + version "1.0.0-alpha.74" + resolved "https://registry.npmmirror.com/vitepress/-/vitepress-1.0.0-alpha.74.tgz#2ef9017d65915f43a61280e92e41e44a1fce38ff" + integrity sha512-n5UHqsLJKaJ3V6BSiofS5ZVhtxzarNIn3/kyOzUp/vePmVbQyX/pZ6/MhZgNr0g5t4E55j7XM3AHf/Fo0hnrpw== + dependencies: + "@docsearch/css" "^3.3.3" + "@docsearch/js" "^3.3.3" + "@vitejs/plugin-vue" "^4.1.0" + "@vue/devtools-api" "^6.5.0" + "@vueuse/core" "^10.1.0" + body-scroll-lock "4.0.0-beta.0" + mark.js "8.11.1" + minisearch "^6.0.1" + shiki "^0.14.1" + vite "^4.3.1" + vue "^3.2.47" + +vscode-oniguruma@^1.7.0: + version "1.7.0" + resolved "https://registry.npmmirror.com/vscode-oniguruma/-/vscode-oniguruma-1.7.0.tgz#439bfad8fe71abd7798338d1cd3dc53a8beea94b" + integrity sha512-L9WMGRfrjOhgHSdOYgCt/yRMsXzLDJSL7BPrOZt73gU0iWO4mpqzqQzOz5srxqTvMBaR0XZTSrVWo4j55Rc6cA== + +vscode-textmate@^8.0.0: + version "8.0.0" + resolved "https://registry.npmmirror.com/vscode-textmate/-/vscode-textmate-8.0.0.tgz#2c7a3b1163ef0441097e0b5d6389cd5504b59e5d" + integrity sha512-AFbieoL7a5LMqcnOF04ji+rpXadgOXnZsxQr//r83kLPr7biP7am3g9zbaZIaBGwBRWeSvoMD4mgPdX3e4NWBg== + +vue-demi@>=0.14.0: + version "0.14.0" + resolved "https://registry.npmmirror.com/vue-demi/-/vue-demi-0.14.0.tgz#dcfd9a9cf9bb62ada1582ec9042372cf67ca6190" + integrity sha512-gt58r2ogsNQeVoQ3EhoUAvUsH9xviydl0dWJj7dabBC/2L4uBId7ujtCwDRD0JhkGsV1i0CtfLAeyYKBht9oWg== + +vue@^3.2.47: + version "3.2.47" + resolved "https://registry.npmmirror.com/vue/-/vue-3.2.47.tgz#3eb736cbc606fc87038dbba6a154707c8a34cff0" + integrity sha512-60188y/9Dc9WVrAZeUVSDxRQOZ+z+y5nO2ts9jWXSTkMvayiWxCWOWtBQoYjLeccfXkiiPZWAHcV+WTPhkqJHQ== + dependencies: + "@vue/compiler-dom" "3.2.47" + "@vue/compiler-sfc" "3.2.47" + "@vue/runtime-dom" "3.2.47" + "@vue/server-renderer" "3.2.47" + "@vue/shared" "3.2.47"