From 3a508b792986daf1a3ee24a090c25718838d8be2 Mon Sep 17 00:00:00 2001 From: hiddify <114227601+hiddify-com@users.noreply.github.com> Date: Sat, 28 Sep 2024 20:31:38 +0200 Subject: [PATCH] =?UTF-8?q?new:=20Big=20Change,=20Add=20support=20for=20Ex?= =?UTF-8?q?tensions=20=F0=9F=98=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cli/main.go | 18 + cmd.sh | 2 +- cmd/cmd_instance.go | 59 + cmd/cmd_run.go | 1 - cmd/cmd_temp.go | 141 + common/cache.go | 174 + common/utils.go | 25 + config/config.go | 2 +- config/{option.go => hiddify_option.go} | 11 +- config/parser.go | 13 + config/warp.go | 7 +- extension/extension.go | 92 +- extension/extension_host.go | 41 +- extension/html/a.js | 12 + extension/html/index.html | 39 +- extension/html/rpc.js | 7185 ++++++++++++++++++++- extension/html/rpc/client.js | 6 +- extension/html/rpc/connectionPage.js | 109 + extension/html/rpc/extension.js | 3 +- extension/html/rpc/extensionList.js | 32 +- extension/html/rpc/extensionPage.js | 35 +- extension/html/rpc/formRenderer.js | 79 +- extension/html/rpc/hiddify_grpc_web_pb.js | 306 +- extension/html/rpc/hiddify_pb.js | 52 +- extension/interface.go | 45 + extension/sdk/interface.go | 47 + extension/{ui_elements => ui}/abstract.go | 2 +- extension/{ui_elements => ui}/all_test.go | 2 +- extension/{ui_elements => ui}/base.go | 36 +- extension/{ui_elements => ui}/content.go | 2 +- extension/ui/data.go | 1 + extension/{ui_elements => ui}/form.go | 2 +- go.mod | 15 +- go.sum | 35 +- hiddifyrpc/hiddify.pb.go | 428 +- hiddifyrpc/hiddify.proto | 16 +- hiddifyrpc/hiddify_grpc.pb.go | 163 +- v2/commands.go | 66 +- v2/coreinfo.go | 36 +- v2/custom.go | 26 +- v2/grpc_server.go | 5 + v2/independent_instance.go | 172 + v2/logproto.go | 16 +- v2/standalone.go | 6 +- 44 files changed, 8946 insertions(+), 619 deletions(-) mode change 100644 => 100755 cmd.sh create mode 100644 cmd/cmd_instance.go create mode 100644 cmd/cmd_temp.go create mode 100644 common/cache.go create mode 100644 common/utils.go rename config/{option.go => hiddify_option.go} (96%) create mode 100644 extension/html/a.js create mode 100644 extension/html/rpc/connectionPage.js create mode 100644 extension/interface.go create mode 100644 extension/sdk/interface.go rename extension/{ui_elements => ui}/abstract.go (98%) rename extension/{ui_elements => ui}/all_test.go (98%) rename extension/{ui_elements => ui}/base.go (61%) rename extension/{ui_elements => ui}/content.go (97%) create mode 100644 extension/ui/data.go rename extension/{ui_elements => ui}/form.go (99%) create mode 100644 v2/independent_instance.go diff --git a/cli/main.go b/cli/main.go index 80fc939..f23afe2 100644 --- a/cli/main.go +++ b/cli/main.go @@ -6,6 +6,24 @@ import ( "github.com/hiddify/hiddify-core/cmd" ) +type UpdateRequest struct { + Description string `json:"description,omitempty"` + PrivatePods bool `json:"private_pods"` + OperatingMode string `json:"operating_mode,omitempty"` + ActivationState string `json:"activation_state,omitempty"` +} + func main() { cmd.ParseCli(os.Args[1:]) + + // var request UpdateRequest + // // jsonTag, err2 := validation.ErrorFieldName(&request, &request.OperatingMode) + // jsonTag, err2 := request.ValName(&request.OperatingMode) + + // fmt.Println(jsonTag, err2) + // RegisterExtension("com.example.extension", NewExampleExtension()) + // ex := extensionsMap["com.example.extension"].(*Extension[struct]) + // fmt.Println(NewExampleExtension().Get()) + + // fmt.Println(ex.Get()) } diff --git a/cmd.sh b/cmd.sh old mode 100644 new mode 100755 index bb4b219..90a39f3 --- a/cmd.sh +++ b/cmd.sh @@ -1,3 +1,3 @@ TAGS=with_gvisor,with_quic,with_wireguard,with_ech,with_utls,with_clash_api,with_grpc # TAGS=with_dhcp,with_low_memory,with_conntrack -go run --tags $TAGS ./cmd $@ \ No newline at end of file +go run --tags $TAGS ./cli $@ \ No newline at end of file diff --git a/cmd/cmd_instance.go b/cmd/cmd_instance.go new file mode 100644 index 0000000..936ed25 --- /dev/null +++ b/cmd/cmd_instance.go @@ -0,0 +1,59 @@ +package cmd + +import ( + "os" + "os/signal" + "syscall" + + v2 "github.com/hiddify/hiddify-core/v2" + "github.com/sagernet/sing-box/log" + "github.com/spf13/cobra" +) + +var commandInstance = &cobra.Command{ + Use: "instance", + Short: "instance", + Args: cobra.OnlyValidArgs, + Run: func(cmd *cobra.Command, args []string) { + hiddifySetting := defaultConfigs + if hiddifySettingPath != "" { + hiddifySetting2, err := v2.ReadHiddifyOptionsAt(hiddifySettingPath) + if err != nil { + log.Fatal(err) + } + hiddifySetting = *hiddifySetting2 + } + + instance, err := v2.RunInstanceString(&hiddifySetting, configPath) + if err != nil { + log.Fatal(err) + } + defer instance.Close() + ping, err := instance.PingAverage("http://cp.cloudflare.com", 4) + if err != nil { + // log.Fatal(err) + } + log.Info("Average Ping to Cloudflare : ", ping, "\n") + + for i := 1; i <= 4; i++ { + ping, err := instance.PingCloudflare() + if err != nil { + log.Warn(i, " Error ", err, "\n") + } else { + log.Info(i, " Ping time: ", ping, " ms\n") + } + } + log.Info("Instance is running on port socks5://127.0.0.1:", instance.ListenPort, "\n") + log.Info("Press Ctrl+C to exit\n") + sigChan := make(chan os.Signal, 1) + signal.Notify(sigChan, os.Interrupt, syscall.SIGTERM) + <-sigChan + log.Info("CTRL+C recived-->stopping\n") + instance.Close() + }, +} + +func init() { + mainCommand.AddCommand(commandInstance) + addHConfigFlags(commandInstance) +} diff --git a/cmd/cmd_run.go b/cmd/cmd_run.go index e71f8c5..9f19ed5 100644 --- a/cmd/cmd_run.go +++ b/cmd/cmd_run.go @@ -23,6 +23,5 @@ func init() { } func runCommand(cmd *cobra.Command, args []string) { - v2.RunStandalone(hiddifySettingPath, configPath, defaultConfigs) } diff --git a/cmd/cmd_temp.go b/cmd/cmd_temp.go new file mode 100644 index 0000000..a1cd7b9 --- /dev/null +++ b/cmd/cmd_temp.go @@ -0,0 +1,141 @@ +package cmd + +import ( + "context" + "fmt" + "io" + "math/rand" + "net/http" + "net/netip" + "time" + + "github.com/hiddify/hiddify-core/common" + "github.com/hiddify/hiddify-core/extension_repository/cleanip_scanner" + "github.com/spf13/cobra" + "golang.org/x/net/proxy" +) + +var commandTemp = &cobra.Command{ + Use: "temp", + Short: "temp", + Args: cobra.MaximumNArgs(2), + Run: func(cmd *cobra.Command, args []string) { + // fmt.Printf("Ping time: %d ms\n", Ping()) + scanner := cleanip_scanner.NewScannerEngine(&cleanip_scanner.ScannerOptions{ + UseIPv4: true, + UseIPv6: common.CanConnectIPv6(), + MaxDesirableRTT: 500 * time.Millisecond, + IPQueueSize: 4, + IPQueueTTL: 10 * time.Second, + ConcurrentPings: 10, + // MaxDesirableIPs: e.count, + CidrList: cleanip_scanner.DefaultCFRanges(), + PingFunc: func(ip netip.Addr) (cleanip_scanner.IPInfo, error) { + fmt.Printf("Ping: %s\n", ip.String()) + return cleanip_scanner.IPInfo{ + AddrPort: netip.AddrPortFrom(ip, 80), + RTT: time.Duration(rand.Intn(1000)), + CreatedAt: time.Now(), + }, nil + }, + }, + ) + + ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second) + defer cancel() + + scanner.Run(ctx) + + t := time.NewTicker(1 * time.Second) + defer t.Stop() + + for { + ipList := scanner.GetAvailableIPs(false) + if len(ipList) > 1 { + // e.result = "" + for i := 0; i < 2; i++ { + // result = append(result, ipList[i]) + // e.result = e.result + ipList[i].AddrPort.String() + "\n" + fmt.Printf("%d %s\n", ipList[i].RTT, ipList[i].AddrPort.String()) + } + return + } + + select { + case <-ctx.Done(): + // Context is done + return + case <-t.C: + // Prevent the loop from spinning too fast + continue + } + } + }, +} + +func init() { + mainCommand.AddCommand(commandTemp) +} + +func GetContent(url string) (string, error) { + return ContentFromURL("GET", url, 10*time.Second) +} + +func ContentFromURL(method string, url string, timeout time.Duration) (string, error) { + if method == "" { + return "", fmt.Errorf("empty method") + } + if url == "" { + return "", fmt.Errorf("empty url") + } + + req, err := http.NewRequest(method, url, nil) + if err != nil { + return "", err + } + + dialer, err := proxy.SOCKS5("tcp", "127.0.0.1:12334", nil, proxy.Direct) + if err != nil { + return "", err + } + + transport := &http.Transport{ + Dial: dialer.Dial, + } + + client := &http.Client{ + Transport: transport, + Timeout: timeout, + } + + resp, err := client.Do(req) + if err != nil { + return "", err + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusNoContent { + return "", fmt.Errorf("request failed with status code: %d", resp.StatusCode) + } + + body, err := io.ReadAll(resp.Body) + if err != nil { + return "", err + } + + if body == nil { + return "", fmt.Errorf("empty body") + } + + return string(body), nil +} + +func Ping() int { + startTime := time.Now() + _, err := ContentFromURL("HEAD", "https://cp.cloudflare.com", 4*time.Second) + if err != nil { + return -1 + } + duration := time.Since(startTime) + return int(duration.Milliseconds()) +} diff --git a/common/cache.go b/common/cache.go new file mode 100644 index 0000000..ceb225d --- /dev/null +++ b/common/cache.go @@ -0,0 +1,174 @@ +package common + +import ( + "context" + "encoding/json" + "errors" + "log" + "os" + "time" + + "github.com/sagernet/sing-box/option" + + "github.com/sagernet/bbolt" + bboltErrors "github.com/sagernet/bbolt/errors" + + "github.com/sagernet/sing/common" + E "github.com/sagernet/sing/common/exceptions" + "github.com/sagernet/sing/service/filemanager" +) + +var ( + Storage = New(context.Background(), option.CacheFileOptions{}) + bucketExtension = []byte("extension") + bucketHiddify = []byte("hiddify") + + bucketNameList = []string{ + string(bucketExtension), + string(bucketHiddify), + } +) + +type CacheFile struct { + ctx context.Context + path string + cacheID []byte + + DB *bbolt.DB +} + +func New(ctx context.Context, options option.CacheFileOptions) *CacheFile { + var path string + if options.Path != "" { + path = options.Path + } else { + path = "hiddify.db" + } + var cacheIDBytes []byte + if options.CacheID != "" { + cacheIDBytes = append([]byte{0}, []byte(options.CacheID)...) + } + cache := &CacheFile{ + ctx: ctx, + path: filemanager.BasePath(ctx, path), + cacheID: cacheIDBytes, + } + err := cache.start() + if err != nil { + log.Panic(err) + } + return cache +} + +func (c *CacheFile) start() error { + const fileMode = 0o666 + options := bbolt.Options{Timeout: time.Second + } + var ( + db *bbolt.DB + err error + ) + for i := 0; i < 10; i++ { + db, err = bbolt.Open(c.path, fileMode, &options) + if err == nil { + break + } + if errors.Is(err, bboltErrors.ErrTimeout) { + continue + } + if E.IsMulti(err, bboltErrors.ErrInvalid, bboltErrors.ErrChecksum, bboltErrors.ErrVersionMismatch) { + rmErr := os.Remove(c.path) + if rmErr != nil { + return err + } + } + time.Sleep(100 * time.Millisecond) + } + if err != nil { + return err + } + err = filemanager.Chown(c.ctx, c.path) + if err != nil { + db.Close() + return E.Cause(err, "platform chown") + } + err = db.Batch(func(tx *bbolt.Tx) error { + return tx.ForEach(func(name []byte, b *bbolt.Bucket) error { + if name[0] == 0 { + return b.ForEachBucket(func(k []byte) error { + bucketName := string(k) + if !(common.Contains(bucketNameList, bucketName)) { + _ = b.DeleteBucket(name) + } + return nil + }) + } else { + bucketName := string(name) + if !(common.Contains(bucketNameList, bucketName)) { + _ = tx.DeleteBucket(name) + } + } + return nil + }) + }) + if err != nil { + db.Close() + return err + } + c.DB = db + return nil +} + +func (c *CacheFile) bucket(t *bbolt.Tx, key []byte) *bbolt.Bucket { + if c.cacheID == nil { + return t.Bucket(key) + } + bucket := t.Bucket(c.cacheID) + if bucket == nil { + return nil + } + return bucket.Bucket(key) +} + +func (c *CacheFile) createBucket(t *bbolt.Tx, key []byte) (*bbolt.Bucket, error) { + if c.cacheID == nil { + return t.CreateBucketIfNotExists(key) + } + bucket, err := t.CreateBucketIfNotExists(c.cacheID) + if bucket == nil { + return nil, err + } + return bucket.CreateBucketIfNotExists(key) +} + +func (c *CacheFile) GetExtensionData(extension_id string, default_value any) error { + err := c.DB.View(func(t *bbolt.Tx) error { + bucket := c.bucket(t, bucketExtension) + if bucket == nil { + return os.ErrNotExist + } + setBinary := bucket.Get([]byte(extension_id)) + if len(setBinary) == 0 { + return os.ErrInvalid + } + return json.Unmarshal(setBinary, &default_value) + }) + return err +} + +func (c *CacheFile) SaveExtensionData(extension_id string, data any) error { + return c.DB.Batch(func(t *bbolt.Tx) error { + bucket, err := c.createBucket(t, bucketExtension) + if err != nil { + return err + } + + // Assuming T implements MarshalBinary + + setBinary, err := json.MarshalIndent(data, " ", "") + if err != nil { + return err + } + return bucket.Put([]byte(extension_id), setBinary) + }) +} diff --git a/common/utils.go b/common/utils.go new file mode 100644 index 0000000..21d9484 --- /dev/null +++ b/common/utils.go @@ -0,0 +1,25 @@ +package common + +import ( + "net" + "net/netip" + "time" +) + +func CanConnectIPv6Addr(remoteAddr netip.AddrPort) bool { + dialer := net.Dialer{ + Timeout: 1 * time.Second, + } + + conn, err := dialer.Dial("tcp6", remoteAddr.String()) + if err != nil { + return false + } + defer conn.Close() + + return true +} + +func CanConnectIPv6() bool { + return CanConnectIPv6Addr(netip.MustParseAddrPort("[2001:4860:4860::8888]:80")) +} diff --git a/config/config.go b/config/config.go index 45a1226..b9c35e5 100644 --- a/config/config.go +++ b/config/config.go @@ -287,7 +287,7 @@ func setClashAPI(options *option.Options, opt *HiddifyOptions) { func setLog(options *option.Options, opt *HiddifyOptions) { options.Log = &option.LogOptions{ Level: opt.LogLevel, - Output: "box.log", + Output: opt.LogFile, Disabled: false, Timestamp: true, DisableColor: true, diff --git a/config/option.go b/config/hiddify_option.go similarity index 96% rename from config/option.go rename to config/hiddify_option.go index 54f421c..36fd367 100644 --- a/config/option.go +++ b/config/hiddify_option.go @@ -8,6 +8,7 @@ import ( type HiddifyOptions struct { EnableFullConfig bool `json:"enable-full-config"` LogLevel string `json:"log-level"` + LogFile string `json:"log-file"` EnableClashApi bool `json:"enable-clash-api"` ClashApiPort uint16 `json:"clash-api-port"` ClashApiSecret string `json:"web-secret"` @@ -106,8 +107,8 @@ func DefaultHiddifyOptions() *HiddifyOptions { InboundOptions: InboundOptions{ EnableTun: false, SetSystemProxy: false, - MixedPort: 2334, - TProxyPort: 2335, + MixedPort: 12334, + TProxyPort: 12335, LocalDnsPort: 16450, MTU: 9000, StrictRoute: true, @@ -124,10 +125,12 @@ func DefaultHiddifyOptions() *HiddifyOptions { BypassLAN: false, AllowConnectionFromLAN: false, }, - LogLevel: "warn", + LogLevel: "warn", + // LogFile: "/dev/null", + LogFile: "box.log", Region: "other", EnableClashApi: true, - ClashApiPort: 6756, + ClashApiPort: 16756, ClashApiSecret: "", // GeoIPPath: "geoip.db", // GeoSitePath: "geosite.db", diff --git a/config/parser.go b/config/parser.go index 10bd1e0..b6e23de 100644 --- a/config/parser.go +++ b/config/parser.go @@ -31,6 +31,19 @@ func ParseConfig(path string, debug bool) ([]byte, error) { return ParseConfigContent(string(content), debug, nil, false) } +func ParseConfigContentToOptions(contentstr string, debug bool, configOpt *HiddifyOptions, fullConfig bool) (*option.Options, error) { + content, err := ParseConfigContent(contentstr, debug, configOpt, fullConfig) + if err != nil { + return nil, err + } + var options option.Options + err = json.Unmarshal(content, &options) + if err != nil { + return nil, err + } + return &options, nil +} + func ParseConfigContent(contentstr string, debug bool, configOpt *HiddifyOptions, fullConfig bool) ([]byte, error) { if configOpt == nil { configOpt = DefaultHiddifyOptions() diff --git a/config/warp.go b/config/warp.go index 892a46d..abd2772 100644 --- a/config/warp.go +++ b/config/warp.go @@ -9,6 +9,7 @@ import ( "strings" "github.com/bepass-org/warp-plus/warp" + "github.com/hiddify/hiddify-core/common" C "github.com/sagernet/sing-box/constant" // "github.com/bepass-org/wireguard-go/warp" @@ -189,8 +190,10 @@ func patchWarp(base *option.Outbound, configOpt *HiddifyOptions, final bool, sta rndDomain := strings.ToLower(generateRandomString(20)) staticIpsDns[rndDomain] = []string{} if host != "auto4" { - randomIpPort, _ := warp.RandomWarpEndpoint(false, true) - staticIpsDns[rndDomain] = append(staticIpsDns[rndDomain], randomIpPort.Addr().String()) + if host == "auto6" || common.CanConnectIPv6() { + randomIpPort, _ := warp.RandomWarpEndpoint(false, true) + staticIpsDns[rndDomain] = append(staticIpsDns[rndDomain], randomIpPort.Addr().String()) + } } if host != "auto6" { randomIpPort, _ := warp.RandomWarpEndpoint(true, false) diff --git a/extension/extension.go b/extension/extension.go index 55b90fa..66d7bae 100644 --- a/extension/extension.go +++ b/extension/extension.go @@ -1,54 +1,72 @@ package extension import ( - "fmt" - "log" - - "github.com/hiddify/hiddify-core/extension/ui_elements" + "github.com/hiddify/hiddify-core/common" + "github.com/hiddify/hiddify-core/config" + "github.com/hiddify/hiddify-core/extension/ui" pb "github.com/hiddify/hiddify-core/hiddifyrpc" -) - -var ( - extensionsMap = make(map[string]*Extension) - extensionStatusMap = make(map[string]bool) + "github.com/jellydator/validation" + "github.com/sagernet/sing-box/log" + "github.com/sagernet/sing-box/option" ) type Extension interface { - GetTitle() string - GetDescription() string - GetUI() ui_elements.Form + GetUI() ui.Form SubmitData(data map[string]string) error Cancel() error Stop() error - UpdateUI(form ui_elements.Form) error + UpdateUI(form ui.Form) error + + BeforeAppConnect(hiddifySettings *config.HiddifyOptions, singconfig *option.Options) error + + StoreData() + init(id string) getQueue() chan *pb.ExtensionResponse getId() string } -type BaseExtension struct { +type Base[T any] struct { id string // responseStream grpc.ServerStreamingServer[pb.ExtensionResponse] queue chan *pb.ExtensionResponse + Data T } -// func (b *BaseExtension) mustEmbdedBaseExtension() { +// func (b *Base) mustEmbdedBaseExtension() { // } -func (b *BaseExtension) init(id string) { - b.id = id - b.queue = make(chan *pb.ExtensionResponse, 1) +func (b *Base[T]) BeforeAppConnect(hiddifySettings *config.HiddifyOptions, singconfig *option.Options) error { + return nil } -func (b *BaseExtension) getQueue() chan *pb.ExtensionResponse { +func (b *Base[T]) StoreData() { + common.Storage.SaveExtensionData(b.id, &b.Data) +} + +func (b *Base[T]) init(id string) { + b.id = id + b.queue = make(chan *pb.ExtensionResponse, 1) + common.Storage.GetExtensionData(b.id, &b.Data) +} + +func (b *Base[T]) getQueue() chan *pb.ExtensionResponse { return b.queue } -func (b *BaseExtension) getId() string { +func (b *Base[T]) getId() string { return b.id } -func (p *BaseExtension) UpdateUI(form ui_elements.Form) error { +func (e *Base[T]) ShowMessage(title string, msg string) error { + return e.ShowDialog(ui.Form{ + Title: title, + Description: msg, + Buttons: []string{ui.Button_Ok}, + }) +} + +func (p *Base[T]) UpdateUI(form ui.Form) error { p.queue <- &pb.ExtensionResponse{ ExtensionId: p.id, Type: pb.ExtensionResponseType_UPDATE_UI, @@ -57,7 +75,7 @@ func (p *BaseExtension) UpdateUI(form ui_elements.Form) error { return nil } -func (p *BaseExtension) ShowDialog(form ui_elements.Form) error { +func (p *Base[T]) ShowDialog(form ui.Form) error { p.queue <- &pb.ExtensionResponse{ ExtensionId: p.id, Type: pb.ExtensionResponseType_SHOW_DIALOG, @@ -67,20 +85,22 @@ func (p *BaseExtension) ShowDialog(form ui_elements.Form) error { return nil } -func RegisterExtension(id string, extension Extension) error { - if _, ok := extensionsMap[id]; ok { - err := fmt.Errorf("Extension with ID %s already exists", id) - log.Fatal(err) - return err +func (base *Base[T]) ValName(fieldPtr interface{}) string { + val, err := validation.ErrorFieldName(&base.Data, fieldPtr) + if err != nil { + log.Warn(err) + return "" } - if val, ok := extensionStatusMap[id]; ok && !val { - err := fmt.Errorf("Extension with ID %s is not enabled", id) - log.Fatal(err) - return err + if val == "" { + log.Warn("Field not found") + return "" } - extension.init(id) - - fmt.Printf("Registered extension: %+v\n", extension) - extensionsMap[id] = &extension - return nil + return val +} + +type ExtensionFactory struct { + Id string + Title string + Description string + Builder func() Extension } diff --git a/extension/extension_host.go b/extension/extension_host.go index 09437f9..31fbbe4 100644 --- a/extension/extension_host.go +++ b/extension/extension_host.go @@ -5,6 +5,7 @@ import ( "fmt" "log" + "github.com/hiddify/hiddify-core/common" pb "github.com/hiddify/hiddify-core/hiddifyrpc" "google.golang.org/grpc" ) @@ -18,11 +19,12 @@ func (ExtensionHostService) ListExtensions(ctx context.Context, empty *pb.Empty) Extensions: make([]*pb.Extension, 0), } - for _, extension := range extensionsMap { + for _, extension := range allExtensionsMap { extensionList.Extensions = append(extensionList.Extensions, &pb.Extension{ - Id: (*extension).getId(), - Title: (*extension).GetTitle(), - Description: (*extension).GetDescription(), + Id: extension.Id, + Title: extension.Title, + Description: extension.Description, + Enable: generalExtensionData.ExtensionStatusMap[extension.Id], }) } return extensionList, nil @@ -30,7 +32,7 @@ func (ExtensionHostService) ListExtensions(ctx context.Context, empty *pb.Empty) func (e ExtensionHostService) Connect(req *pb.ExtensionRequest, stream grpc.ServerStreamingServer[pb.ExtensionResponse]) error { // Get the extension from the map using the Extension ID - if extension, ok := extensionsMap[req.GetExtensionId()]; ok { + if extension, ok := enabledExtensionsMap[req.GetExtensionId()]; ok { log.Printf("Connecting stream for extension %s", req.GetExtensionId()) log.Printf("Extension data: %+v", extension) @@ -100,7 +102,7 @@ func (e ExtensionHostService) Connect(req *pb.ExtensionRequest, stream grpc.Serv } func (e ExtensionHostService) SubmitForm(ctx context.Context, req *pb.ExtensionRequest) (*pb.ExtensionActionResult, error) { - if extension, ok := extensionsMap[req.GetExtensionId()]; ok { + if extension, ok := enabledExtensionsMap[req.GetExtensionId()]; ok { (*extension).SubmitData(req.GetData()) return &pb.ExtensionActionResult{ @@ -113,7 +115,7 @@ func (e ExtensionHostService) SubmitForm(ctx context.Context, req *pb.ExtensionR } func (e ExtensionHostService) Cancel(ctx context.Context, req *pb.ExtensionRequest) (*pb.ExtensionActionResult, error) { - if extension, ok := extensionsMap[req.GetExtensionId()]; ok { + if extension, ok := enabledExtensionsMap[req.GetExtensionId()]; ok { (*extension).Cancel() return &pb.ExtensionActionResult{ @@ -126,9 +128,9 @@ func (e ExtensionHostService) Cancel(ctx context.Context, req *pb.ExtensionReque } func (e ExtensionHostService) Stop(ctx context.Context, req *pb.ExtensionRequest) (*pb.ExtensionActionResult, error) { - if extension, ok := extensionsMap[req.GetExtensionId()]; ok { + if extension, ok := enabledExtensionsMap[req.GetExtensionId()]; ok { (*extension).Stop() - + (*extension).StoreData() return &pb.ExtensionActionResult{ ExtensionId: req.ExtensionId, Code: pb.ResponseCode_OK, @@ -137,3 +139,24 @@ func (e ExtensionHostService) Stop(ctx context.Context, req *pb.ExtensionRequest } return nil, fmt.Errorf("Extension with ID %s not found", req.GetExtensionId()) } + +func (e ExtensionHostService) EditExtension(ctx context.Context, req *pb.EditExtensionRequest) (*pb.ExtensionActionResult, error) { + generalExtensionData.ExtensionStatusMap[req.GetExtensionId()] = req.Enable + if !req.Enable { + ext := *enabledExtensionsMap[req.GetExtensionId()] + if ext != nil { + ext.Stop() + ext.StoreData() + } + delete(enabledExtensionsMap, req.GetExtensionId()) + } else { + loadExtension(allExtensionsMap[req.GetExtensionId()]) + } + common.Storage.SaveExtensionData("default", generalExtensionData) + + return &pb.ExtensionActionResult{ + ExtensionId: req.ExtensionId, + Code: pb.ResponseCode_OK, + Message: "Success", + }, nil +} diff --git a/extension/html/a.js b/extension/html/a.js new file mode 100644 index 0000000..c161e8c --- /dev/null +++ b/extension/html/a.js @@ -0,0 +1,12 @@ + +import * as a from "./rpc/extension_grpc_web_pb.js"; +const client = new ExtensionHostServiceClient('http://localhost:8080'); +const request = new GetHelloRequest(); +export const getHello = (name) => { + request.setName(name) +client.getHello(request, {}, (err, response) => { + console.log(request.getName()); + console.log(response.toObject()); + }); +} +getHello("D") \ No newline at end of file diff --git a/extension/html/index.html b/extension/html/index.html index 431c337..5005207 100644 --- a/extension/html/index.html +++ b/extension/html/index.html @@ -8,18 +8,49 @@
-
+
+
+

Connection Settings

+ +
+ + +
+
+ + +
+ +
+ + +
+ +
+
+

Connecting...

+ +
+
+
+

+ Extension List +

+
+
-
- + diff --git a/extension/html/rpc.js b/extension/html/rpc.js index 6e9252c..48d0a54 100644 --- a/extension/html/rpc.js +++ b/extension/html/rpc.js @@ -460,38 +460,149 @@ proto.hiddifyrpc.ResponseCode = { goog.object.extend(exports, proto.hiddifyrpc); -},{"google-protobuf":9}],2:[function(require,module,exports){ +},{"google-protobuf":12}],2:[function(require,module,exports){ +const hiddify = require("./hiddify_grpc_web_pb.js"); const extension = require("./extension_grpc_web_pb.js"); const grpcServerAddress = '/'; -const client = new extension.ExtensionHostServicePromiseClient(grpcServerAddress, null, null); +const extensionClient = new extension.ExtensionHostServicePromiseClient(grpcServerAddress, null, null); +const hiddifyClient = new hiddify.CorePromiseClient(grpcServerAddress, null, null); -module.exports = { client ,extension}; -},{"./extension_grpc_web_pb.js":6}],3:[function(require,module,exports){ +module.exports = { extensionClient ,hiddifyClient}; +},{"./extension_grpc_web_pb.js":7,"./hiddify_grpc_web_pb.js":10}],3:[function(require,module,exports){ +const { hiddifyClient } = require('./client.js'); +const hiddify = require("./hiddify_grpc_web_pb.js"); + +function openConnectionPage() { + + $("#extension-list-container").show(); + $("#extension-page-container").hide(); + $("#connection-page").show(); + connect(); + $("#connect-button").click(async () => { + const hsetting_request = new hiddify.ChangeHiddifySettingsRequest(); + hsetting_request.setHiddifySettingsJson($("#hiddify-settings").val()); + try{ + const hres=await hiddifyClient.changeHiddifySettings(hsetting_request, {}); + }catch(err){ + $("#hiddify-settings").val("") + console.log(err) + } + + const parse_request = new hiddify.ParseRequest(); + parse_request.setContent($("#config-content").val()); + try{ + const pres=await hiddifyClient.parse(parse_request, {}); + if (pres.getResponseCode() !== hiddify.ResponseCode.OK){ + alert(pres.getMessage()); + return + } + $("#config-content").val(pres.getContent()); + }catch(err){ + console.log(err) + alert(JSON.stringify(err)) + return + } + + const request = new hiddify.StartRequest(); + + request.setConfigContent($("#config-content").val()); + request.setEnableRawConfig(false); + try{ + const res=await hiddifyClient.start(request, {}); + console.log(res.getCoreState(),res.getMessage()) + handleCoreStatus(res.getCoreState()); + }catch(err){ + console.log(err) + alert(JSON.stringify(err)) + return + } + + + }) + + $("#disconnect-button").click(async () => { + const request = new hiddify.Empty(); + try{ + const res=await hiddifyClient.stop(request, {}); + console.log(res.getCoreState(),res.getMessage()) + handleCoreStatus(res.getCoreState()); + }catch(err){ + console.log(err) + alert(JSON.stringify(err)) + return + } + }) +} + + +function connect(){ + const request = new hiddify.Empty(); + const stream = hiddifyClient.coreInfoListener(request, {}); + stream.on('data', (response) => { + console.log('Receving ',response); + handleCoreStatus(response); + }); + + stream.on('error', (err) => { + console.error('Error opening extension page:', err); + // openExtensionPage(extensionId); + }); + + stream.on('end', () => { + console.log('Stream ended'); + setTimeout(connect, 1000); + + }); +} + + +function handleCoreStatus(status){ + if (status == hiddify.CoreState.STOPPED){ + $("#connection-before-connect").show(); + $("#connection-connecting").hide(); + }else{ + $("#connection-before-connect").hide(); + $("#connection-connecting").show(); + if (status == hiddify.CoreState.STARTING){ + $("#connection-status").text("Starting"); + $("#connection-status").css("color", "yellow"); + }else if (status == hiddify.CoreState.STOPPING){ + $("#connection-status").text("Stopping"); + $("#connection-status").css("color", "red"); + }else if (status == hiddify.CoreState.STARTED){ + $("#connection-status").text("Connected"); + $("#connection-status").css("color", "green"); + } + } +} + + +module.exports = { openConnectionPage }; +},{"./client.js":2,"./hiddify_grpc_web_pb.js":10}],4:[function(require,module,exports){ const { listExtensions } = require('./extensionList.js'); - +const { openConnectionPage } = require('./connectionPage.js'); window.onload = () => { listExtensions(); + openConnectionPage(); }; -},{"./extensionList.js":4}],4:[function(require,module,exports){ +},{"./connectionPage.js":3,"./extensionList.js":5}],5:[function(require,module,exports){ -const { client,extension } = require('./client.js'); +const { extensionClient } = require('./client.js'); +const extension = require("./extension_grpc_web_pb.js"); async function listExtensions() { $("#extension-list-container").show(); $("#extension-page-container").hide(); + $("#connection-page").show(); try { - const extensionListContainer = document.getElementById('extension-list-container'); + const extensionListContainer = document.getElementById('extension-list'); extensionListContainer.innerHTML = ''; // Clear previous entries - const response = await client.listExtensions(new extension.Empty(), {}); - const header = document.createElement('h1'); - header.classList.add('mb-4'); - header.textContent = "Extension List"; - extensionListContainer.appendChild(header); - + const response = await extensionClient.listExtensions(new extension.Empty(), {}); + const extensionList = response.getExtensionsList(); extensionList.forEach(ext => { const listItem = createExtensionListItem(ext); @@ -517,14 +628,20 @@ function createExtensionListItem(ext) { descriptionElement.className = 'mb-0'; descriptionElement.textContent = ext.getDescription(); contentDiv.appendChild(descriptionElement); - + contentDiv.style.width="100%"; listItem.appendChild(contentDiv); const switchDiv = createSwitchElement(ext); listItem.appendChild(switchDiv); const {openExtensionPage} = require('./extensionPage.js'); - listItem.addEventListener('click', () => openExtensionPage(ext.getId())); + contentDiv.addEventListener('click', () =>{ + if (!ext.getEnable() ){ + alert("Extension is not enabled") + return + } + openExtensionPage(ext.getId()) + }); return listItem; } @@ -537,7 +654,10 @@ function createSwitchElement(ext) { switchButton.type = 'checkbox'; switchButton.className = 'form-check-input'; switchButton.checked = ext.getEnable(); - switchButton.addEventListener('change', () => toggleExtension(ext.getId(), switchButton.checked)); + switchButton.addEventListener('change', (e) => { + + toggleExtension(ext.getId(), switchButton.checked) + }); switchDiv.appendChild(switchButton); return switchDiv; @@ -549,38 +669,46 @@ async function toggleExtension(extensionId, enable) { request.setEnable(enable); try { - await client.editExtension(request, {}); + await extensionClient.editExtension(request, {}); console.log(`Extension ${extensionId} updated to ${enable ? 'enabled' : 'disabled'}`); } catch (err) { console.error('Error updating extension status:', err); } + listExtensions(); } module.exports = { listExtensions }; -},{"./client.js":2,"./extensionPage.js":5}],5:[function(require,module,exports){ -const { client,extension } = require('./client.js'); +},{"./client.js":2,"./extensionPage.js":6,"./extension_grpc_web_pb.js":7}],6:[function(require,module,exports){ +const { extensionClient } = require('./client.js'); +const extension = require("./extension_grpc_web_pb.js"); + const { renderForm } = require('./formRenderer.js'); const { listExtensions } = require('./extensionList.js'); var currentExtensionId=undefined; function openExtensionPage(extensionId) { currentExtensionId=extensionId; $("#extension-list-container").hide(); - $("#extension-page-container").show(); - const request = new extension.ExtensionRequest(); - request.setExtensionId(extensionId); + $("#extension-page-container").show(); + $("#connection-page").hide(); + connect() +} - const stream = client.connect(request, {}); +function connect() { + const request = new extension.ExtensionRequest(); + request.setExtensionId(currentExtensionId); + + const stream = extensionClient.connect(request, {}); stream.on('data', (response) => { - + console.log('Receving ',response); if (response.getExtensionId() === currentExtensionId) { ui=JSON.parse(response.getJsonUi()) if(response.getType()== proto.hiddifyrpc.ExtensionResponseType.SHOW_DIALOG) { renderForm(ui, "dialog",handleSubmitButtonClick,handleCancelButtonClick,undefined); }else{ - renderForm(ui, "",handleSubmitButtonClick,handleCancelButtonClick,handleStopButtonClick); + renderForm(ui, "",handleSubmitButtonClick,handleCancelButtonClick); } @@ -589,25 +717,29 @@ function openExtensionPage(extensionId) { stream.on('error', (err) => { console.error('Error opening extension page:', err); + // openExtensionPage(extensionId); }); stream.on('end', () => { console.log('Stream ended'); + setTimeout(connect, 1000); + }); } async function handleSubmitButtonClick(event) { event.preventDefault(); + bootstrap.Modal.getOrCreateInstance("#extension-dialog").hide(); const formData = new FormData(event.target.closest('form')); const request = new extension.ExtensionRequest(); - + const datamap=request.getDataMap() formData.forEach((value, key) => { - request.getDataMap()[key] = value; + datamap.set(key,value); }); request.setExtensionId(currentExtensionId); try { - await client.submitForm(request, {}); + await extensionClient.submitForm(request, {}); console.log('Form submitted successfully.'); } catch (err) { console.error('Error submitting form:', err); @@ -620,7 +752,9 @@ async function handleCancelButtonClick(event) { request.setExtensionId(currentExtensionId); try { - await client.cancel(request, {}); + bootstrap.Modal.getOrCreateInstance("#extension-dialog").hide(); + + await extensionClient.cancel(request, {}); console.log('Extension cancelled successfully.'); } catch (err) { console.error('Error cancelling extension:', err); @@ -633,7 +767,7 @@ async function handleStopButtonClick(event) { request.setExtensionId(currentExtensionId); try { - await client.stop(request, {}); + await extensionClient.stop(request, {}); console.log('Extension stopped successfully.'); currentExtensionId = undefined; listExtensions(); // Return to the extension list @@ -645,7 +779,7 @@ async function handleStopButtonClick(event) { module.exports = { openExtensionPage }; -},{"./client.js":2,"./extensionList.js":4,"./formRenderer.js":8}],6:[function(require,module,exports){ +},{"./client.js":2,"./extensionList.js":5,"./extension_grpc_web_pb.js":7,"./formRenderer.js":9}],7:[function(require,module,exports){ /** * @fileoverview gRPC-Web generated client stub for hiddifyrpc * @enhanceable @@ -1149,7 +1283,7 @@ proto.hiddifyrpc.ExtensionHostServicePromiseClient.prototype.getUI = module.exports = proto.hiddifyrpc; -},{"./base_pb.js":1,"./extension_pb.js":7,"grpc-web":10}],7:[function(require,module,exports){ +},{"./base_pb.js":1,"./extension_pb.js":8,"grpc-web":13}],8:[function(require,module,exports){ // source: extension.proto /** * @fileoverview @@ -2404,9 +2538,13 @@ proto.hiddifyrpc.ExtensionResponseType = { goog.object.extend(exports, proto.hiddifyrpc); -},{"./base_pb.js":1,"google-protobuf":9}],8:[function(require,module,exports){ -const { client } = require('./client.js'); -const extension = require("./extension_grpc_web_pb.js"); +},{"./base_pb.js":1,"google-protobuf":12}],9:[function(require,module,exports){ + +const ansi_up = new AnsiUp({ + escape_html: false, + +}); + function renderForm(json, dialog, submitAction, cancelAction, stopAction) { const container = document.getElementById(`extension-page-container${dialog}`); @@ -2417,23 +2555,36 @@ function renderForm(json, dialog, submitAction, cancelAction, stopAction) { existingForm.remove(); } const form = document.createElement('form'); + container.appendChild(form); form.id = formId; if (dialog === "dialog") { document.getElementById("modalLabel").textContent = json.title; } else { const titleElement = createTitleElement(json); + if (stopAction != undefined) { + const stopButton = document.createElement('button'); + stopButton.textContent = "Back"; + stopButton.classList.add('btn', 'btn-danger'); + stopButton.addEventListener('click', stopAction); + form.appendChild(stopButton); + } form.appendChild(titleElement); } addElementsToForm(form, json); - const buttonGroup = createButtonGroup(json, submitAction, cancelAction, stopAction); + const buttonGroup = createButtonGroup(json, submitAction, cancelAction); if (dialog === "dialog") { document.getElementById("modal-footer").innerHTML = ''; document.getElementById("modal-footer").appendChild(buttonGroup); + const dialog = bootstrap.Modal.getOrCreateInstance("#extension-dialog"); + dialog.show() + dialog.on("hidden.bs.modal", () => { + cancelAction() + }) } else { form.appendChild(buttonGroup); } - container.appendChild(form); + } function addElementsToForm(form, json) { @@ -2443,12 +2594,12 @@ function addElementsToForm(form, json) { const description = document.createElement('p'); description.textContent = json.description; form.appendChild(description); - - json.fields.forEach(field => { - const formGroup = createFormGroup(field); - form.appendChild(formGroup); - }); - + if (json.fields) { + json.fields.forEach(field => { + const formGroup = createFormGroup(field); + form.appendChild(formGroup); + }); + } return form; } @@ -2479,6 +2630,11 @@ function createInputElement(field) { let input; switch (field.type) { + case "Console": + input = document.createElement('pre'); + input.innerHTML = ansi_up.ansi_to_html(field.value || field.placeholder || ''); + input.style.maxHeight = field.lines * 20 + 'px'; + break; case "TextArea": input = document.createElement('textarea'); input.rows = field.lines || 3; @@ -2574,30 +2730,25 @@ function createSwitchElement(field) { return switchWrapper; } -function createButtonGroup(json, submitAction, cancelAction, stopAction) { +function createButtonGroup(json, submitAction, cancelAction) { const buttonGroup = document.createElement('div'); buttonGroup.classList.add('btn-group'); + json.buttons.forEach(buttonText => { + const btn = document.createElement('button'); + btn.classList.add('btn',"btn-default"); + buttonGroup.appendChild(btn); + btn.textContent = buttonText + if (buttonText=="Cancel") { + btn.classList.add( 'btn-secondary'); + btn.addEventListener('click', cancelAction); + }else{ + if (buttonText=="Submit"||buttonText=="Ok") + btn.classList.add('btn-primary'); + btn.addEventListener('click', submitAction); + } + + }) - const cancelButton = document.createElement('button'); - cancelButton.textContent = "Cancel"; - cancelButton.classList.add('btn', 'btn-secondary'); - cancelButton.addEventListener('click', cancelAction); - buttonGroup.appendChild(cancelButton); - if (stopAction != undefined) { - const stopButton = document.createElement('button'); - stopButton.textContent = "Stop"; - stopButton.classList.add('btn', 'btn-danger'); - stopButton.addEventListener('click', stopAction); - buttonGroup.appendChild(stopButton); - } - - if (json.buttonMode === "SubmitCancel") { - const submitButton = document.createElement('button'); - submitButton.textContent = "Submit"; - submitButton.classList.add('btn', 'btn-primary'); - submitButton.addEventListener('click', submitAction); - buttonGroup.appendChild(submitButton); - } return buttonGroup; @@ -2605,7 +2756,6905 @@ function createButtonGroup(json, submitAction, cancelAction, stopAction) { module.exports = { renderForm }; -},{"./client.js":2,"./extension_grpc_web_pb.js":6}],9:[function(require,module,exports){ +},{}],10:[function(require,module,exports){ +/** + * @fileoverview gRPC-Web generated client stub for hiddifyrpc + * @enhanceable + * @public + */ + +// Code generated by protoc-gen-grpc-web. DO NOT EDIT. +// versions: +// protoc-gen-grpc-web v1.5.0 +// protoc v5.28.0 +// source: hiddify.proto + + +/* eslint-disable */ +// @ts-nocheck + + + +const grpc = {}; +grpc.web = require('grpc-web'); + + +var base_pb = require('./base_pb.js') +const proto = {}; +proto.hiddifyrpc = require('./hiddify_pb.js'); + +/** + * @param {string} hostname + * @param {?Object} credentials + * @param {?grpc.web.ClientOptions} options + * @constructor + * @struct + * @final + */ +proto.hiddifyrpc.HelloClient = + function(hostname, credentials, options) { + if (!options) options = {}; + options.format = 'text'; + + /** + * @private @const {!grpc.web.GrpcWebClientBase} The client + */ + this.client_ = new grpc.web.GrpcWebClientBase(options); + + /** + * @private @const {string} The hostname + */ + this.hostname_ = hostname.replace(/\/+$/, ''); + +}; + + +/** + * @param {string} hostname + * @param {?Object} credentials + * @param {?grpc.web.ClientOptions} options + * @constructor + * @struct + * @final + */ +proto.hiddifyrpc.HelloPromiseClient = + function(hostname, credentials, options) { + if (!options) options = {}; + options.format = 'text'; + + /** + * @private @const {!grpc.web.GrpcWebClientBase} The client + */ + this.client_ = new grpc.web.GrpcWebClientBase(options); + + /** + * @private @const {string} The hostname + */ + this.hostname_ = hostname.replace(/\/+$/, ''); + +}; + + +/** + * @const + * @type {!grpc.web.MethodDescriptor< + * !proto.hiddifyrpc.HelloRequest, + * !proto.hiddifyrpc.HelloResponse>} + */ +const methodDescriptor_Hello_SayHello = new grpc.web.MethodDescriptor( + '/hiddifyrpc.Hello/SayHello', + grpc.web.MethodType.UNARY, + base_pb.HelloRequest, + base_pb.HelloResponse, + /** + * @param {!proto.hiddifyrpc.HelloRequest} request + * @return {!Uint8Array} + */ + function(request) { + return request.serializeBinary(); + }, + base_pb.HelloResponse.deserializeBinary +); + + +/** + * @param {!proto.hiddifyrpc.HelloRequest} request The + * request proto + * @param {?Object} metadata User defined + * call metadata + * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.HelloResponse)} + * callback The callback function(error, response) + * @return {!grpc.web.ClientReadableStream|undefined} + * The XHR Node Readable Stream + */ +proto.hiddifyrpc.HelloClient.prototype.sayHello = + function(request, metadata, callback) { + return this.client_.rpcCall(this.hostname_ + + '/hiddifyrpc.Hello/SayHello', + request, + metadata || {}, + methodDescriptor_Hello_SayHello, + callback); +}; + + +/** + * @param {!proto.hiddifyrpc.HelloRequest} request The + * request proto + * @param {?Object=} metadata User defined + * call metadata + * @return {!Promise} + * Promise that resolves to the response + */ +proto.hiddifyrpc.HelloPromiseClient.prototype.sayHello = + function(request, metadata) { + return this.client_.unaryCall(this.hostname_ + + '/hiddifyrpc.Hello/SayHello', + request, + metadata || {}, + methodDescriptor_Hello_SayHello); +}; + + +/** + * @param {string} hostname + * @param {?Object} credentials + * @param {?grpc.web.ClientOptions} options + * @constructor + * @struct + * @final + */ +proto.hiddifyrpc.CoreClient = + function(hostname, credentials, options) { + if (!options) options = {}; + options.format = 'text'; + + /** + * @private @const {!grpc.web.GrpcWebClientBase} The client + */ + this.client_ = new grpc.web.GrpcWebClientBase(options); + + /** + * @private @const {string} The hostname + */ + this.hostname_ = hostname.replace(/\/+$/, ''); + +}; + + +/** + * @param {string} hostname + * @param {?Object} credentials + * @param {?grpc.web.ClientOptions} options + * @constructor + * @struct + * @final + */ +proto.hiddifyrpc.CorePromiseClient = + function(hostname, credentials, options) { + if (!options) options = {}; + options.format = 'text'; + + /** + * @private @const {!grpc.web.GrpcWebClientBase} The client + */ + this.client_ = new grpc.web.GrpcWebClientBase(options); + + /** + * @private @const {string} The hostname + */ + this.hostname_ = hostname.replace(/\/+$/, ''); + +}; + + +/** + * @const + * @type {!grpc.web.MethodDescriptor< + * !proto.hiddifyrpc.StartRequest, + * !proto.hiddifyrpc.CoreInfoResponse>} + */ +const methodDescriptor_Core_Start = new grpc.web.MethodDescriptor( + '/hiddifyrpc.Core/Start', + grpc.web.MethodType.UNARY, + proto.hiddifyrpc.StartRequest, + proto.hiddifyrpc.CoreInfoResponse, + /** + * @param {!proto.hiddifyrpc.StartRequest} request + * @return {!Uint8Array} + */ + function(request) { + return request.serializeBinary(); + }, + proto.hiddifyrpc.CoreInfoResponse.deserializeBinary +); + + +/** + * @param {!proto.hiddifyrpc.StartRequest} request The + * request proto + * @param {?Object} metadata User defined + * call metadata + * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.CoreInfoResponse)} + * callback The callback function(error, response) + * @return {!grpc.web.ClientReadableStream|undefined} + * The XHR Node Readable Stream + */ +proto.hiddifyrpc.CoreClient.prototype.start = + function(request, metadata, callback) { + return this.client_.rpcCall(this.hostname_ + + '/hiddifyrpc.Core/Start', + request, + metadata || {}, + methodDescriptor_Core_Start, + callback); +}; + + +/** + * @param {!proto.hiddifyrpc.StartRequest} request The + * request proto + * @param {?Object=} metadata User defined + * call metadata + * @return {!Promise} + * Promise that resolves to the response + */ +proto.hiddifyrpc.CorePromiseClient.prototype.start = + function(request, metadata) { + return this.client_.unaryCall(this.hostname_ + + '/hiddifyrpc.Core/Start', + request, + metadata || {}, + methodDescriptor_Core_Start); +}; + + +/** + * @const + * @type {!grpc.web.MethodDescriptor< + * !proto.hiddifyrpc.Empty, + * !proto.hiddifyrpc.CoreInfoResponse>} + */ +const methodDescriptor_Core_CoreInfoListener = new grpc.web.MethodDescriptor( + '/hiddifyrpc.Core/CoreInfoListener', + grpc.web.MethodType.SERVER_STREAMING, + base_pb.Empty, + proto.hiddifyrpc.CoreInfoResponse, + /** + * @param {!proto.hiddifyrpc.Empty} request + * @return {!Uint8Array} + */ + function(request) { + return request.serializeBinary(); + }, + proto.hiddifyrpc.CoreInfoResponse.deserializeBinary +); + + +/** + * @param {!proto.hiddifyrpc.Empty} request The request proto + * @param {?Object=} metadata User defined + * call metadata + * @return {!grpc.web.ClientReadableStream} + * The XHR Node Readable Stream + */ +proto.hiddifyrpc.CoreClient.prototype.coreInfoListener = + function(request, metadata) { + return this.client_.serverStreaming(this.hostname_ + + '/hiddifyrpc.Core/CoreInfoListener', + request, + metadata || {}, + methodDescriptor_Core_CoreInfoListener); +}; + + +/** + * @param {!proto.hiddifyrpc.Empty} request The request proto + * @param {?Object=} metadata User defined + * call metadata + * @return {!grpc.web.ClientReadableStream} + * The XHR Node Readable Stream + */ +proto.hiddifyrpc.CorePromiseClient.prototype.coreInfoListener = + function(request, metadata) { + return this.client_.serverStreaming(this.hostname_ + + '/hiddifyrpc.Core/CoreInfoListener', + request, + metadata || {}, + methodDescriptor_Core_CoreInfoListener); +}; + + +/** + * @const + * @type {!grpc.web.MethodDescriptor< + * !proto.hiddifyrpc.Empty, + * !proto.hiddifyrpc.OutboundGroupList>} + */ +const methodDescriptor_Core_OutboundsInfo = new grpc.web.MethodDescriptor( + '/hiddifyrpc.Core/OutboundsInfo', + grpc.web.MethodType.SERVER_STREAMING, + base_pb.Empty, + proto.hiddifyrpc.OutboundGroupList, + /** + * @param {!proto.hiddifyrpc.Empty} request + * @return {!Uint8Array} + */ + function(request) { + return request.serializeBinary(); + }, + proto.hiddifyrpc.OutboundGroupList.deserializeBinary +); + + +/** + * @param {!proto.hiddifyrpc.Empty} request The request proto + * @param {?Object=} metadata User defined + * call metadata + * @return {!grpc.web.ClientReadableStream} + * The XHR Node Readable Stream + */ +proto.hiddifyrpc.CoreClient.prototype.outboundsInfo = + function(request, metadata) { + return this.client_.serverStreaming(this.hostname_ + + '/hiddifyrpc.Core/OutboundsInfo', + request, + metadata || {}, + methodDescriptor_Core_OutboundsInfo); +}; + + +/** + * @param {!proto.hiddifyrpc.Empty} request The request proto + * @param {?Object=} metadata User defined + * call metadata + * @return {!grpc.web.ClientReadableStream} + * The XHR Node Readable Stream + */ +proto.hiddifyrpc.CorePromiseClient.prototype.outboundsInfo = + function(request, metadata) { + return this.client_.serverStreaming(this.hostname_ + + '/hiddifyrpc.Core/OutboundsInfo', + request, + metadata || {}, + methodDescriptor_Core_OutboundsInfo); +}; + + +/** + * @const + * @type {!grpc.web.MethodDescriptor< + * !proto.hiddifyrpc.Empty, + * !proto.hiddifyrpc.OutboundGroupList>} + */ +const methodDescriptor_Core_MainOutboundsInfo = new grpc.web.MethodDescriptor( + '/hiddifyrpc.Core/MainOutboundsInfo', + grpc.web.MethodType.SERVER_STREAMING, + base_pb.Empty, + proto.hiddifyrpc.OutboundGroupList, + /** + * @param {!proto.hiddifyrpc.Empty} request + * @return {!Uint8Array} + */ + function(request) { + return request.serializeBinary(); + }, + proto.hiddifyrpc.OutboundGroupList.deserializeBinary +); + + +/** + * @param {!proto.hiddifyrpc.Empty} request The request proto + * @param {?Object=} metadata User defined + * call metadata + * @return {!grpc.web.ClientReadableStream} + * The XHR Node Readable Stream + */ +proto.hiddifyrpc.CoreClient.prototype.mainOutboundsInfo = + function(request, metadata) { + return this.client_.serverStreaming(this.hostname_ + + '/hiddifyrpc.Core/MainOutboundsInfo', + request, + metadata || {}, + methodDescriptor_Core_MainOutboundsInfo); +}; + + +/** + * @param {!proto.hiddifyrpc.Empty} request The request proto + * @param {?Object=} metadata User defined + * call metadata + * @return {!grpc.web.ClientReadableStream} + * The XHR Node Readable Stream + */ +proto.hiddifyrpc.CorePromiseClient.prototype.mainOutboundsInfo = + function(request, metadata) { + return this.client_.serverStreaming(this.hostname_ + + '/hiddifyrpc.Core/MainOutboundsInfo', + request, + metadata || {}, + methodDescriptor_Core_MainOutboundsInfo); +}; + + +/** + * @const + * @type {!grpc.web.MethodDescriptor< + * !proto.hiddifyrpc.Empty, + * !proto.hiddifyrpc.SystemInfo>} + */ +const methodDescriptor_Core_GetSystemInfo = new grpc.web.MethodDescriptor( + '/hiddifyrpc.Core/GetSystemInfo', + grpc.web.MethodType.SERVER_STREAMING, + base_pb.Empty, + proto.hiddifyrpc.SystemInfo, + /** + * @param {!proto.hiddifyrpc.Empty} request + * @return {!Uint8Array} + */ + function(request) { + return request.serializeBinary(); + }, + proto.hiddifyrpc.SystemInfo.deserializeBinary +); + + +/** + * @param {!proto.hiddifyrpc.Empty} request The request proto + * @param {?Object=} metadata User defined + * call metadata + * @return {!grpc.web.ClientReadableStream} + * The XHR Node Readable Stream + */ +proto.hiddifyrpc.CoreClient.prototype.getSystemInfo = + function(request, metadata) { + return this.client_.serverStreaming(this.hostname_ + + '/hiddifyrpc.Core/GetSystemInfo', + request, + metadata || {}, + methodDescriptor_Core_GetSystemInfo); +}; + + +/** + * @param {!proto.hiddifyrpc.Empty} request The request proto + * @param {?Object=} metadata User defined + * call metadata + * @return {!grpc.web.ClientReadableStream} + * The XHR Node Readable Stream + */ +proto.hiddifyrpc.CorePromiseClient.prototype.getSystemInfo = + function(request, metadata) { + return this.client_.serverStreaming(this.hostname_ + + '/hiddifyrpc.Core/GetSystemInfo', + request, + metadata || {}, + methodDescriptor_Core_GetSystemInfo); +}; + + +/** + * @const + * @type {!grpc.web.MethodDescriptor< + * !proto.hiddifyrpc.SetupRequest, + * !proto.hiddifyrpc.Response>} + */ +const methodDescriptor_Core_Setup = new grpc.web.MethodDescriptor( + '/hiddifyrpc.Core/Setup', + grpc.web.MethodType.UNARY, + proto.hiddifyrpc.SetupRequest, + proto.hiddifyrpc.Response, + /** + * @param {!proto.hiddifyrpc.SetupRequest} request + * @return {!Uint8Array} + */ + function(request) { + return request.serializeBinary(); + }, + proto.hiddifyrpc.Response.deserializeBinary +); + + +/** + * @param {!proto.hiddifyrpc.SetupRequest} request The + * request proto + * @param {?Object} metadata User defined + * call metadata + * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.Response)} + * callback The callback function(error, response) + * @return {!grpc.web.ClientReadableStream|undefined} + * The XHR Node Readable Stream + */ +proto.hiddifyrpc.CoreClient.prototype.setup = + function(request, metadata, callback) { + return this.client_.rpcCall(this.hostname_ + + '/hiddifyrpc.Core/Setup', + request, + metadata || {}, + methodDescriptor_Core_Setup, + callback); +}; + + +/** + * @param {!proto.hiddifyrpc.SetupRequest} request The + * request proto + * @param {?Object=} metadata User defined + * call metadata + * @return {!Promise} + * Promise that resolves to the response + */ +proto.hiddifyrpc.CorePromiseClient.prototype.setup = + function(request, metadata) { + return this.client_.unaryCall(this.hostname_ + + '/hiddifyrpc.Core/Setup', + request, + metadata || {}, + methodDescriptor_Core_Setup); +}; + + +/** + * @const + * @type {!grpc.web.MethodDescriptor< + * !proto.hiddifyrpc.ParseRequest, + * !proto.hiddifyrpc.ParseResponse>} + */ +const methodDescriptor_Core_Parse = new grpc.web.MethodDescriptor( + '/hiddifyrpc.Core/Parse', + grpc.web.MethodType.UNARY, + proto.hiddifyrpc.ParseRequest, + proto.hiddifyrpc.ParseResponse, + /** + * @param {!proto.hiddifyrpc.ParseRequest} request + * @return {!Uint8Array} + */ + function(request) { + return request.serializeBinary(); + }, + proto.hiddifyrpc.ParseResponse.deserializeBinary +); + + +/** + * @param {!proto.hiddifyrpc.ParseRequest} request The + * request proto + * @param {?Object} metadata User defined + * call metadata + * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.ParseResponse)} + * callback The callback function(error, response) + * @return {!grpc.web.ClientReadableStream|undefined} + * The XHR Node Readable Stream + */ +proto.hiddifyrpc.CoreClient.prototype.parse = + function(request, metadata, callback) { + return this.client_.rpcCall(this.hostname_ + + '/hiddifyrpc.Core/Parse', + request, + metadata || {}, + methodDescriptor_Core_Parse, + callback); +}; + + +/** + * @param {!proto.hiddifyrpc.ParseRequest} request The + * request proto + * @param {?Object=} metadata User defined + * call metadata + * @return {!Promise} + * Promise that resolves to the response + */ +proto.hiddifyrpc.CorePromiseClient.prototype.parse = + function(request, metadata) { + return this.client_.unaryCall(this.hostname_ + + '/hiddifyrpc.Core/Parse', + request, + metadata || {}, + methodDescriptor_Core_Parse); +}; + + +/** + * @const + * @type {!grpc.web.MethodDescriptor< + * !proto.hiddifyrpc.ChangeHiddifySettingsRequest, + * !proto.hiddifyrpc.CoreInfoResponse>} + */ +const methodDescriptor_Core_ChangeHiddifySettings = new grpc.web.MethodDescriptor( + '/hiddifyrpc.Core/ChangeHiddifySettings', + grpc.web.MethodType.UNARY, + proto.hiddifyrpc.ChangeHiddifySettingsRequest, + proto.hiddifyrpc.CoreInfoResponse, + /** + * @param {!proto.hiddifyrpc.ChangeHiddifySettingsRequest} request + * @return {!Uint8Array} + */ + function(request) { + return request.serializeBinary(); + }, + proto.hiddifyrpc.CoreInfoResponse.deserializeBinary +); + + +/** + * @param {!proto.hiddifyrpc.ChangeHiddifySettingsRequest} request The + * request proto + * @param {?Object} metadata User defined + * call metadata + * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.CoreInfoResponse)} + * callback The callback function(error, response) + * @return {!grpc.web.ClientReadableStream|undefined} + * The XHR Node Readable Stream + */ +proto.hiddifyrpc.CoreClient.prototype.changeHiddifySettings = + function(request, metadata, callback) { + return this.client_.rpcCall(this.hostname_ + + '/hiddifyrpc.Core/ChangeHiddifySettings', + request, + metadata || {}, + methodDescriptor_Core_ChangeHiddifySettings, + callback); +}; + + +/** + * @param {!proto.hiddifyrpc.ChangeHiddifySettingsRequest} request The + * request proto + * @param {?Object=} metadata User defined + * call metadata + * @return {!Promise} + * Promise that resolves to the response + */ +proto.hiddifyrpc.CorePromiseClient.prototype.changeHiddifySettings = + function(request, metadata) { + return this.client_.unaryCall(this.hostname_ + + '/hiddifyrpc.Core/ChangeHiddifySettings', + request, + metadata || {}, + methodDescriptor_Core_ChangeHiddifySettings); +}; + + +/** + * @const + * @type {!grpc.web.MethodDescriptor< + * !proto.hiddifyrpc.StartRequest, + * !proto.hiddifyrpc.CoreInfoResponse>} + */ +const methodDescriptor_Core_StartService = new grpc.web.MethodDescriptor( + '/hiddifyrpc.Core/StartService', + grpc.web.MethodType.UNARY, + proto.hiddifyrpc.StartRequest, + proto.hiddifyrpc.CoreInfoResponse, + /** + * @param {!proto.hiddifyrpc.StartRequest} request + * @return {!Uint8Array} + */ + function(request) { + return request.serializeBinary(); + }, + proto.hiddifyrpc.CoreInfoResponse.deserializeBinary +); + + +/** + * @param {!proto.hiddifyrpc.StartRequest} request The + * request proto + * @param {?Object} metadata User defined + * call metadata + * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.CoreInfoResponse)} + * callback The callback function(error, response) + * @return {!grpc.web.ClientReadableStream|undefined} + * The XHR Node Readable Stream + */ +proto.hiddifyrpc.CoreClient.prototype.startService = + function(request, metadata, callback) { + return this.client_.rpcCall(this.hostname_ + + '/hiddifyrpc.Core/StartService', + request, + metadata || {}, + methodDescriptor_Core_StartService, + callback); +}; + + +/** + * @param {!proto.hiddifyrpc.StartRequest} request The + * request proto + * @param {?Object=} metadata User defined + * call metadata + * @return {!Promise} + * Promise that resolves to the response + */ +proto.hiddifyrpc.CorePromiseClient.prototype.startService = + function(request, metadata) { + return this.client_.unaryCall(this.hostname_ + + '/hiddifyrpc.Core/StartService', + request, + metadata || {}, + methodDescriptor_Core_StartService); +}; + + +/** + * @const + * @type {!grpc.web.MethodDescriptor< + * !proto.hiddifyrpc.Empty, + * !proto.hiddifyrpc.CoreInfoResponse>} + */ +const methodDescriptor_Core_Stop = new grpc.web.MethodDescriptor( + '/hiddifyrpc.Core/Stop', + grpc.web.MethodType.UNARY, + base_pb.Empty, + proto.hiddifyrpc.CoreInfoResponse, + /** + * @param {!proto.hiddifyrpc.Empty} request + * @return {!Uint8Array} + */ + function(request) { + return request.serializeBinary(); + }, + proto.hiddifyrpc.CoreInfoResponse.deserializeBinary +); + + +/** + * @param {!proto.hiddifyrpc.Empty} request The + * request proto + * @param {?Object} metadata User defined + * call metadata + * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.CoreInfoResponse)} + * callback The callback function(error, response) + * @return {!grpc.web.ClientReadableStream|undefined} + * The XHR Node Readable Stream + */ +proto.hiddifyrpc.CoreClient.prototype.stop = + function(request, metadata, callback) { + return this.client_.rpcCall(this.hostname_ + + '/hiddifyrpc.Core/Stop', + request, + metadata || {}, + methodDescriptor_Core_Stop, + callback); +}; + + +/** + * @param {!proto.hiddifyrpc.Empty} request The + * request proto + * @param {?Object=} metadata User defined + * call metadata + * @return {!Promise} + * Promise that resolves to the response + */ +proto.hiddifyrpc.CorePromiseClient.prototype.stop = + function(request, metadata) { + return this.client_.unaryCall(this.hostname_ + + '/hiddifyrpc.Core/Stop', + request, + metadata || {}, + methodDescriptor_Core_Stop); +}; + + +/** + * @const + * @type {!grpc.web.MethodDescriptor< + * !proto.hiddifyrpc.StartRequest, + * !proto.hiddifyrpc.CoreInfoResponse>} + */ +const methodDescriptor_Core_Restart = new grpc.web.MethodDescriptor( + '/hiddifyrpc.Core/Restart', + grpc.web.MethodType.UNARY, + proto.hiddifyrpc.StartRequest, + proto.hiddifyrpc.CoreInfoResponse, + /** + * @param {!proto.hiddifyrpc.StartRequest} request + * @return {!Uint8Array} + */ + function(request) { + return request.serializeBinary(); + }, + proto.hiddifyrpc.CoreInfoResponse.deserializeBinary +); + + +/** + * @param {!proto.hiddifyrpc.StartRequest} request The + * request proto + * @param {?Object} metadata User defined + * call metadata + * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.CoreInfoResponse)} + * callback The callback function(error, response) + * @return {!grpc.web.ClientReadableStream|undefined} + * The XHR Node Readable Stream + */ +proto.hiddifyrpc.CoreClient.prototype.restart = + function(request, metadata, callback) { + return this.client_.rpcCall(this.hostname_ + + '/hiddifyrpc.Core/Restart', + request, + metadata || {}, + methodDescriptor_Core_Restart, + callback); +}; + + +/** + * @param {!proto.hiddifyrpc.StartRequest} request The + * request proto + * @param {?Object=} metadata User defined + * call metadata + * @return {!Promise} + * Promise that resolves to the response + */ +proto.hiddifyrpc.CorePromiseClient.prototype.restart = + function(request, metadata) { + return this.client_.unaryCall(this.hostname_ + + '/hiddifyrpc.Core/Restart', + request, + metadata || {}, + methodDescriptor_Core_Restart); +}; + + +/** + * @const + * @type {!grpc.web.MethodDescriptor< + * !proto.hiddifyrpc.SelectOutboundRequest, + * !proto.hiddifyrpc.Response>} + */ +const methodDescriptor_Core_SelectOutbound = new grpc.web.MethodDescriptor( + '/hiddifyrpc.Core/SelectOutbound', + grpc.web.MethodType.UNARY, + proto.hiddifyrpc.SelectOutboundRequest, + proto.hiddifyrpc.Response, + /** + * @param {!proto.hiddifyrpc.SelectOutboundRequest} request + * @return {!Uint8Array} + */ + function(request) { + return request.serializeBinary(); + }, + proto.hiddifyrpc.Response.deserializeBinary +); + + +/** + * @param {!proto.hiddifyrpc.SelectOutboundRequest} request The + * request proto + * @param {?Object} metadata User defined + * call metadata + * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.Response)} + * callback The callback function(error, response) + * @return {!grpc.web.ClientReadableStream|undefined} + * The XHR Node Readable Stream + */ +proto.hiddifyrpc.CoreClient.prototype.selectOutbound = + function(request, metadata, callback) { + return this.client_.rpcCall(this.hostname_ + + '/hiddifyrpc.Core/SelectOutbound', + request, + metadata || {}, + methodDescriptor_Core_SelectOutbound, + callback); +}; + + +/** + * @param {!proto.hiddifyrpc.SelectOutboundRequest} request The + * request proto + * @param {?Object=} metadata User defined + * call metadata + * @return {!Promise} + * Promise that resolves to the response + */ +proto.hiddifyrpc.CorePromiseClient.prototype.selectOutbound = + function(request, metadata) { + return this.client_.unaryCall(this.hostname_ + + '/hiddifyrpc.Core/SelectOutbound', + request, + metadata || {}, + methodDescriptor_Core_SelectOutbound); +}; + + +/** + * @const + * @type {!grpc.web.MethodDescriptor< + * !proto.hiddifyrpc.UrlTestRequest, + * !proto.hiddifyrpc.Response>} + */ +const methodDescriptor_Core_UrlTest = new grpc.web.MethodDescriptor( + '/hiddifyrpc.Core/UrlTest', + grpc.web.MethodType.UNARY, + proto.hiddifyrpc.UrlTestRequest, + proto.hiddifyrpc.Response, + /** + * @param {!proto.hiddifyrpc.UrlTestRequest} request + * @return {!Uint8Array} + */ + function(request) { + return request.serializeBinary(); + }, + proto.hiddifyrpc.Response.deserializeBinary +); + + +/** + * @param {!proto.hiddifyrpc.UrlTestRequest} request The + * request proto + * @param {?Object} metadata User defined + * call metadata + * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.Response)} + * callback The callback function(error, response) + * @return {!grpc.web.ClientReadableStream|undefined} + * The XHR Node Readable Stream + */ +proto.hiddifyrpc.CoreClient.prototype.urlTest = + function(request, metadata, callback) { + return this.client_.rpcCall(this.hostname_ + + '/hiddifyrpc.Core/UrlTest', + request, + metadata || {}, + methodDescriptor_Core_UrlTest, + callback); +}; + + +/** + * @param {!proto.hiddifyrpc.UrlTestRequest} request The + * request proto + * @param {?Object=} metadata User defined + * call metadata + * @return {!Promise} + * Promise that resolves to the response + */ +proto.hiddifyrpc.CorePromiseClient.prototype.urlTest = + function(request, metadata) { + return this.client_.unaryCall(this.hostname_ + + '/hiddifyrpc.Core/UrlTest', + request, + metadata || {}, + methodDescriptor_Core_UrlTest); +}; + + +/** + * @const + * @type {!grpc.web.MethodDescriptor< + * !proto.hiddifyrpc.GenerateWarpConfigRequest, + * !proto.hiddifyrpc.WarpGenerationResponse>} + */ +const methodDescriptor_Core_GenerateWarpConfig = new grpc.web.MethodDescriptor( + '/hiddifyrpc.Core/GenerateWarpConfig', + grpc.web.MethodType.UNARY, + proto.hiddifyrpc.GenerateWarpConfigRequest, + proto.hiddifyrpc.WarpGenerationResponse, + /** + * @param {!proto.hiddifyrpc.GenerateWarpConfigRequest} request + * @return {!Uint8Array} + */ + function(request) { + return request.serializeBinary(); + }, + proto.hiddifyrpc.WarpGenerationResponse.deserializeBinary +); + + +/** + * @param {!proto.hiddifyrpc.GenerateWarpConfigRequest} request The + * request proto + * @param {?Object} metadata User defined + * call metadata + * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.WarpGenerationResponse)} + * callback The callback function(error, response) + * @return {!grpc.web.ClientReadableStream|undefined} + * The XHR Node Readable Stream + */ +proto.hiddifyrpc.CoreClient.prototype.generateWarpConfig = + function(request, metadata, callback) { + return this.client_.rpcCall(this.hostname_ + + '/hiddifyrpc.Core/GenerateWarpConfig', + request, + metadata || {}, + methodDescriptor_Core_GenerateWarpConfig, + callback); +}; + + +/** + * @param {!proto.hiddifyrpc.GenerateWarpConfigRequest} request The + * request proto + * @param {?Object=} metadata User defined + * call metadata + * @return {!Promise} + * Promise that resolves to the response + */ +proto.hiddifyrpc.CorePromiseClient.prototype.generateWarpConfig = + function(request, metadata) { + return this.client_.unaryCall(this.hostname_ + + '/hiddifyrpc.Core/GenerateWarpConfig', + request, + metadata || {}, + methodDescriptor_Core_GenerateWarpConfig); +}; + + +/** + * @const + * @type {!grpc.web.MethodDescriptor< + * !proto.hiddifyrpc.Empty, + * !proto.hiddifyrpc.SystemProxyStatus>} + */ +const methodDescriptor_Core_GetSystemProxyStatus = new grpc.web.MethodDescriptor( + '/hiddifyrpc.Core/GetSystemProxyStatus', + grpc.web.MethodType.UNARY, + base_pb.Empty, + proto.hiddifyrpc.SystemProxyStatus, + /** + * @param {!proto.hiddifyrpc.Empty} request + * @return {!Uint8Array} + */ + function(request) { + return request.serializeBinary(); + }, + proto.hiddifyrpc.SystemProxyStatus.deserializeBinary +); + + +/** + * @param {!proto.hiddifyrpc.Empty} request The + * request proto + * @param {?Object} metadata User defined + * call metadata + * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.SystemProxyStatus)} + * callback The callback function(error, response) + * @return {!grpc.web.ClientReadableStream|undefined} + * The XHR Node Readable Stream + */ +proto.hiddifyrpc.CoreClient.prototype.getSystemProxyStatus = + function(request, metadata, callback) { + return this.client_.rpcCall(this.hostname_ + + '/hiddifyrpc.Core/GetSystemProxyStatus', + request, + metadata || {}, + methodDescriptor_Core_GetSystemProxyStatus, + callback); +}; + + +/** + * @param {!proto.hiddifyrpc.Empty} request The + * request proto + * @param {?Object=} metadata User defined + * call metadata + * @return {!Promise} + * Promise that resolves to the response + */ +proto.hiddifyrpc.CorePromiseClient.prototype.getSystemProxyStatus = + function(request, metadata) { + return this.client_.unaryCall(this.hostname_ + + '/hiddifyrpc.Core/GetSystemProxyStatus', + request, + metadata || {}, + methodDescriptor_Core_GetSystemProxyStatus); +}; + + +/** + * @const + * @type {!grpc.web.MethodDescriptor< + * !proto.hiddifyrpc.SetSystemProxyEnabledRequest, + * !proto.hiddifyrpc.Response>} + */ +const methodDescriptor_Core_SetSystemProxyEnabled = new grpc.web.MethodDescriptor( + '/hiddifyrpc.Core/SetSystemProxyEnabled', + grpc.web.MethodType.UNARY, + proto.hiddifyrpc.SetSystemProxyEnabledRequest, + proto.hiddifyrpc.Response, + /** + * @param {!proto.hiddifyrpc.SetSystemProxyEnabledRequest} request + * @return {!Uint8Array} + */ + function(request) { + return request.serializeBinary(); + }, + proto.hiddifyrpc.Response.deserializeBinary +); + + +/** + * @param {!proto.hiddifyrpc.SetSystemProxyEnabledRequest} request The + * request proto + * @param {?Object} metadata User defined + * call metadata + * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.Response)} + * callback The callback function(error, response) + * @return {!grpc.web.ClientReadableStream|undefined} + * The XHR Node Readable Stream + */ +proto.hiddifyrpc.CoreClient.prototype.setSystemProxyEnabled = + function(request, metadata, callback) { + return this.client_.rpcCall(this.hostname_ + + '/hiddifyrpc.Core/SetSystemProxyEnabled', + request, + metadata || {}, + methodDescriptor_Core_SetSystemProxyEnabled, + callback); +}; + + +/** + * @param {!proto.hiddifyrpc.SetSystemProxyEnabledRequest} request The + * request proto + * @param {?Object=} metadata User defined + * call metadata + * @return {!Promise} + * Promise that resolves to the response + */ +proto.hiddifyrpc.CorePromiseClient.prototype.setSystemProxyEnabled = + function(request, metadata) { + return this.client_.unaryCall(this.hostname_ + + '/hiddifyrpc.Core/SetSystemProxyEnabled', + request, + metadata || {}, + methodDescriptor_Core_SetSystemProxyEnabled); +}; + + +/** + * @const + * @type {!grpc.web.MethodDescriptor< + * !proto.hiddifyrpc.Empty, + * !proto.hiddifyrpc.LogMessage>} + */ +const methodDescriptor_Core_LogListener = new grpc.web.MethodDescriptor( + '/hiddifyrpc.Core/LogListener', + grpc.web.MethodType.SERVER_STREAMING, + base_pb.Empty, + proto.hiddifyrpc.LogMessage, + /** + * @param {!proto.hiddifyrpc.Empty} request + * @return {!Uint8Array} + */ + function(request) { + return request.serializeBinary(); + }, + proto.hiddifyrpc.LogMessage.deserializeBinary +); + + +/** + * @param {!proto.hiddifyrpc.Empty} request The request proto + * @param {?Object=} metadata User defined + * call metadata + * @return {!grpc.web.ClientReadableStream} + * The XHR Node Readable Stream + */ +proto.hiddifyrpc.CoreClient.prototype.logListener = + function(request, metadata) { + return this.client_.serverStreaming(this.hostname_ + + '/hiddifyrpc.Core/LogListener', + request, + metadata || {}, + methodDescriptor_Core_LogListener); +}; + + +/** + * @param {!proto.hiddifyrpc.Empty} request The request proto + * @param {?Object=} metadata User defined + * call metadata + * @return {!grpc.web.ClientReadableStream} + * The XHR Node Readable Stream + */ +proto.hiddifyrpc.CorePromiseClient.prototype.logListener = + function(request, metadata) { + return this.client_.serverStreaming(this.hostname_ + + '/hiddifyrpc.Core/LogListener', + request, + metadata || {}, + methodDescriptor_Core_LogListener); +}; + + +/** + * @param {string} hostname + * @param {?Object} credentials + * @param {?grpc.web.ClientOptions} options + * @constructor + * @struct + * @final + */ +proto.hiddifyrpc.TunnelServiceClient = + function(hostname, credentials, options) { + if (!options) options = {}; + options.format = 'text'; + + /** + * @private @const {!grpc.web.GrpcWebClientBase} The client + */ + this.client_ = new grpc.web.GrpcWebClientBase(options); + + /** + * @private @const {string} The hostname + */ + this.hostname_ = hostname.replace(/\/+$/, ''); + +}; + + +/** + * @param {string} hostname + * @param {?Object} credentials + * @param {?grpc.web.ClientOptions} options + * @constructor + * @struct + * @final + */ +proto.hiddifyrpc.TunnelServicePromiseClient = + function(hostname, credentials, options) { + if (!options) options = {}; + options.format = 'text'; + + /** + * @private @const {!grpc.web.GrpcWebClientBase} The client + */ + this.client_ = new grpc.web.GrpcWebClientBase(options); + + /** + * @private @const {string} The hostname + */ + this.hostname_ = hostname.replace(/\/+$/, ''); + +}; + + +/** + * @const + * @type {!grpc.web.MethodDescriptor< + * !proto.hiddifyrpc.TunnelStartRequest, + * !proto.hiddifyrpc.TunnelResponse>} + */ +const methodDescriptor_TunnelService_Start = new grpc.web.MethodDescriptor( + '/hiddifyrpc.TunnelService/Start', + grpc.web.MethodType.UNARY, + proto.hiddifyrpc.TunnelStartRequest, + proto.hiddifyrpc.TunnelResponse, + /** + * @param {!proto.hiddifyrpc.TunnelStartRequest} request + * @return {!Uint8Array} + */ + function(request) { + return request.serializeBinary(); + }, + proto.hiddifyrpc.TunnelResponse.deserializeBinary +); + + +/** + * @param {!proto.hiddifyrpc.TunnelStartRequest} request The + * request proto + * @param {?Object} metadata User defined + * call metadata + * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.TunnelResponse)} + * callback The callback function(error, response) + * @return {!grpc.web.ClientReadableStream|undefined} + * The XHR Node Readable Stream + */ +proto.hiddifyrpc.TunnelServiceClient.prototype.start = + function(request, metadata, callback) { + return this.client_.rpcCall(this.hostname_ + + '/hiddifyrpc.TunnelService/Start', + request, + metadata || {}, + methodDescriptor_TunnelService_Start, + callback); +}; + + +/** + * @param {!proto.hiddifyrpc.TunnelStartRequest} request The + * request proto + * @param {?Object=} metadata User defined + * call metadata + * @return {!Promise} + * Promise that resolves to the response + */ +proto.hiddifyrpc.TunnelServicePromiseClient.prototype.start = + function(request, metadata) { + return this.client_.unaryCall(this.hostname_ + + '/hiddifyrpc.TunnelService/Start', + request, + metadata || {}, + methodDescriptor_TunnelService_Start); +}; + + +/** + * @const + * @type {!grpc.web.MethodDescriptor< + * !proto.hiddifyrpc.Empty, + * !proto.hiddifyrpc.TunnelResponse>} + */ +const methodDescriptor_TunnelService_Stop = new grpc.web.MethodDescriptor( + '/hiddifyrpc.TunnelService/Stop', + grpc.web.MethodType.UNARY, + base_pb.Empty, + proto.hiddifyrpc.TunnelResponse, + /** + * @param {!proto.hiddifyrpc.Empty} request + * @return {!Uint8Array} + */ + function(request) { + return request.serializeBinary(); + }, + proto.hiddifyrpc.TunnelResponse.deserializeBinary +); + + +/** + * @param {!proto.hiddifyrpc.Empty} request The + * request proto + * @param {?Object} metadata User defined + * call metadata + * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.TunnelResponse)} + * callback The callback function(error, response) + * @return {!grpc.web.ClientReadableStream|undefined} + * The XHR Node Readable Stream + */ +proto.hiddifyrpc.TunnelServiceClient.prototype.stop = + function(request, metadata, callback) { + return this.client_.rpcCall(this.hostname_ + + '/hiddifyrpc.TunnelService/Stop', + request, + metadata || {}, + methodDescriptor_TunnelService_Stop, + callback); +}; + + +/** + * @param {!proto.hiddifyrpc.Empty} request The + * request proto + * @param {?Object=} metadata User defined + * call metadata + * @return {!Promise} + * Promise that resolves to the response + */ +proto.hiddifyrpc.TunnelServicePromiseClient.prototype.stop = + function(request, metadata) { + return this.client_.unaryCall(this.hostname_ + + '/hiddifyrpc.TunnelService/Stop', + request, + metadata || {}, + methodDescriptor_TunnelService_Stop); +}; + + +/** + * @const + * @type {!grpc.web.MethodDescriptor< + * !proto.hiddifyrpc.Empty, + * !proto.hiddifyrpc.TunnelResponse>} + */ +const methodDescriptor_TunnelService_Status = new grpc.web.MethodDescriptor( + '/hiddifyrpc.TunnelService/Status', + grpc.web.MethodType.UNARY, + base_pb.Empty, + proto.hiddifyrpc.TunnelResponse, + /** + * @param {!proto.hiddifyrpc.Empty} request + * @return {!Uint8Array} + */ + function(request) { + return request.serializeBinary(); + }, + proto.hiddifyrpc.TunnelResponse.deserializeBinary +); + + +/** + * @param {!proto.hiddifyrpc.Empty} request The + * request proto + * @param {?Object} metadata User defined + * call metadata + * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.TunnelResponse)} + * callback The callback function(error, response) + * @return {!grpc.web.ClientReadableStream|undefined} + * The XHR Node Readable Stream + */ +proto.hiddifyrpc.TunnelServiceClient.prototype.status = + function(request, metadata, callback) { + return this.client_.rpcCall(this.hostname_ + + '/hiddifyrpc.TunnelService/Status', + request, + metadata || {}, + methodDescriptor_TunnelService_Status, + callback); +}; + + +/** + * @param {!proto.hiddifyrpc.Empty} request The + * request proto + * @param {?Object=} metadata User defined + * call metadata + * @return {!Promise} + * Promise that resolves to the response + */ +proto.hiddifyrpc.TunnelServicePromiseClient.prototype.status = + function(request, metadata) { + return this.client_.unaryCall(this.hostname_ + + '/hiddifyrpc.TunnelService/Status', + request, + metadata || {}, + methodDescriptor_TunnelService_Status); +}; + + +/** + * @const + * @type {!grpc.web.MethodDescriptor< + * !proto.hiddifyrpc.Empty, + * !proto.hiddifyrpc.TunnelResponse>} + */ +const methodDescriptor_TunnelService_Exit = new grpc.web.MethodDescriptor( + '/hiddifyrpc.TunnelService/Exit', + grpc.web.MethodType.UNARY, + base_pb.Empty, + proto.hiddifyrpc.TunnelResponse, + /** + * @param {!proto.hiddifyrpc.Empty} request + * @return {!Uint8Array} + */ + function(request) { + return request.serializeBinary(); + }, + proto.hiddifyrpc.TunnelResponse.deserializeBinary +); + + +/** + * @param {!proto.hiddifyrpc.Empty} request The + * request proto + * @param {?Object} metadata User defined + * call metadata + * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.TunnelResponse)} + * callback The callback function(error, response) + * @return {!grpc.web.ClientReadableStream|undefined} + * The XHR Node Readable Stream + */ +proto.hiddifyrpc.TunnelServiceClient.prototype.exit = + function(request, metadata, callback) { + return this.client_.rpcCall(this.hostname_ + + '/hiddifyrpc.TunnelService/Exit', + request, + metadata || {}, + methodDescriptor_TunnelService_Exit, + callback); +}; + + +/** + * @param {!proto.hiddifyrpc.Empty} request The + * request proto + * @param {?Object=} metadata User defined + * call metadata + * @return {!Promise} + * Promise that resolves to the response + */ +proto.hiddifyrpc.TunnelServicePromiseClient.prototype.exit = + function(request, metadata) { + return this.client_.unaryCall(this.hostname_ + + '/hiddifyrpc.TunnelService/Exit', + request, + metadata || {}, + methodDescriptor_TunnelService_Exit); +}; + + +module.exports = proto.hiddifyrpc; + + +},{"./base_pb.js":1,"./hiddify_pb.js":11,"grpc-web":13}],11:[function(require,module,exports){ +// source: hiddify.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = + (typeof globalThis !== 'undefined' && globalThis) || + (typeof window !== 'undefined' && window) || + (typeof global !== 'undefined' && global) || + (typeof self !== 'undefined' && self) || + (function () { return this; }).call(null) || + Function('return this')(); + +var base_pb = require('./base_pb.js'); +goog.object.extend(proto, base_pb); +goog.exportSymbol('proto.hiddifyrpc.ChangeHiddifySettingsRequest', null, global); +goog.exportSymbol('proto.hiddifyrpc.CoreInfoResponse', null, global); +goog.exportSymbol('proto.hiddifyrpc.CoreState', null, global); +goog.exportSymbol('proto.hiddifyrpc.GenerateConfigRequest', null, global); +goog.exportSymbol('proto.hiddifyrpc.GenerateConfigResponse', null, global); +goog.exportSymbol('proto.hiddifyrpc.GenerateWarpConfigRequest', null, global); +goog.exportSymbol('proto.hiddifyrpc.LogLevel', null, global); +goog.exportSymbol('proto.hiddifyrpc.LogMessage', null, global); +goog.exportSymbol('proto.hiddifyrpc.LogType', null, global); +goog.exportSymbol('proto.hiddifyrpc.MessageType', null, global); +goog.exportSymbol('proto.hiddifyrpc.OutboundGroup', null, global); +goog.exportSymbol('proto.hiddifyrpc.OutboundGroupItem', null, global); +goog.exportSymbol('proto.hiddifyrpc.OutboundGroupList', null, global); +goog.exportSymbol('proto.hiddifyrpc.ParseRequest', null, global); +goog.exportSymbol('proto.hiddifyrpc.ParseResponse', null, global); +goog.exportSymbol('proto.hiddifyrpc.Response', null, global); +goog.exportSymbol('proto.hiddifyrpc.SelectOutboundRequest', null, global); +goog.exportSymbol('proto.hiddifyrpc.SetSystemProxyEnabledRequest', null, global); +goog.exportSymbol('proto.hiddifyrpc.SetupRequest', null, global); +goog.exportSymbol('proto.hiddifyrpc.StartRequest', null, global); +goog.exportSymbol('proto.hiddifyrpc.StopRequest', null, global); +goog.exportSymbol('proto.hiddifyrpc.SystemInfo', null, global); +goog.exportSymbol('proto.hiddifyrpc.SystemProxyStatus', null, global); +goog.exportSymbol('proto.hiddifyrpc.TunnelResponse', null, global); +goog.exportSymbol('proto.hiddifyrpc.TunnelStartRequest', null, global); +goog.exportSymbol('proto.hiddifyrpc.UrlTestRequest', null, global); +goog.exportSymbol('proto.hiddifyrpc.WarpAccount', null, global); +goog.exportSymbol('proto.hiddifyrpc.WarpGenerationResponse', null, global); +goog.exportSymbol('proto.hiddifyrpc.WarpWireguardConfig', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.hiddifyrpc.CoreInfoResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.hiddifyrpc.CoreInfoResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.hiddifyrpc.CoreInfoResponse.displayName = 'proto.hiddifyrpc.CoreInfoResponse'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.hiddifyrpc.StartRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.hiddifyrpc.StartRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.hiddifyrpc.StartRequest.displayName = 'proto.hiddifyrpc.StartRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.hiddifyrpc.SetupRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.hiddifyrpc.SetupRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.hiddifyrpc.SetupRequest.displayName = 'proto.hiddifyrpc.SetupRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.hiddifyrpc.Response = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.hiddifyrpc.Response, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.hiddifyrpc.Response.displayName = 'proto.hiddifyrpc.Response'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.hiddifyrpc.SystemInfo = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.hiddifyrpc.SystemInfo, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.hiddifyrpc.SystemInfo.displayName = 'proto.hiddifyrpc.SystemInfo'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.hiddifyrpc.OutboundGroupItem = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.hiddifyrpc.OutboundGroupItem, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.hiddifyrpc.OutboundGroupItem.displayName = 'proto.hiddifyrpc.OutboundGroupItem'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.hiddifyrpc.OutboundGroup = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.hiddifyrpc.OutboundGroup.repeatedFields_, null); +}; +goog.inherits(proto.hiddifyrpc.OutboundGroup, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.hiddifyrpc.OutboundGroup.displayName = 'proto.hiddifyrpc.OutboundGroup'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.hiddifyrpc.OutboundGroupList = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.hiddifyrpc.OutboundGroupList.repeatedFields_, null); +}; +goog.inherits(proto.hiddifyrpc.OutboundGroupList, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.hiddifyrpc.OutboundGroupList.displayName = 'proto.hiddifyrpc.OutboundGroupList'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.hiddifyrpc.WarpAccount = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.hiddifyrpc.WarpAccount, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.hiddifyrpc.WarpAccount.displayName = 'proto.hiddifyrpc.WarpAccount'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.hiddifyrpc.WarpWireguardConfig = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.hiddifyrpc.WarpWireguardConfig, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.hiddifyrpc.WarpWireguardConfig.displayName = 'proto.hiddifyrpc.WarpWireguardConfig'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.hiddifyrpc.WarpGenerationResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.hiddifyrpc.WarpGenerationResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.hiddifyrpc.WarpGenerationResponse.displayName = 'proto.hiddifyrpc.WarpGenerationResponse'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.hiddifyrpc.SystemProxyStatus = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.hiddifyrpc.SystemProxyStatus, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.hiddifyrpc.SystemProxyStatus.displayName = 'proto.hiddifyrpc.SystemProxyStatus'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.hiddifyrpc.ParseRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.hiddifyrpc.ParseRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.hiddifyrpc.ParseRequest.displayName = 'proto.hiddifyrpc.ParseRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.hiddifyrpc.ParseResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.hiddifyrpc.ParseResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.hiddifyrpc.ParseResponse.displayName = 'proto.hiddifyrpc.ParseResponse'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.hiddifyrpc.ChangeHiddifySettingsRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.hiddifyrpc.ChangeHiddifySettingsRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.hiddifyrpc.ChangeHiddifySettingsRequest.displayName = 'proto.hiddifyrpc.ChangeHiddifySettingsRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.hiddifyrpc.GenerateConfigRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.hiddifyrpc.GenerateConfigRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.hiddifyrpc.GenerateConfigRequest.displayName = 'proto.hiddifyrpc.GenerateConfigRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.hiddifyrpc.GenerateConfigResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.hiddifyrpc.GenerateConfigResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.hiddifyrpc.GenerateConfigResponse.displayName = 'proto.hiddifyrpc.GenerateConfigResponse'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.hiddifyrpc.SelectOutboundRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.hiddifyrpc.SelectOutboundRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.hiddifyrpc.SelectOutboundRequest.displayName = 'proto.hiddifyrpc.SelectOutboundRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.hiddifyrpc.UrlTestRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.hiddifyrpc.UrlTestRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.hiddifyrpc.UrlTestRequest.displayName = 'proto.hiddifyrpc.UrlTestRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.hiddifyrpc.GenerateWarpConfigRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.hiddifyrpc.GenerateWarpConfigRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.hiddifyrpc.GenerateWarpConfigRequest.displayName = 'proto.hiddifyrpc.GenerateWarpConfigRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.hiddifyrpc.SetSystemProxyEnabledRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.hiddifyrpc.SetSystemProxyEnabledRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.hiddifyrpc.SetSystemProxyEnabledRequest.displayName = 'proto.hiddifyrpc.SetSystemProxyEnabledRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.hiddifyrpc.LogMessage = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.hiddifyrpc.LogMessage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.hiddifyrpc.LogMessage.displayName = 'proto.hiddifyrpc.LogMessage'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.hiddifyrpc.StopRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.hiddifyrpc.StopRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.hiddifyrpc.StopRequest.displayName = 'proto.hiddifyrpc.StopRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.hiddifyrpc.TunnelStartRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.hiddifyrpc.TunnelStartRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.hiddifyrpc.TunnelStartRequest.displayName = 'proto.hiddifyrpc.TunnelStartRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.hiddifyrpc.TunnelResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.hiddifyrpc.TunnelResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.hiddifyrpc.TunnelResponse.displayName = 'proto.hiddifyrpc.TunnelResponse'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.hiddifyrpc.CoreInfoResponse.prototype.toObject = function(opt_includeInstance) { + return proto.hiddifyrpc.CoreInfoResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.hiddifyrpc.CoreInfoResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.hiddifyrpc.CoreInfoResponse.toObject = function(includeInstance, msg) { + var f, obj = { +coreState: jspb.Message.getFieldWithDefault(msg, 1, 0), +messageType: jspb.Message.getFieldWithDefault(msg, 2, 0), +message: jspb.Message.getFieldWithDefault(msg, 3, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.hiddifyrpc.CoreInfoResponse} + */ +proto.hiddifyrpc.CoreInfoResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.hiddifyrpc.CoreInfoResponse; + return proto.hiddifyrpc.CoreInfoResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.hiddifyrpc.CoreInfoResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.hiddifyrpc.CoreInfoResponse} + */ +proto.hiddifyrpc.CoreInfoResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!proto.hiddifyrpc.CoreState} */ (reader.readEnum()); + msg.setCoreState(value); + break; + case 2: + var value = /** @type {!proto.hiddifyrpc.MessageType} */ (reader.readEnum()); + msg.setMessageType(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setMessage(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.hiddifyrpc.CoreInfoResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.hiddifyrpc.CoreInfoResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.hiddifyrpc.CoreInfoResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.hiddifyrpc.CoreInfoResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getCoreState(); + if (f !== 0.0) { + writer.writeEnum( + 1, + f + ); + } + f = message.getMessageType(); + if (f !== 0.0) { + writer.writeEnum( + 2, + f + ); + } + f = message.getMessage(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } +}; + + +/** + * optional CoreState core_state = 1; + * @return {!proto.hiddifyrpc.CoreState} + */ +proto.hiddifyrpc.CoreInfoResponse.prototype.getCoreState = function() { + return /** @type {!proto.hiddifyrpc.CoreState} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {!proto.hiddifyrpc.CoreState} value + * @return {!proto.hiddifyrpc.CoreInfoResponse} returns this + */ +proto.hiddifyrpc.CoreInfoResponse.prototype.setCoreState = function(value) { + return jspb.Message.setProto3EnumField(this, 1, value); +}; + + +/** + * optional MessageType message_type = 2; + * @return {!proto.hiddifyrpc.MessageType} + */ +proto.hiddifyrpc.CoreInfoResponse.prototype.getMessageType = function() { + return /** @type {!proto.hiddifyrpc.MessageType} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {!proto.hiddifyrpc.MessageType} value + * @return {!proto.hiddifyrpc.CoreInfoResponse} returns this + */ +proto.hiddifyrpc.CoreInfoResponse.prototype.setMessageType = function(value) { + return jspb.Message.setProto3EnumField(this, 2, value); +}; + + +/** + * optional string message = 3; + * @return {string} + */ +proto.hiddifyrpc.CoreInfoResponse.prototype.getMessage = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.hiddifyrpc.CoreInfoResponse} returns this + */ +proto.hiddifyrpc.CoreInfoResponse.prototype.setMessage = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.hiddifyrpc.StartRequest.prototype.toObject = function(opt_includeInstance) { + return proto.hiddifyrpc.StartRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.hiddifyrpc.StartRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.hiddifyrpc.StartRequest.toObject = function(includeInstance, msg) { + var f, obj = { +configPath: jspb.Message.getFieldWithDefault(msg, 1, ""), +configContent: jspb.Message.getFieldWithDefault(msg, 2, ""), +disableMemoryLimit: jspb.Message.getBooleanFieldWithDefault(msg, 3, false), +delayStart: jspb.Message.getBooleanFieldWithDefault(msg, 4, false), +enableOldCommandServer: jspb.Message.getBooleanFieldWithDefault(msg, 5, false), +enableRawConfig: jspb.Message.getBooleanFieldWithDefault(msg, 6, false) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.hiddifyrpc.StartRequest} + */ +proto.hiddifyrpc.StartRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.hiddifyrpc.StartRequest; + return proto.hiddifyrpc.StartRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.hiddifyrpc.StartRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.hiddifyrpc.StartRequest} + */ +proto.hiddifyrpc.StartRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setConfigPath(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setConfigContent(value); + break; + case 3: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setDisableMemoryLimit(value); + break; + case 4: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setDelayStart(value); + break; + case 5: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setEnableOldCommandServer(value); + break; + case 6: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setEnableRawConfig(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.hiddifyrpc.StartRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.hiddifyrpc.StartRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.hiddifyrpc.StartRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.hiddifyrpc.StartRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getConfigPath(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getConfigContent(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getDisableMemoryLimit(); + if (f) { + writer.writeBool( + 3, + f + ); + } + f = message.getDelayStart(); + if (f) { + writer.writeBool( + 4, + f + ); + } + f = message.getEnableOldCommandServer(); + if (f) { + writer.writeBool( + 5, + f + ); + } + f = message.getEnableRawConfig(); + if (f) { + writer.writeBool( + 6, + f + ); + } +}; + + +/** + * optional string config_path = 1; + * @return {string} + */ +proto.hiddifyrpc.StartRequest.prototype.getConfigPath = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.hiddifyrpc.StartRequest} returns this + */ +proto.hiddifyrpc.StartRequest.prototype.setConfigPath = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string config_content = 2; + * @return {string} + */ +proto.hiddifyrpc.StartRequest.prototype.getConfigContent = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.hiddifyrpc.StartRequest} returns this + */ +proto.hiddifyrpc.StartRequest.prototype.setConfigContent = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional bool disable_memory_limit = 3; + * @return {boolean} + */ +proto.hiddifyrpc.StartRequest.prototype.getDisableMemoryLimit = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.hiddifyrpc.StartRequest} returns this + */ +proto.hiddifyrpc.StartRequest.prototype.setDisableMemoryLimit = function(value) { + return jspb.Message.setProto3BooleanField(this, 3, value); +}; + + +/** + * optional bool delay_start = 4; + * @return {boolean} + */ +proto.hiddifyrpc.StartRequest.prototype.getDelayStart = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 4, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.hiddifyrpc.StartRequest} returns this + */ +proto.hiddifyrpc.StartRequest.prototype.setDelayStart = function(value) { + return jspb.Message.setProto3BooleanField(this, 4, value); +}; + + +/** + * optional bool enable_old_command_server = 5; + * @return {boolean} + */ +proto.hiddifyrpc.StartRequest.prototype.getEnableOldCommandServer = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 5, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.hiddifyrpc.StartRequest} returns this + */ +proto.hiddifyrpc.StartRequest.prototype.setEnableOldCommandServer = function(value) { + return jspb.Message.setProto3BooleanField(this, 5, value); +}; + + +/** + * optional bool enable_raw_config = 6; + * @return {boolean} + */ +proto.hiddifyrpc.StartRequest.prototype.getEnableRawConfig = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 6, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.hiddifyrpc.StartRequest} returns this + */ +proto.hiddifyrpc.StartRequest.prototype.setEnableRawConfig = function(value) { + return jspb.Message.setProto3BooleanField(this, 6, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.hiddifyrpc.SetupRequest.prototype.toObject = function(opt_includeInstance) { + return proto.hiddifyrpc.SetupRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.hiddifyrpc.SetupRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.hiddifyrpc.SetupRequest.toObject = function(includeInstance, msg) { + var f, obj = { +basePath: jspb.Message.getFieldWithDefault(msg, 1, ""), +workingPath: jspb.Message.getFieldWithDefault(msg, 2, ""), +tempPath: jspb.Message.getFieldWithDefault(msg, 3, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.hiddifyrpc.SetupRequest} + */ +proto.hiddifyrpc.SetupRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.hiddifyrpc.SetupRequest; + return proto.hiddifyrpc.SetupRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.hiddifyrpc.SetupRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.hiddifyrpc.SetupRequest} + */ +proto.hiddifyrpc.SetupRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setBasePath(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setWorkingPath(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setTempPath(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.hiddifyrpc.SetupRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.hiddifyrpc.SetupRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.hiddifyrpc.SetupRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.hiddifyrpc.SetupRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getBasePath(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getWorkingPath(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getTempPath(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } +}; + + +/** + * optional string base_path = 1; + * @return {string} + */ +proto.hiddifyrpc.SetupRequest.prototype.getBasePath = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.hiddifyrpc.SetupRequest} returns this + */ +proto.hiddifyrpc.SetupRequest.prototype.setBasePath = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string working_path = 2; + * @return {string} + */ +proto.hiddifyrpc.SetupRequest.prototype.getWorkingPath = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.hiddifyrpc.SetupRequest} returns this + */ +proto.hiddifyrpc.SetupRequest.prototype.setWorkingPath = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional string temp_path = 3; + * @return {string} + */ +proto.hiddifyrpc.SetupRequest.prototype.getTempPath = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.hiddifyrpc.SetupRequest} returns this + */ +proto.hiddifyrpc.SetupRequest.prototype.setTempPath = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.hiddifyrpc.Response.prototype.toObject = function(opt_includeInstance) { + return proto.hiddifyrpc.Response.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.hiddifyrpc.Response} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.hiddifyrpc.Response.toObject = function(includeInstance, msg) { + var f, obj = { +responseCode: jspb.Message.getFieldWithDefault(msg, 1, 0), +message: jspb.Message.getFieldWithDefault(msg, 2, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.hiddifyrpc.Response} + */ +proto.hiddifyrpc.Response.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.hiddifyrpc.Response; + return proto.hiddifyrpc.Response.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.hiddifyrpc.Response} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.hiddifyrpc.Response} + */ +proto.hiddifyrpc.Response.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!proto.hiddifyrpc.ResponseCode} */ (reader.readEnum()); + msg.setResponseCode(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setMessage(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.hiddifyrpc.Response.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.hiddifyrpc.Response.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.hiddifyrpc.Response} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.hiddifyrpc.Response.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getResponseCode(); + if (f !== 0.0) { + writer.writeEnum( + 1, + f + ); + } + f = message.getMessage(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } +}; + + +/** + * optional ResponseCode response_code = 1; + * @return {!proto.hiddifyrpc.ResponseCode} + */ +proto.hiddifyrpc.Response.prototype.getResponseCode = function() { + return /** @type {!proto.hiddifyrpc.ResponseCode} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {!proto.hiddifyrpc.ResponseCode} value + * @return {!proto.hiddifyrpc.Response} returns this + */ +proto.hiddifyrpc.Response.prototype.setResponseCode = function(value) { + return jspb.Message.setProto3EnumField(this, 1, value); +}; + + +/** + * optional string message = 2; + * @return {string} + */ +proto.hiddifyrpc.Response.prototype.getMessage = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.hiddifyrpc.Response} returns this + */ +proto.hiddifyrpc.Response.prototype.setMessage = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.hiddifyrpc.SystemInfo.prototype.toObject = function(opt_includeInstance) { + return proto.hiddifyrpc.SystemInfo.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.hiddifyrpc.SystemInfo} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.hiddifyrpc.SystemInfo.toObject = function(includeInstance, msg) { + var f, obj = { +memory: jspb.Message.getFieldWithDefault(msg, 1, 0), +goroutines: jspb.Message.getFieldWithDefault(msg, 2, 0), +connectionsIn: jspb.Message.getFieldWithDefault(msg, 3, 0), +connectionsOut: jspb.Message.getFieldWithDefault(msg, 4, 0), +trafficAvailable: jspb.Message.getBooleanFieldWithDefault(msg, 5, false), +uplink: jspb.Message.getFieldWithDefault(msg, 6, 0), +downlink: jspb.Message.getFieldWithDefault(msg, 7, 0), +uplinkTotal: jspb.Message.getFieldWithDefault(msg, 8, 0), +downlinkTotal: jspb.Message.getFieldWithDefault(msg, 9, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.hiddifyrpc.SystemInfo} + */ +proto.hiddifyrpc.SystemInfo.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.hiddifyrpc.SystemInfo; + return proto.hiddifyrpc.SystemInfo.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.hiddifyrpc.SystemInfo} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.hiddifyrpc.SystemInfo} + */ +proto.hiddifyrpc.SystemInfo.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt64()); + msg.setMemory(value); + break; + case 2: + var value = /** @type {number} */ (reader.readInt32()); + msg.setGoroutines(value); + break; + case 3: + var value = /** @type {number} */ (reader.readInt32()); + msg.setConnectionsIn(value); + break; + case 4: + var value = /** @type {number} */ (reader.readInt32()); + msg.setConnectionsOut(value); + break; + case 5: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setTrafficAvailable(value); + break; + case 6: + var value = /** @type {number} */ (reader.readInt64()); + msg.setUplink(value); + break; + case 7: + var value = /** @type {number} */ (reader.readInt64()); + msg.setDownlink(value); + break; + case 8: + var value = /** @type {number} */ (reader.readInt64()); + msg.setUplinkTotal(value); + break; + case 9: + var value = /** @type {number} */ (reader.readInt64()); + msg.setDownlinkTotal(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.hiddifyrpc.SystemInfo.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.hiddifyrpc.SystemInfo.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.hiddifyrpc.SystemInfo} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.hiddifyrpc.SystemInfo.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getMemory(); + if (f !== 0) { + writer.writeInt64( + 1, + f + ); + } + f = message.getGoroutines(); + if (f !== 0) { + writer.writeInt32( + 2, + f + ); + } + f = message.getConnectionsIn(); + if (f !== 0) { + writer.writeInt32( + 3, + f + ); + } + f = message.getConnectionsOut(); + if (f !== 0) { + writer.writeInt32( + 4, + f + ); + } + f = message.getTrafficAvailable(); + if (f) { + writer.writeBool( + 5, + f + ); + } + f = message.getUplink(); + if (f !== 0) { + writer.writeInt64( + 6, + f + ); + } + f = message.getDownlink(); + if (f !== 0) { + writer.writeInt64( + 7, + f + ); + } + f = message.getUplinkTotal(); + if (f !== 0) { + writer.writeInt64( + 8, + f + ); + } + f = message.getDownlinkTotal(); + if (f !== 0) { + writer.writeInt64( + 9, + f + ); + } +}; + + +/** + * optional int64 memory = 1; + * @return {number} + */ +proto.hiddifyrpc.SystemInfo.prototype.getMemory = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.hiddifyrpc.SystemInfo} returns this + */ +proto.hiddifyrpc.SystemInfo.prototype.setMemory = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional int32 goroutines = 2; + * @return {number} + */ +proto.hiddifyrpc.SystemInfo.prototype.getGoroutines = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.hiddifyrpc.SystemInfo} returns this + */ +proto.hiddifyrpc.SystemInfo.prototype.setGoroutines = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional int32 connections_in = 3; + * @return {number} + */ +proto.hiddifyrpc.SystemInfo.prototype.getConnectionsIn = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.hiddifyrpc.SystemInfo} returns this + */ +proto.hiddifyrpc.SystemInfo.prototype.setConnectionsIn = function(value) { + return jspb.Message.setProto3IntField(this, 3, value); +}; + + +/** + * optional int32 connections_out = 4; + * @return {number} + */ +proto.hiddifyrpc.SystemInfo.prototype.getConnectionsOut = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.hiddifyrpc.SystemInfo} returns this + */ +proto.hiddifyrpc.SystemInfo.prototype.setConnectionsOut = function(value) { + return jspb.Message.setProto3IntField(this, 4, value); +}; + + +/** + * optional bool traffic_available = 5; + * @return {boolean} + */ +proto.hiddifyrpc.SystemInfo.prototype.getTrafficAvailable = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 5, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.hiddifyrpc.SystemInfo} returns this + */ +proto.hiddifyrpc.SystemInfo.prototype.setTrafficAvailable = function(value) { + return jspb.Message.setProto3BooleanField(this, 5, value); +}; + + +/** + * optional int64 uplink = 6; + * @return {number} + */ +proto.hiddifyrpc.SystemInfo.prototype.getUplink = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 6, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.hiddifyrpc.SystemInfo} returns this + */ +proto.hiddifyrpc.SystemInfo.prototype.setUplink = function(value) { + return jspb.Message.setProto3IntField(this, 6, value); +}; + + +/** + * optional int64 downlink = 7; + * @return {number} + */ +proto.hiddifyrpc.SystemInfo.prototype.getDownlink = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 7, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.hiddifyrpc.SystemInfo} returns this + */ +proto.hiddifyrpc.SystemInfo.prototype.setDownlink = function(value) { + return jspb.Message.setProto3IntField(this, 7, value); +}; + + +/** + * optional int64 uplink_total = 8; + * @return {number} + */ +proto.hiddifyrpc.SystemInfo.prototype.getUplinkTotal = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 8, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.hiddifyrpc.SystemInfo} returns this + */ +proto.hiddifyrpc.SystemInfo.prototype.setUplinkTotal = function(value) { + return jspb.Message.setProto3IntField(this, 8, value); +}; + + +/** + * optional int64 downlink_total = 9; + * @return {number} + */ +proto.hiddifyrpc.SystemInfo.prototype.getDownlinkTotal = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 9, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.hiddifyrpc.SystemInfo} returns this + */ +proto.hiddifyrpc.SystemInfo.prototype.setDownlinkTotal = function(value) { + return jspb.Message.setProto3IntField(this, 9, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.hiddifyrpc.OutboundGroupItem.prototype.toObject = function(opt_includeInstance) { + return proto.hiddifyrpc.OutboundGroupItem.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.hiddifyrpc.OutboundGroupItem} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.hiddifyrpc.OutboundGroupItem.toObject = function(includeInstance, msg) { + var f, obj = { +tag: jspb.Message.getFieldWithDefault(msg, 1, ""), +type: jspb.Message.getFieldWithDefault(msg, 2, ""), +urlTestTime: jspb.Message.getFieldWithDefault(msg, 3, 0), +urlTestDelay: jspb.Message.getFieldWithDefault(msg, 4, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.hiddifyrpc.OutboundGroupItem} + */ +proto.hiddifyrpc.OutboundGroupItem.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.hiddifyrpc.OutboundGroupItem; + return proto.hiddifyrpc.OutboundGroupItem.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.hiddifyrpc.OutboundGroupItem} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.hiddifyrpc.OutboundGroupItem} + */ +proto.hiddifyrpc.OutboundGroupItem.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setTag(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setType(value); + break; + case 3: + var value = /** @type {number} */ (reader.readInt64()); + msg.setUrlTestTime(value); + break; + case 4: + var value = /** @type {number} */ (reader.readInt32()); + msg.setUrlTestDelay(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.hiddifyrpc.OutboundGroupItem.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.hiddifyrpc.OutboundGroupItem.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.hiddifyrpc.OutboundGroupItem} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.hiddifyrpc.OutboundGroupItem.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getTag(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getType(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getUrlTestTime(); + if (f !== 0) { + writer.writeInt64( + 3, + f + ); + } + f = message.getUrlTestDelay(); + if (f !== 0) { + writer.writeInt32( + 4, + f + ); + } +}; + + +/** + * optional string tag = 1; + * @return {string} + */ +proto.hiddifyrpc.OutboundGroupItem.prototype.getTag = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.hiddifyrpc.OutboundGroupItem} returns this + */ +proto.hiddifyrpc.OutboundGroupItem.prototype.setTag = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string type = 2; + * @return {string} + */ +proto.hiddifyrpc.OutboundGroupItem.prototype.getType = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.hiddifyrpc.OutboundGroupItem} returns this + */ +proto.hiddifyrpc.OutboundGroupItem.prototype.setType = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional int64 url_test_time = 3; + * @return {number} + */ +proto.hiddifyrpc.OutboundGroupItem.prototype.getUrlTestTime = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.hiddifyrpc.OutboundGroupItem} returns this + */ +proto.hiddifyrpc.OutboundGroupItem.prototype.setUrlTestTime = function(value) { + return jspb.Message.setProto3IntField(this, 3, value); +}; + + +/** + * optional int32 url_test_delay = 4; + * @return {number} + */ +proto.hiddifyrpc.OutboundGroupItem.prototype.getUrlTestDelay = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.hiddifyrpc.OutboundGroupItem} returns this + */ +proto.hiddifyrpc.OutboundGroupItem.prototype.setUrlTestDelay = function(value) { + return jspb.Message.setProto3IntField(this, 4, value); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.hiddifyrpc.OutboundGroup.repeatedFields_ = [4]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.hiddifyrpc.OutboundGroup.prototype.toObject = function(opt_includeInstance) { + return proto.hiddifyrpc.OutboundGroup.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.hiddifyrpc.OutboundGroup} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.hiddifyrpc.OutboundGroup.toObject = function(includeInstance, msg) { + var f, obj = { +tag: jspb.Message.getFieldWithDefault(msg, 1, ""), +type: jspb.Message.getFieldWithDefault(msg, 2, ""), +selected: jspb.Message.getFieldWithDefault(msg, 3, ""), +itemsList: jspb.Message.toObjectList(msg.getItemsList(), + proto.hiddifyrpc.OutboundGroupItem.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.hiddifyrpc.OutboundGroup} + */ +proto.hiddifyrpc.OutboundGroup.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.hiddifyrpc.OutboundGroup; + return proto.hiddifyrpc.OutboundGroup.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.hiddifyrpc.OutboundGroup} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.hiddifyrpc.OutboundGroup} + */ +proto.hiddifyrpc.OutboundGroup.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setTag(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setType(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setSelected(value); + break; + case 4: + var value = new proto.hiddifyrpc.OutboundGroupItem; + reader.readMessage(value,proto.hiddifyrpc.OutboundGroupItem.deserializeBinaryFromReader); + msg.addItems(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.hiddifyrpc.OutboundGroup.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.hiddifyrpc.OutboundGroup.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.hiddifyrpc.OutboundGroup} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.hiddifyrpc.OutboundGroup.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getTag(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getType(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getSelected(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } + f = message.getItemsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 4, + f, + proto.hiddifyrpc.OutboundGroupItem.serializeBinaryToWriter + ); + } +}; + + +/** + * optional string tag = 1; + * @return {string} + */ +proto.hiddifyrpc.OutboundGroup.prototype.getTag = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.hiddifyrpc.OutboundGroup} returns this + */ +proto.hiddifyrpc.OutboundGroup.prototype.setTag = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string type = 2; + * @return {string} + */ +proto.hiddifyrpc.OutboundGroup.prototype.getType = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.hiddifyrpc.OutboundGroup} returns this + */ +proto.hiddifyrpc.OutboundGroup.prototype.setType = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional string selected = 3; + * @return {string} + */ +proto.hiddifyrpc.OutboundGroup.prototype.getSelected = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.hiddifyrpc.OutboundGroup} returns this + */ +proto.hiddifyrpc.OutboundGroup.prototype.setSelected = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); +}; + + +/** + * repeated OutboundGroupItem items = 4; + * @return {!Array} + */ +proto.hiddifyrpc.OutboundGroup.prototype.getItemsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.hiddifyrpc.OutboundGroupItem, 4)); +}; + + +/** + * @param {!Array} value + * @return {!proto.hiddifyrpc.OutboundGroup} returns this +*/ +proto.hiddifyrpc.OutboundGroup.prototype.setItemsList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 4, value); +}; + + +/** + * @param {!proto.hiddifyrpc.OutboundGroupItem=} opt_value + * @param {number=} opt_index + * @return {!proto.hiddifyrpc.OutboundGroupItem} + */ +proto.hiddifyrpc.OutboundGroup.prototype.addItems = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 4, opt_value, proto.hiddifyrpc.OutboundGroupItem, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.hiddifyrpc.OutboundGroup} returns this + */ +proto.hiddifyrpc.OutboundGroup.prototype.clearItemsList = function() { + return this.setItemsList([]); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.hiddifyrpc.OutboundGroupList.repeatedFields_ = [1]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.hiddifyrpc.OutboundGroupList.prototype.toObject = function(opt_includeInstance) { + return proto.hiddifyrpc.OutboundGroupList.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.hiddifyrpc.OutboundGroupList} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.hiddifyrpc.OutboundGroupList.toObject = function(includeInstance, msg) { + var f, obj = { +itemsList: jspb.Message.toObjectList(msg.getItemsList(), + proto.hiddifyrpc.OutboundGroup.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.hiddifyrpc.OutboundGroupList} + */ +proto.hiddifyrpc.OutboundGroupList.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.hiddifyrpc.OutboundGroupList; + return proto.hiddifyrpc.OutboundGroupList.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.hiddifyrpc.OutboundGroupList} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.hiddifyrpc.OutboundGroupList} + */ +proto.hiddifyrpc.OutboundGroupList.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.hiddifyrpc.OutboundGroup; + reader.readMessage(value,proto.hiddifyrpc.OutboundGroup.deserializeBinaryFromReader); + msg.addItems(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.hiddifyrpc.OutboundGroupList.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.hiddifyrpc.OutboundGroupList.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.hiddifyrpc.OutboundGroupList} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.hiddifyrpc.OutboundGroupList.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getItemsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 1, + f, + proto.hiddifyrpc.OutboundGroup.serializeBinaryToWriter + ); + } +}; + + +/** + * repeated OutboundGroup items = 1; + * @return {!Array} + */ +proto.hiddifyrpc.OutboundGroupList.prototype.getItemsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.hiddifyrpc.OutboundGroup, 1)); +}; + + +/** + * @param {!Array} value + * @return {!proto.hiddifyrpc.OutboundGroupList} returns this +*/ +proto.hiddifyrpc.OutboundGroupList.prototype.setItemsList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); +}; + + +/** + * @param {!proto.hiddifyrpc.OutboundGroup=} opt_value + * @param {number=} opt_index + * @return {!proto.hiddifyrpc.OutboundGroup} + */ +proto.hiddifyrpc.OutboundGroupList.prototype.addItems = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.hiddifyrpc.OutboundGroup, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.hiddifyrpc.OutboundGroupList} returns this + */ +proto.hiddifyrpc.OutboundGroupList.prototype.clearItemsList = function() { + return this.setItemsList([]); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.hiddifyrpc.WarpAccount.prototype.toObject = function(opt_includeInstance) { + return proto.hiddifyrpc.WarpAccount.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.hiddifyrpc.WarpAccount} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.hiddifyrpc.WarpAccount.toObject = function(includeInstance, msg) { + var f, obj = { +accountId: jspb.Message.getFieldWithDefault(msg, 1, ""), +accessToken: jspb.Message.getFieldWithDefault(msg, 2, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.hiddifyrpc.WarpAccount} + */ +proto.hiddifyrpc.WarpAccount.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.hiddifyrpc.WarpAccount; + return proto.hiddifyrpc.WarpAccount.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.hiddifyrpc.WarpAccount} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.hiddifyrpc.WarpAccount} + */ +proto.hiddifyrpc.WarpAccount.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setAccountId(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setAccessToken(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.hiddifyrpc.WarpAccount.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.hiddifyrpc.WarpAccount.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.hiddifyrpc.WarpAccount} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.hiddifyrpc.WarpAccount.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getAccountId(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getAccessToken(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } +}; + + +/** + * optional string account_id = 1; + * @return {string} + */ +proto.hiddifyrpc.WarpAccount.prototype.getAccountId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.hiddifyrpc.WarpAccount} returns this + */ +proto.hiddifyrpc.WarpAccount.prototype.setAccountId = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string access_token = 2; + * @return {string} + */ +proto.hiddifyrpc.WarpAccount.prototype.getAccessToken = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.hiddifyrpc.WarpAccount} returns this + */ +proto.hiddifyrpc.WarpAccount.prototype.setAccessToken = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.hiddifyrpc.WarpWireguardConfig.prototype.toObject = function(opt_includeInstance) { + return proto.hiddifyrpc.WarpWireguardConfig.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.hiddifyrpc.WarpWireguardConfig} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.hiddifyrpc.WarpWireguardConfig.toObject = function(includeInstance, msg) { + var f, obj = { +privateKey: jspb.Message.getFieldWithDefault(msg, 1, ""), +localAddressIpv4: jspb.Message.getFieldWithDefault(msg, 2, ""), +localAddressIpv6: jspb.Message.getFieldWithDefault(msg, 3, ""), +peerPublicKey: jspb.Message.getFieldWithDefault(msg, 4, ""), +clientId: jspb.Message.getFieldWithDefault(msg, 5, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.hiddifyrpc.WarpWireguardConfig} + */ +proto.hiddifyrpc.WarpWireguardConfig.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.hiddifyrpc.WarpWireguardConfig; + return proto.hiddifyrpc.WarpWireguardConfig.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.hiddifyrpc.WarpWireguardConfig} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.hiddifyrpc.WarpWireguardConfig} + */ +proto.hiddifyrpc.WarpWireguardConfig.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setPrivateKey(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setLocalAddressIpv4(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setLocalAddressIpv6(value); + break; + case 4: + var value = /** @type {string} */ (reader.readString()); + msg.setPeerPublicKey(value); + break; + case 5: + var value = /** @type {string} */ (reader.readString()); + msg.setClientId(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.hiddifyrpc.WarpWireguardConfig.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.hiddifyrpc.WarpWireguardConfig.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.hiddifyrpc.WarpWireguardConfig} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.hiddifyrpc.WarpWireguardConfig.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getPrivateKey(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getLocalAddressIpv4(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getLocalAddressIpv6(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } + f = message.getPeerPublicKey(); + if (f.length > 0) { + writer.writeString( + 4, + f + ); + } + f = message.getClientId(); + if (f.length > 0) { + writer.writeString( + 5, + f + ); + } +}; + + +/** + * optional string private_key = 1; + * @return {string} + */ +proto.hiddifyrpc.WarpWireguardConfig.prototype.getPrivateKey = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.hiddifyrpc.WarpWireguardConfig} returns this + */ +proto.hiddifyrpc.WarpWireguardConfig.prototype.setPrivateKey = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string local_address_ipv4 = 2; + * @return {string} + */ +proto.hiddifyrpc.WarpWireguardConfig.prototype.getLocalAddressIpv4 = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.hiddifyrpc.WarpWireguardConfig} returns this + */ +proto.hiddifyrpc.WarpWireguardConfig.prototype.setLocalAddressIpv4 = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional string local_address_ipv6 = 3; + * @return {string} + */ +proto.hiddifyrpc.WarpWireguardConfig.prototype.getLocalAddressIpv6 = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.hiddifyrpc.WarpWireguardConfig} returns this + */ +proto.hiddifyrpc.WarpWireguardConfig.prototype.setLocalAddressIpv6 = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); +}; + + +/** + * optional string peer_public_key = 4; + * @return {string} + */ +proto.hiddifyrpc.WarpWireguardConfig.prototype.getPeerPublicKey = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +}; + + +/** + * @param {string} value + * @return {!proto.hiddifyrpc.WarpWireguardConfig} returns this + */ +proto.hiddifyrpc.WarpWireguardConfig.prototype.setPeerPublicKey = function(value) { + return jspb.Message.setProto3StringField(this, 4, value); +}; + + +/** + * optional string client_id = 5; + * @return {string} + */ +proto.hiddifyrpc.WarpWireguardConfig.prototype.getClientId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "")); +}; + + +/** + * @param {string} value + * @return {!proto.hiddifyrpc.WarpWireguardConfig} returns this + */ +proto.hiddifyrpc.WarpWireguardConfig.prototype.setClientId = function(value) { + return jspb.Message.setProto3StringField(this, 5, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.hiddifyrpc.WarpGenerationResponse.prototype.toObject = function(opt_includeInstance) { + return proto.hiddifyrpc.WarpGenerationResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.hiddifyrpc.WarpGenerationResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.hiddifyrpc.WarpGenerationResponse.toObject = function(includeInstance, msg) { + var f, obj = { +account: (f = msg.getAccount()) && proto.hiddifyrpc.WarpAccount.toObject(includeInstance, f), +log: jspb.Message.getFieldWithDefault(msg, 2, ""), +config: (f = msg.getConfig()) && proto.hiddifyrpc.WarpWireguardConfig.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.hiddifyrpc.WarpGenerationResponse} + */ +proto.hiddifyrpc.WarpGenerationResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.hiddifyrpc.WarpGenerationResponse; + return proto.hiddifyrpc.WarpGenerationResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.hiddifyrpc.WarpGenerationResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.hiddifyrpc.WarpGenerationResponse} + */ +proto.hiddifyrpc.WarpGenerationResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.hiddifyrpc.WarpAccount; + reader.readMessage(value,proto.hiddifyrpc.WarpAccount.deserializeBinaryFromReader); + msg.setAccount(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setLog(value); + break; + case 3: + var value = new proto.hiddifyrpc.WarpWireguardConfig; + reader.readMessage(value,proto.hiddifyrpc.WarpWireguardConfig.deserializeBinaryFromReader); + msg.setConfig(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.hiddifyrpc.WarpGenerationResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.hiddifyrpc.WarpGenerationResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.hiddifyrpc.WarpGenerationResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.hiddifyrpc.WarpGenerationResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getAccount(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.hiddifyrpc.WarpAccount.serializeBinaryToWriter + ); + } + f = message.getLog(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getConfig(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.hiddifyrpc.WarpWireguardConfig.serializeBinaryToWriter + ); + } +}; + + +/** + * optional WarpAccount account = 1; + * @return {?proto.hiddifyrpc.WarpAccount} + */ +proto.hiddifyrpc.WarpGenerationResponse.prototype.getAccount = function() { + return /** @type{?proto.hiddifyrpc.WarpAccount} */ ( + jspb.Message.getWrapperField(this, proto.hiddifyrpc.WarpAccount, 1)); +}; + + +/** + * @param {?proto.hiddifyrpc.WarpAccount|undefined} value + * @return {!proto.hiddifyrpc.WarpGenerationResponse} returns this +*/ +proto.hiddifyrpc.WarpGenerationResponse.prototype.setAccount = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.hiddifyrpc.WarpGenerationResponse} returns this + */ +proto.hiddifyrpc.WarpGenerationResponse.prototype.clearAccount = function() { + return this.setAccount(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.hiddifyrpc.WarpGenerationResponse.prototype.hasAccount = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional string log = 2; + * @return {string} + */ +proto.hiddifyrpc.WarpGenerationResponse.prototype.getLog = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.hiddifyrpc.WarpGenerationResponse} returns this + */ +proto.hiddifyrpc.WarpGenerationResponse.prototype.setLog = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional WarpWireguardConfig config = 3; + * @return {?proto.hiddifyrpc.WarpWireguardConfig} + */ +proto.hiddifyrpc.WarpGenerationResponse.prototype.getConfig = function() { + return /** @type{?proto.hiddifyrpc.WarpWireguardConfig} */ ( + jspb.Message.getWrapperField(this, proto.hiddifyrpc.WarpWireguardConfig, 3)); +}; + + +/** + * @param {?proto.hiddifyrpc.WarpWireguardConfig|undefined} value + * @return {!proto.hiddifyrpc.WarpGenerationResponse} returns this +*/ +proto.hiddifyrpc.WarpGenerationResponse.prototype.setConfig = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.hiddifyrpc.WarpGenerationResponse} returns this + */ +proto.hiddifyrpc.WarpGenerationResponse.prototype.clearConfig = function() { + return this.setConfig(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.hiddifyrpc.WarpGenerationResponse.prototype.hasConfig = function() { + return jspb.Message.getField(this, 3) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.hiddifyrpc.SystemProxyStatus.prototype.toObject = function(opt_includeInstance) { + return proto.hiddifyrpc.SystemProxyStatus.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.hiddifyrpc.SystemProxyStatus} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.hiddifyrpc.SystemProxyStatus.toObject = function(includeInstance, msg) { + var f, obj = { +available: jspb.Message.getBooleanFieldWithDefault(msg, 1, false), +enabled: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.hiddifyrpc.SystemProxyStatus} + */ +proto.hiddifyrpc.SystemProxyStatus.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.hiddifyrpc.SystemProxyStatus; + return proto.hiddifyrpc.SystemProxyStatus.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.hiddifyrpc.SystemProxyStatus} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.hiddifyrpc.SystemProxyStatus} + */ +proto.hiddifyrpc.SystemProxyStatus.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setAvailable(value); + break; + case 2: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setEnabled(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.hiddifyrpc.SystemProxyStatus.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.hiddifyrpc.SystemProxyStatus.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.hiddifyrpc.SystemProxyStatus} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.hiddifyrpc.SystemProxyStatus.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getAvailable(); + if (f) { + writer.writeBool( + 1, + f + ); + } + f = message.getEnabled(); + if (f) { + writer.writeBool( + 2, + f + ); + } +}; + + +/** + * optional bool available = 1; + * @return {boolean} + */ +proto.hiddifyrpc.SystemProxyStatus.prototype.getAvailable = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 1, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.hiddifyrpc.SystemProxyStatus} returns this + */ +proto.hiddifyrpc.SystemProxyStatus.prototype.setAvailable = function(value) { + return jspb.Message.setProto3BooleanField(this, 1, value); +}; + + +/** + * optional bool enabled = 2; + * @return {boolean} + */ +proto.hiddifyrpc.SystemProxyStatus.prototype.getEnabled = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.hiddifyrpc.SystemProxyStatus} returns this + */ +proto.hiddifyrpc.SystemProxyStatus.prototype.setEnabled = function(value) { + return jspb.Message.setProto3BooleanField(this, 2, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.hiddifyrpc.ParseRequest.prototype.toObject = function(opt_includeInstance) { + return proto.hiddifyrpc.ParseRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.hiddifyrpc.ParseRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.hiddifyrpc.ParseRequest.toObject = function(includeInstance, msg) { + var f, obj = { +content: jspb.Message.getFieldWithDefault(msg, 1, ""), +configPath: jspb.Message.getFieldWithDefault(msg, 2, ""), +tempPath: jspb.Message.getFieldWithDefault(msg, 3, ""), +debug: jspb.Message.getBooleanFieldWithDefault(msg, 4, false) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.hiddifyrpc.ParseRequest} + */ +proto.hiddifyrpc.ParseRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.hiddifyrpc.ParseRequest; + return proto.hiddifyrpc.ParseRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.hiddifyrpc.ParseRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.hiddifyrpc.ParseRequest} + */ +proto.hiddifyrpc.ParseRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setContent(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setConfigPath(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setTempPath(value); + break; + case 4: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setDebug(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.hiddifyrpc.ParseRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.hiddifyrpc.ParseRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.hiddifyrpc.ParseRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.hiddifyrpc.ParseRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getContent(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getConfigPath(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getTempPath(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } + f = message.getDebug(); + if (f) { + writer.writeBool( + 4, + f + ); + } +}; + + +/** + * optional string content = 1; + * @return {string} + */ +proto.hiddifyrpc.ParseRequest.prototype.getContent = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.hiddifyrpc.ParseRequest} returns this + */ +proto.hiddifyrpc.ParseRequest.prototype.setContent = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string config_path = 2; + * @return {string} + */ +proto.hiddifyrpc.ParseRequest.prototype.getConfigPath = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.hiddifyrpc.ParseRequest} returns this + */ +proto.hiddifyrpc.ParseRequest.prototype.setConfigPath = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional string temp_path = 3; + * @return {string} + */ +proto.hiddifyrpc.ParseRequest.prototype.getTempPath = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.hiddifyrpc.ParseRequest} returns this + */ +proto.hiddifyrpc.ParseRequest.prototype.setTempPath = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); +}; + + +/** + * optional bool debug = 4; + * @return {boolean} + */ +proto.hiddifyrpc.ParseRequest.prototype.getDebug = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 4, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.hiddifyrpc.ParseRequest} returns this + */ +proto.hiddifyrpc.ParseRequest.prototype.setDebug = function(value) { + return jspb.Message.setProto3BooleanField(this, 4, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.hiddifyrpc.ParseResponse.prototype.toObject = function(opt_includeInstance) { + return proto.hiddifyrpc.ParseResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.hiddifyrpc.ParseResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.hiddifyrpc.ParseResponse.toObject = function(includeInstance, msg) { + var f, obj = { +responseCode: jspb.Message.getFieldWithDefault(msg, 1, 0), +content: jspb.Message.getFieldWithDefault(msg, 2, ""), +message: jspb.Message.getFieldWithDefault(msg, 3, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.hiddifyrpc.ParseResponse} + */ +proto.hiddifyrpc.ParseResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.hiddifyrpc.ParseResponse; + return proto.hiddifyrpc.ParseResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.hiddifyrpc.ParseResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.hiddifyrpc.ParseResponse} + */ +proto.hiddifyrpc.ParseResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!proto.hiddifyrpc.ResponseCode} */ (reader.readEnum()); + msg.setResponseCode(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setContent(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setMessage(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.hiddifyrpc.ParseResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.hiddifyrpc.ParseResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.hiddifyrpc.ParseResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.hiddifyrpc.ParseResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getResponseCode(); + if (f !== 0.0) { + writer.writeEnum( + 1, + f + ); + } + f = message.getContent(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getMessage(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } +}; + + +/** + * optional ResponseCode response_code = 1; + * @return {!proto.hiddifyrpc.ResponseCode} + */ +proto.hiddifyrpc.ParseResponse.prototype.getResponseCode = function() { + return /** @type {!proto.hiddifyrpc.ResponseCode} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {!proto.hiddifyrpc.ResponseCode} value + * @return {!proto.hiddifyrpc.ParseResponse} returns this + */ +proto.hiddifyrpc.ParseResponse.prototype.setResponseCode = function(value) { + return jspb.Message.setProto3EnumField(this, 1, value); +}; + + +/** + * optional string content = 2; + * @return {string} + */ +proto.hiddifyrpc.ParseResponse.prototype.getContent = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.hiddifyrpc.ParseResponse} returns this + */ +proto.hiddifyrpc.ParseResponse.prototype.setContent = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional string message = 3; + * @return {string} + */ +proto.hiddifyrpc.ParseResponse.prototype.getMessage = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.hiddifyrpc.ParseResponse} returns this + */ +proto.hiddifyrpc.ParseResponse.prototype.setMessage = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.hiddifyrpc.ChangeHiddifySettingsRequest.prototype.toObject = function(opt_includeInstance) { + return proto.hiddifyrpc.ChangeHiddifySettingsRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.hiddifyrpc.ChangeHiddifySettingsRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.hiddifyrpc.ChangeHiddifySettingsRequest.toObject = function(includeInstance, msg) { + var f, obj = { +hiddifySettingsJson: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.hiddifyrpc.ChangeHiddifySettingsRequest} + */ +proto.hiddifyrpc.ChangeHiddifySettingsRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.hiddifyrpc.ChangeHiddifySettingsRequest; + return proto.hiddifyrpc.ChangeHiddifySettingsRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.hiddifyrpc.ChangeHiddifySettingsRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.hiddifyrpc.ChangeHiddifySettingsRequest} + */ +proto.hiddifyrpc.ChangeHiddifySettingsRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setHiddifySettingsJson(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.hiddifyrpc.ChangeHiddifySettingsRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.hiddifyrpc.ChangeHiddifySettingsRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.hiddifyrpc.ChangeHiddifySettingsRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.hiddifyrpc.ChangeHiddifySettingsRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getHiddifySettingsJson(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string hiddify_settings_json = 1; + * @return {string} + */ +proto.hiddifyrpc.ChangeHiddifySettingsRequest.prototype.getHiddifySettingsJson = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.hiddifyrpc.ChangeHiddifySettingsRequest} returns this + */ +proto.hiddifyrpc.ChangeHiddifySettingsRequest.prototype.setHiddifySettingsJson = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.hiddifyrpc.GenerateConfigRequest.prototype.toObject = function(opt_includeInstance) { + return proto.hiddifyrpc.GenerateConfigRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.hiddifyrpc.GenerateConfigRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.hiddifyrpc.GenerateConfigRequest.toObject = function(includeInstance, msg) { + var f, obj = { +path: jspb.Message.getFieldWithDefault(msg, 1, ""), +tempPath: jspb.Message.getFieldWithDefault(msg, 2, ""), +debug: jspb.Message.getBooleanFieldWithDefault(msg, 3, false) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.hiddifyrpc.GenerateConfigRequest} + */ +proto.hiddifyrpc.GenerateConfigRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.hiddifyrpc.GenerateConfigRequest; + return proto.hiddifyrpc.GenerateConfigRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.hiddifyrpc.GenerateConfigRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.hiddifyrpc.GenerateConfigRequest} + */ +proto.hiddifyrpc.GenerateConfigRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setPath(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setTempPath(value); + break; + case 3: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setDebug(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.hiddifyrpc.GenerateConfigRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.hiddifyrpc.GenerateConfigRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.hiddifyrpc.GenerateConfigRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.hiddifyrpc.GenerateConfigRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getPath(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getTempPath(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getDebug(); + if (f) { + writer.writeBool( + 3, + f + ); + } +}; + + +/** + * optional string path = 1; + * @return {string} + */ +proto.hiddifyrpc.GenerateConfigRequest.prototype.getPath = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.hiddifyrpc.GenerateConfigRequest} returns this + */ +proto.hiddifyrpc.GenerateConfigRequest.prototype.setPath = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string temp_path = 2; + * @return {string} + */ +proto.hiddifyrpc.GenerateConfigRequest.prototype.getTempPath = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.hiddifyrpc.GenerateConfigRequest} returns this + */ +proto.hiddifyrpc.GenerateConfigRequest.prototype.setTempPath = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional bool debug = 3; + * @return {boolean} + */ +proto.hiddifyrpc.GenerateConfigRequest.prototype.getDebug = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.hiddifyrpc.GenerateConfigRequest} returns this + */ +proto.hiddifyrpc.GenerateConfigRequest.prototype.setDebug = function(value) { + return jspb.Message.setProto3BooleanField(this, 3, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.hiddifyrpc.GenerateConfigResponse.prototype.toObject = function(opt_includeInstance) { + return proto.hiddifyrpc.GenerateConfigResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.hiddifyrpc.GenerateConfigResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.hiddifyrpc.GenerateConfigResponse.toObject = function(includeInstance, msg) { + var f, obj = { +configContent: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.hiddifyrpc.GenerateConfigResponse} + */ +proto.hiddifyrpc.GenerateConfigResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.hiddifyrpc.GenerateConfigResponse; + return proto.hiddifyrpc.GenerateConfigResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.hiddifyrpc.GenerateConfigResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.hiddifyrpc.GenerateConfigResponse} + */ +proto.hiddifyrpc.GenerateConfigResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setConfigContent(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.hiddifyrpc.GenerateConfigResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.hiddifyrpc.GenerateConfigResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.hiddifyrpc.GenerateConfigResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.hiddifyrpc.GenerateConfigResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getConfigContent(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string config_content = 1; + * @return {string} + */ +proto.hiddifyrpc.GenerateConfigResponse.prototype.getConfigContent = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.hiddifyrpc.GenerateConfigResponse} returns this + */ +proto.hiddifyrpc.GenerateConfigResponse.prototype.setConfigContent = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.hiddifyrpc.SelectOutboundRequest.prototype.toObject = function(opt_includeInstance) { + return proto.hiddifyrpc.SelectOutboundRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.hiddifyrpc.SelectOutboundRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.hiddifyrpc.SelectOutboundRequest.toObject = function(includeInstance, msg) { + var f, obj = { +groupTag: jspb.Message.getFieldWithDefault(msg, 1, ""), +outboundTag: jspb.Message.getFieldWithDefault(msg, 2, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.hiddifyrpc.SelectOutboundRequest} + */ +proto.hiddifyrpc.SelectOutboundRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.hiddifyrpc.SelectOutboundRequest; + return proto.hiddifyrpc.SelectOutboundRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.hiddifyrpc.SelectOutboundRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.hiddifyrpc.SelectOutboundRequest} + */ +proto.hiddifyrpc.SelectOutboundRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setGroupTag(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setOutboundTag(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.hiddifyrpc.SelectOutboundRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.hiddifyrpc.SelectOutboundRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.hiddifyrpc.SelectOutboundRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.hiddifyrpc.SelectOutboundRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getGroupTag(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getOutboundTag(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } +}; + + +/** + * optional string group_tag = 1; + * @return {string} + */ +proto.hiddifyrpc.SelectOutboundRequest.prototype.getGroupTag = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.hiddifyrpc.SelectOutboundRequest} returns this + */ +proto.hiddifyrpc.SelectOutboundRequest.prototype.setGroupTag = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string outbound_tag = 2; + * @return {string} + */ +proto.hiddifyrpc.SelectOutboundRequest.prototype.getOutboundTag = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.hiddifyrpc.SelectOutboundRequest} returns this + */ +proto.hiddifyrpc.SelectOutboundRequest.prototype.setOutboundTag = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.hiddifyrpc.UrlTestRequest.prototype.toObject = function(opt_includeInstance) { + return proto.hiddifyrpc.UrlTestRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.hiddifyrpc.UrlTestRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.hiddifyrpc.UrlTestRequest.toObject = function(includeInstance, msg) { + var f, obj = { +groupTag: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.hiddifyrpc.UrlTestRequest} + */ +proto.hiddifyrpc.UrlTestRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.hiddifyrpc.UrlTestRequest; + return proto.hiddifyrpc.UrlTestRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.hiddifyrpc.UrlTestRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.hiddifyrpc.UrlTestRequest} + */ +proto.hiddifyrpc.UrlTestRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setGroupTag(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.hiddifyrpc.UrlTestRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.hiddifyrpc.UrlTestRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.hiddifyrpc.UrlTestRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.hiddifyrpc.UrlTestRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getGroupTag(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string group_tag = 1; + * @return {string} + */ +proto.hiddifyrpc.UrlTestRequest.prototype.getGroupTag = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.hiddifyrpc.UrlTestRequest} returns this + */ +proto.hiddifyrpc.UrlTestRequest.prototype.setGroupTag = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.hiddifyrpc.GenerateWarpConfigRequest.prototype.toObject = function(opt_includeInstance) { + return proto.hiddifyrpc.GenerateWarpConfigRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.hiddifyrpc.GenerateWarpConfigRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.hiddifyrpc.GenerateWarpConfigRequest.toObject = function(includeInstance, msg) { + var f, obj = { +licenseKey: jspb.Message.getFieldWithDefault(msg, 1, ""), +accountId: jspb.Message.getFieldWithDefault(msg, 2, ""), +accessToken: jspb.Message.getFieldWithDefault(msg, 3, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.hiddifyrpc.GenerateWarpConfigRequest} + */ +proto.hiddifyrpc.GenerateWarpConfigRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.hiddifyrpc.GenerateWarpConfigRequest; + return proto.hiddifyrpc.GenerateWarpConfigRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.hiddifyrpc.GenerateWarpConfigRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.hiddifyrpc.GenerateWarpConfigRequest} + */ +proto.hiddifyrpc.GenerateWarpConfigRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setLicenseKey(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setAccountId(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setAccessToken(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.hiddifyrpc.GenerateWarpConfigRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.hiddifyrpc.GenerateWarpConfigRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.hiddifyrpc.GenerateWarpConfigRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.hiddifyrpc.GenerateWarpConfigRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getLicenseKey(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getAccountId(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getAccessToken(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } +}; + + +/** + * optional string license_key = 1; + * @return {string} + */ +proto.hiddifyrpc.GenerateWarpConfigRequest.prototype.getLicenseKey = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.hiddifyrpc.GenerateWarpConfigRequest} returns this + */ +proto.hiddifyrpc.GenerateWarpConfigRequest.prototype.setLicenseKey = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string account_id = 2; + * @return {string} + */ +proto.hiddifyrpc.GenerateWarpConfigRequest.prototype.getAccountId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.hiddifyrpc.GenerateWarpConfigRequest} returns this + */ +proto.hiddifyrpc.GenerateWarpConfigRequest.prototype.setAccountId = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional string access_token = 3; + * @return {string} + */ +proto.hiddifyrpc.GenerateWarpConfigRequest.prototype.getAccessToken = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.hiddifyrpc.GenerateWarpConfigRequest} returns this + */ +proto.hiddifyrpc.GenerateWarpConfigRequest.prototype.setAccessToken = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.hiddifyrpc.SetSystemProxyEnabledRequest.prototype.toObject = function(opt_includeInstance) { + return proto.hiddifyrpc.SetSystemProxyEnabledRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.hiddifyrpc.SetSystemProxyEnabledRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.hiddifyrpc.SetSystemProxyEnabledRequest.toObject = function(includeInstance, msg) { + var f, obj = { +isEnabled: jspb.Message.getBooleanFieldWithDefault(msg, 1, false) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.hiddifyrpc.SetSystemProxyEnabledRequest} + */ +proto.hiddifyrpc.SetSystemProxyEnabledRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.hiddifyrpc.SetSystemProxyEnabledRequest; + return proto.hiddifyrpc.SetSystemProxyEnabledRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.hiddifyrpc.SetSystemProxyEnabledRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.hiddifyrpc.SetSystemProxyEnabledRequest} + */ +proto.hiddifyrpc.SetSystemProxyEnabledRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setIsEnabled(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.hiddifyrpc.SetSystemProxyEnabledRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.hiddifyrpc.SetSystemProxyEnabledRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.hiddifyrpc.SetSystemProxyEnabledRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.hiddifyrpc.SetSystemProxyEnabledRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getIsEnabled(); + if (f) { + writer.writeBool( + 1, + f + ); + } +}; + + +/** + * optional bool is_enabled = 1; + * @return {boolean} + */ +proto.hiddifyrpc.SetSystemProxyEnabledRequest.prototype.getIsEnabled = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 1, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.hiddifyrpc.SetSystemProxyEnabledRequest} returns this + */ +proto.hiddifyrpc.SetSystemProxyEnabledRequest.prototype.setIsEnabled = function(value) { + return jspb.Message.setProto3BooleanField(this, 1, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.hiddifyrpc.LogMessage.prototype.toObject = function(opt_includeInstance) { + return proto.hiddifyrpc.LogMessage.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.hiddifyrpc.LogMessage} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.hiddifyrpc.LogMessage.toObject = function(includeInstance, msg) { + var f, obj = { +level: jspb.Message.getFieldWithDefault(msg, 1, 0), +type: jspb.Message.getFieldWithDefault(msg, 2, 0), +message: jspb.Message.getFieldWithDefault(msg, 3, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.hiddifyrpc.LogMessage} + */ +proto.hiddifyrpc.LogMessage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.hiddifyrpc.LogMessage; + return proto.hiddifyrpc.LogMessage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.hiddifyrpc.LogMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.hiddifyrpc.LogMessage} + */ +proto.hiddifyrpc.LogMessage.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!proto.hiddifyrpc.LogLevel} */ (reader.readEnum()); + msg.setLevel(value); + break; + case 2: + var value = /** @type {!proto.hiddifyrpc.LogType} */ (reader.readEnum()); + msg.setType(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setMessage(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.hiddifyrpc.LogMessage.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.hiddifyrpc.LogMessage.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.hiddifyrpc.LogMessage} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.hiddifyrpc.LogMessage.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getLevel(); + if (f !== 0.0) { + writer.writeEnum( + 1, + f + ); + } + f = message.getType(); + if (f !== 0.0) { + writer.writeEnum( + 2, + f + ); + } + f = message.getMessage(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } +}; + + +/** + * optional LogLevel level = 1; + * @return {!proto.hiddifyrpc.LogLevel} + */ +proto.hiddifyrpc.LogMessage.prototype.getLevel = function() { + return /** @type {!proto.hiddifyrpc.LogLevel} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {!proto.hiddifyrpc.LogLevel} value + * @return {!proto.hiddifyrpc.LogMessage} returns this + */ +proto.hiddifyrpc.LogMessage.prototype.setLevel = function(value) { + return jspb.Message.setProto3EnumField(this, 1, value); +}; + + +/** + * optional LogType type = 2; + * @return {!proto.hiddifyrpc.LogType} + */ +proto.hiddifyrpc.LogMessage.prototype.getType = function() { + return /** @type {!proto.hiddifyrpc.LogType} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {!proto.hiddifyrpc.LogType} value + * @return {!proto.hiddifyrpc.LogMessage} returns this + */ +proto.hiddifyrpc.LogMessage.prototype.setType = function(value) { + return jspb.Message.setProto3EnumField(this, 2, value); +}; + + +/** + * optional string message = 3; + * @return {string} + */ +proto.hiddifyrpc.LogMessage.prototype.getMessage = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.hiddifyrpc.LogMessage} returns this + */ +proto.hiddifyrpc.LogMessage.prototype.setMessage = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.hiddifyrpc.StopRequest.prototype.toObject = function(opt_includeInstance) { + return proto.hiddifyrpc.StopRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.hiddifyrpc.StopRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.hiddifyrpc.StopRequest.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.hiddifyrpc.StopRequest} + */ +proto.hiddifyrpc.StopRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.hiddifyrpc.StopRequest; + return proto.hiddifyrpc.StopRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.hiddifyrpc.StopRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.hiddifyrpc.StopRequest} + */ +proto.hiddifyrpc.StopRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.hiddifyrpc.StopRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.hiddifyrpc.StopRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.hiddifyrpc.StopRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.hiddifyrpc.StopRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.hiddifyrpc.TunnelStartRequest.prototype.toObject = function(opt_includeInstance) { + return proto.hiddifyrpc.TunnelStartRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.hiddifyrpc.TunnelStartRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.hiddifyrpc.TunnelStartRequest.toObject = function(includeInstance, msg) { + var f, obj = { +ipv6: jspb.Message.getBooleanFieldWithDefault(msg, 1, false), +serverPort: jspb.Message.getFieldWithDefault(msg, 2, 0), +strictRoute: jspb.Message.getBooleanFieldWithDefault(msg, 3, false), +endpointIndependentNat: jspb.Message.getBooleanFieldWithDefault(msg, 4, false), +stack: jspb.Message.getFieldWithDefault(msg, 5, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.hiddifyrpc.TunnelStartRequest} + */ +proto.hiddifyrpc.TunnelStartRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.hiddifyrpc.TunnelStartRequest; + return proto.hiddifyrpc.TunnelStartRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.hiddifyrpc.TunnelStartRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.hiddifyrpc.TunnelStartRequest} + */ +proto.hiddifyrpc.TunnelStartRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setIpv6(value); + break; + case 2: + var value = /** @type {number} */ (reader.readInt32()); + msg.setServerPort(value); + break; + case 3: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setStrictRoute(value); + break; + case 4: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setEndpointIndependentNat(value); + break; + case 5: + var value = /** @type {string} */ (reader.readString()); + msg.setStack(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.hiddifyrpc.TunnelStartRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.hiddifyrpc.TunnelStartRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.hiddifyrpc.TunnelStartRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.hiddifyrpc.TunnelStartRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getIpv6(); + if (f) { + writer.writeBool( + 1, + f + ); + } + f = message.getServerPort(); + if (f !== 0) { + writer.writeInt32( + 2, + f + ); + } + f = message.getStrictRoute(); + if (f) { + writer.writeBool( + 3, + f + ); + } + f = message.getEndpointIndependentNat(); + if (f) { + writer.writeBool( + 4, + f + ); + } + f = message.getStack(); + if (f.length > 0) { + writer.writeString( + 5, + f + ); + } +}; + + +/** + * optional bool ipv6 = 1; + * @return {boolean} + */ +proto.hiddifyrpc.TunnelStartRequest.prototype.getIpv6 = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 1, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.hiddifyrpc.TunnelStartRequest} returns this + */ +proto.hiddifyrpc.TunnelStartRequest.prototype.setIpv6 = function(value) { + return jspb.Message.setProto3BooleanField(this, 1, value); +}; + + +/** + * optional int32 server_port = 2; + * @return {number} + */ +proto.hiddifyrpc.TunnelStartRequest.prototype.getServerPort = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.hiddifyrpc.TunnelStartRequest} returns this + */ +proto.hiddifyrpc.TunnelStartRequest.prototype.setServerPort = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional bool strict_route = 3; + * @return {boolean} + */ +proto.hiddifyrpc.TunnelStartRequest.prototype.getStrictRoute = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.hiddifyrpc.TunnelStartRequest} returns this + */ +proto.hiddifyrpc.TunnelStartRequest.prototype.setStrictRoute = function(value) { + return jspb.Message.setProto3BooleanField(this, 3, value); +}; + + +/** + * optional bool endpoint_independent_nat = 4; + * @return {boolean} + */ +proto.hiddifyrpc.TunnelStartRequest.prototype.getEndpointIndependentNat = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 4, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.hiddifyrpc.TunnelStartRequest} returns this + */ +proto.hiddifyrpc.TunnelStartRequest.prototype.setEndpointIndependentNat = function(value) { + return jspb.Message.setProto3BooleanField(this, 4, value); +}; + + +/** + * optional string stack = 5; + * @return {string} + */ +proto.hiddifyrpc.TunnelStartRequest.prototype.getStack = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "")); +}; + + +/** + * @param {string} value + * @return {!proto.hiddifyrpc.TunnelStartRequest} returns this + */ +proto.hiddifyrpc.TunnelStartRequest.prototype.setStack = function(value) { + return jspb.Message.setProto3StringField(this, 5, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.hiddifyrpc.TunnelResponse.prototype.toObject = function(opt_includeInstance) { + return proto.hiddifyrpc.TunnelResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.hiddifyrpc.TunnelResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.hiddifyrpc.TunnelResponse.toObject = function(includeInstance, msg) { + var f, obj = { +message: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.hiddifyrpc.TunnelResponse} + */ +proto.hiddifyrpc.TunnelResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.hiddifyrpc.TunnelResponse; + return proto.hiddifyrpc.TunnelResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.hiddifyrpc.TunnelResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.hiddifyrpc.TunnelResponse} + */ +proto.hiddifyrpc.TunnelResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setMessage(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.hiddifyrpc.TunnelResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.hiddifyrpc.TunnelResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.hiddifyrpc.TunnelResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.hiddifyrpc.TunnelResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getMessage(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string message = 1; + * @return {string} + */ +proto.hiddifyrpc.TunnelResponse.prototype.getMessage = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.hiddifyrpc.TunnelResponse} returns this + */ +proto.hiddifyrpc.TunnelResponse.prototype.setMessage = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * @enum {number} + */ +proto.hiddifyrpc.CoreState = { + STOPPED: 0, + STARTING: 1, + STARTED: 2, + STOPPING: 3 +}; + +/** + * @enum {number} + */ +proto.hiddifyrpc.MessageType = { + EMPTY: 0, + EMPTY_CONFIGURATION: 1, + START_COMMAND_SERVER: 2, + CREATE_SERVICE: 3, + START_SERVICE: 4, + UNEXPECTED_ERROR: 5, + ALREADY_STARTED: 6, + ALREADY_STOPPED: 7, + INSTANCE_NOT_FOUND: 8, + INSTANCE_NOT_STOPPED: 9, + INSTANCE_NOT_STARTED: 10, + ERROR_BUILDING_CONFIG: 11, + ERROR_PARSING_CONFIG: 12, + ERROR_READING_CONFIG: 13 +}; + +/** + * @enum {number} + */ +proto.hiddifyrpc.LogLevel = { + DEBUG: 0, + INFO: 1, + WARNING: 2, + ERROR: 3, + FATAL: 4 +}; + +/** + * @enum {number} + */ +proto.hiddifyrpc.LogType = { + CORE: 0, + SERVICE: 1, + CONFIG: 2 +}; + +goog.object.extend(exports, proto.hiddifyrpc); + +},{"./base_pb.js":1,"google-protobuf":12}],12:[function(require,module,exports){ (function (global){(function (){ /* @@ -2758,7 +9807,7 @@ W.prototype.Uc=function(a,b){if(null!=b&&b.length)for(Y(this,a,2),this.a.j(8*b.l W.prototype.Zc=function(a,b){if(null!=b&&b.length)for(Y(this,a,2),this.a.j(8*b.length),a=0;a { + const hsetting_request = new hiddify.ChangeHiddifySettingsRequest(); + hsetting_request.setHiddifySettingsJson($("#hiddify-settings").val()); + try{ + const hres=await hiddifyClient.changeHiddifySettings(hsetting_request, {}); + }catch(err){ + $("#hiddify-settings").val("") + console.log(err) + } + + const parse_request = new hiddify.ParseRequest(); + parse_request.setContent($("#config-content").val()); + try{ + const pres=await hiddifyClient.parse(parse_request, {}); + if (pres.getResponseCode() !== hiddify.ResponseCode.OK){ + alert(pres.getMessage()); + return + } + $("#config-content").val(pres.getContent()); + }catch(err){ + console.log(err) + alert(JSON.stringify(err)) + return + } + + const request = new hiddify.StartRequest(); + + request.setConfigContent($("#config-content").val()); + request.setEnableRawConfig(false); + try{ + const res=await hiddifyClient.start(request, {}); + console.log(res.getCoreState(),res.getMessage()) + handleCoreStatus(res.getCoreState()); + }catch(err){ + console.log(err) + alert(JSON.stringify(err)) + return + } + + + }) + + $("#disconnect-button").click(async () => { + const request = new hiddify.Empty(); + try{ + const res=await hiddifyClient.stop(request, {}); + console.log(res.getCoreState(),res.getMessage()) + handleCoreStatus(res.getCoreState()); + }catch(err){ + console.log(err) + alert(JSON.stringify(err)) + return + } + }) +} + + +function connect(){ + const request = new hiddify.Empty(); + const stream = hiddifyClient.coreInfoListener(request, {}); + stream.on('data', (response) => { + console.log('Receving ',response); + handleCoreStatus(response); + }); + + stream.on('error', (err) => { + console.error('Error opening extension page:', err); + // openExtensionPage(extensionId); + }); + + stream.on('end', () => { + console.log('Stream ended'); + setTimeout(connect, 1000); + + }); +} + + +function handleCoreStatus(status){ + if (status == hiddify.CoreState.STOPPED){ + $("#connection-before-connect").show(); + $("#connection-connecting").hide(); + }else{ + $("#connection-before-connect").hide(); + $("#connection-connecting").show(); + if (status == hiddify.CoreState.STARTING){ + $("#connection-status").text("Starting"); + $("#connection-status").css("color", "yellow"); + }else if (status == hiddify.CoreState.STOPPING){ + $("#connection-status").text("Stopping"); + $("#connection-status").css("color", "red"); + }else if (status == hiddify.CoreState.STARTED){ + $("#connection-status").text("Connected"); + $("#connection-status").css("color", "green"); + } + } +} + + +module.exports = { openConnectionPage }; \ No newline at end of file diff --git a/extension/html/rpc/extension.js b/extension/html/rpc/extension.js index 49e4d8b..fe8ca02 100644 --- a/extension/html/rpc/extension.js +++ b/extension/html/rpc/extension.js @@ -1,7 +1,8 @@ const { listExtensions } = require('./extensionList.js'); - +const { openConnectionPage } = require('./connectionPage.js'); window.onload = () => { listExtensions(); + openConnectionPage(); }; diff --git a/extension/html/rpc/extensionList.js b/extension/html/rpc/extensionList.js index 0ad9e39..f5978ba 100644 --- a/extension/html/rpc/extensionList.js +++ b/extension/html/rpc/extensionList.js @@ -1,18 +1,16 @@ -const { client,extension } = require('./client.js'); +const { extensionClient } = require('./client.js'); +const extension = require("./extension_grpc_web_pb.js"); async function listExtensions() { $("#extension-list-container").show(); $("#extension-page-container").hide(); + $("#connection-page").show(); try { - const extensionListContainer = document.getElementById('extension-list-container'); + const extensionListContainer = document.getElementById('extension-list'); extensionListContainer.innerHTML = ''; // Clear previous entries - const response = await client.listExtensions(new extension.Empty(), {}); - const header = document.createElement('h1'); - header.classList.add('mb-4'); - header.textContent = "Extension List"; - extensionListContainer.appendChild(header); - + const response = await extensionClient.listExtensions(new extension.Empty(), {}); + const extensionList = response.getExtensionsList(); extensionList.forEach(ext => { const listItem = createExtensionListItem(ext); @@ -38,14 +36,20 @@ function createExtensionListItem(ext) { descriptionElement.className = 'mb-0'; descriptionElement.textContent = ext.getDescription(); contentDiv.appendChild(descriptionElement); - + contentDiv.style.width="100%"; listItem.appendChild(contentDiv); const switchDiv = createSwitchElement(ext); listItem.appendChild(switchDiv); const {openExtensionPage} = require('./extensionPage.js'); - listItem.addEventListener('click', () => openExtensionPage(ext.getId())); + contentDiv.addEventListener('click', () =>{ + if (!ext.getEnable() ){ + alert("Extension is not enabled") + return + } + openExtensionPage(ext.getId()) + }); return listItem; } @@ -58,7 +62,10 @@ function createSwitchElement(ext) { switchButton.type = 'checkbox'; switchButton.className = 'form-check-input'; switchButton.checked = ext.getEnable(); - switchButton.addEventListener('change', () => toggleExtension(ext.getId(), switchButton.checked)); + switchButton.addEventListener('change', (e) => { + + toggleExtension(ext.getId(), switchButton.checked) + }); switchDiv.appendChild(switchButton); return switchDiv; @@ -70,11 +77,12 @@ async function toggleExtension(extensionId, enable) { request.setEnable(enable); try { - await client.editExtension(request, {}); + await extensionClient.editExtension(request, {}); console.log(`Extension ${extensionId} updated to ${enable ? 'enabled' : 'disabled'}`); } catch (err) { console.error('Error updating extension status:', err); } + listExtensions(); } diff --git a/extension/html/rpc/extensionPage.js b/extension/html/rpc/extensionPage.js index 5adfe2d..47e1e67 100644 --- a/extension/html/rpc/extensionPage.js +++ b/extension/html/rpc/extensionPage.js @@ -1,18 +1,25 @@ -const { client,extension } = require('./client.js'); +const { extensionClient } = require('./client.js'); +const extension = require("./extension_grpc_web_pb.js"); + const { renderForm } = require('./formRenderer.js'); const { listExtensions } = require('./extensionList.js'); var currentExtensionId=undefined; function openExtensionPage(extensionId) { currentExtensionId=extensionId; $("#extension-list-container").hide(); - $("#extension-page-container").show(); - const request = new extension.ExtensionRequest(); - request.setExtensionId(extensionId); + $("#extension-page-container").show(); + $("#connection-page").hide(); + connect() +} - const stream = client.connect(request, {}); +function connect() { + const request = new extension.ExtensionRequest(); + request.setExtensionId(currentExtensionId); + + const stream = extensionClient.connect(request, {}); stream.on('data', (response) => { - + console.log('Receving ',response); if (response.getExtensionId() === currentExtensionId) { ui=JSON.parse(response.getJsonUi()) if(response.getType()== proto.hiddifyrpc.ExtensionResponseType.SHOW_DIALOG) { @@ -27,25 +34,29 @@ function openExtensionPage(extensionId) { stream.on('error', (err) => { console.error('Error opening extension page:', err); + // openExtensionPage(extensionId); }); stream.on('end', () => { console.log('Stream ended'); + setTimeout(connect, 1000); + }); } async function handleSubmitButtonClick(event) { event.preventDefault(); + bootstrap.Modal.getOrCreateInstance("#extension-dialog").hide(); const formData = new FormData(event.target.closest('form')); const request = new extension.ExtensionRequest(); - + const datamap=request.getDataMap() formData.forEach((value, key) => { - request.getDataMap()[key] = value; + datamap.set(key,value); }); request.setExtensionId(currentExtensionId); try { - await client.submitForm(request, {}); + await extensionClient.submitForm(request, {}); console.log('Form submitted successfully.'); } catch (err) { console.error('Error submitting form:', err); @@ -58,7 +69,9 @@ async function handleCancelButtonClick(event) { request.setExtensionId(currentExtensionId); try { - await client.cancel(request, {}); + bootstrap.Modal.getOrCreateInstance("#extension-dialog").hide(); + + await extensionClient.cancel(request, {}); console.log('Extension cancelled successfully.'); } catch (err) { console.error('Error cancelling extension:', err); @@ -71,7 +84,7 @@ async function handleStopButtonClick(event) { request.setExtensionId(currentExtensionId); try { - await client.stop(request, {}); + await extensionClient.stop(request, {}); console.log('Extension stopped successfully.'); currentExtensionId = undefined; listExtensions(); // Return to the extension list diff --git a/extension/html/rpc/formRenderer.js b/extension/html/rpc/formRenderer.js index 4f710ad..646bd04 100644 --- a/extension/html/rpc/formRenderer.js +++ b/extension/html/rpc/formRenderer.js @@ -1,5 +1,9 @@ -const { client } = require('./client.js'); -const extension = require("./extension_grpc_web_pb.js"); + +const ansi_up = new AnsiUp({ + escape_html: false, + +}); + function renderForm(json, dialog, submitAction, cancelAction, stopAction) { const container = document.getElementById(`extension-page-container${dialog}`); @@ -10,23 +14,36 @@ function renderForm(json, dialog, submitAction, cancelAction, stopAction) { existingForm.remove(); } const form = document.createElement('form'); + container.appendChild(form); form.id = formId; if (dialog === "dialog") { document.getElementById("modalLabel").textContent = json.title; } else { const titleElement = createTitleElement(json); + if (stopAction != undefined) { + const stopButton = document.createElement('button'); + stopButton.textContent = "Back"; + stopButton.classList.add('btn', 'btn-danger'); + stopButton.addEventListener('click', stopAction); + form.appendChild(stopButton); + } form.appendChild(titleElement); } addElementsToForm(form, json); - const buttonGroup = createButtonGroup(json, submitAction, cancelAction, stopAction); + const buttonGroup = createButtonGroup(json, submitAction, cancelAction); if (dialog === "dialog") { document.getElementById("modal-footer").innerHTML = ''; document.getElementById("modal-footer").appendChild(buttonGroup); + const dialog = bootstrap.Modal.getOrCreateInstance("#extension-dialog"); + dialog.show() + dialog.on("hidden.bs.modal", () => { + cancelAction() + }) } else { form.appendChild(buttonGroup); } - container.appendChild(form); + } function addElementsToForm(form, json) { @@ -36,12 +53,12 @@ function addElementsToForm(form, json) { const description = document.createElement('p'); description.textContent = json.description; form.appendChild(description); - - json.fields.forEach(field => { - const formGroup = createFormGroup(field); - form.appendChild(formGroup); - }); - + if (json.fields) { + json.fields.forEach(field => { + const formGroup = createFormGroup(field); + form.appendChild(formGroup); + }); + } return form; } @@ -72,6 +89,11 @@ function createInputElement(field) { let input; switch (field.type) { + case "Console": + input = document.createElement('pre'); + input.innerHTML = ansi_up.ansi_to_html(field.value || field.placeholder || ''); + input.style.maxHeight = field.lines * 20 + 'px'; + break; case "TextArea": input = document.createElement('textarea'); input.rows = field.lines || 3; @@ -167,30 +189,25 @@ function createSwitchElement(field) { return switchWrapper; } -function createButtonGroup(json, submitAction, cancelAction, stopAction) { +function createButtonGroup(json, submitAction, cancelAction) { const buttonGroup = document.createElement('div'); buttonGroup.classList.add('btn-group'); + json.buttons.forEach(buttonText => { + const btn = document.createElement('button'); + btn.classList.add('btn',"btn-default"); + buttonGroup.appendChild(btn); + btn.textContent = buttonText + if (buttonText=="Cancel") { + btn.classList.add( 'btn-secondary'); + btn.addEventListener('click', cancelAction); + }else{ + if (buttonText=="Submit"||buttonText=="Ok") + btn.classList.add('btn-primary'); + btn.addEventListener('click', submitAction); + } + + }) - const cancelButton = document.createElement('button'); - cancelButton.textContent = "Cancel"; - cancelButton.classList.add('btn', 'btn-secondary'); - cancelButton.addEventListener('click', cancelAction); - buttonGroup.appendChild(cancelButton); - if (stopAction != undefined) { - const stopButton = document.createElement('button'); - stopButton.textContent = "Stop"; - stopButton.classList.add('btn', 'btn-danger'); - stopButton.addEventListener('click', stopAction); - buttonGroup.appendChild(stopButton); - } - - if (json.buttonMode === "SubmitCancel") { - const submitButton = document.createElement('button'); - submitButton.textContent = "Submit"; - submitButton.classList.add('btn', 'btn-primary'); - submitButton.addEventListener('click', submitAction); - buttonGroup.appendChild(submitButton); - } return buttonGroup; diff --git a/extension/html/rpc/hiddify_grpc_web_pb.js b/extension/html/rpc/hiddify_grpc_web_pb.js index 6fe6f24..0b44622 100644 --- a/extension/html/rpc/hiddify_grpc_web_pb.js +++ b/extension/html/rpc/hiddify_grpc_web_pb.js @@ -250,6 +250,230 @@ proto.hiddifyrpc.CorePromiseClient.prototype.start = }; +/** + * @const + * @type {!grpc.web.MethodDescriptor< + * !proto.hiddifyrpc.Empty, + * !proto.hiddifyrpc.CoreInfoResponse>} + */ +const methodDescriptor_Core_CoreInfoListener = new grpc.web.MethodDescriptor( + '/hiddifyrpc.Core/CoreInfoListener', + grpc.web.MethodType.SERVER_STREAMING, + base_pb.Empty, + proto.hiddifyrpc.CoreInfoResponse, + /** + * @param {!proto.hiddifyrpc.Empty} request + * @return {!Uint8Array} + */ + function(request) { + return request.serializeBinary(); + }, + proto.hiddifyrpc.CoreInfoResponse.deserializeBinary +); + + +/** + * @param {!proto.hiddifyrpc.Empty} request The request proto + * @param {?Object=} metadata User defined + * call metadata + * @return {!grpc.web.ClientReadableStream} + * The XHR Node Readable Stream + */ +proto.hiddifyrpc.CoreClient.prototype.coreInfoListener = + function(request, metadata) { + return this.client_.serverStreaming(this.hostname_ + + '/hiddifyrpc.Core/CoreInfoListener', + request, + metadata || {}, + methodDescriptor_Core_CoreInfoListener); +}; + + +/** + * @param {!proto.hiddifyrpc.Empty} request The request proto + * @param {?Object=} metadata User defined + * call metadata + * @return {!grpc.web.ClientReadableStream} + * The XHR Node Readable Stream + */ +proto.hiddifyrpc.CorePromiseClient.prototype.coreInfoListener = + function(request, metadata) { + return this.client_.serverStreaming(this.hostname_ + + '/hiddifyrpc.Core/CoreInfoListener', + request, + metadata || {}, + methodDescriptor_Core_CoreInfoListener); +}; + + +/** + * @const + * @type {!grpc.web.MethodDescriptor< + * !proto.hiddifyrpc.Empty, + * !proto.hiddifyrpc.OutboundGroupList>} + */ +const methodDescriptor_Core_OutboundsInfo = new grpc.web.MethodDescriptor( + '/hiddifyrpc.Core/OutboundsInfo', + grpc.web.MethodType.SERVER_STREAMING, + base_pb.Empty, + proto.hiddifyrpc.OutboundGroupList, + /** + * @param {!proto.hiddifyrpc.Empty} request + * @return {!Uint8Array} + */ + function(request) { + return request.serializeBinary(); + }, + proto.hiddifyrpc.OutboundGroupList.deserializeBinary +); + + +/** + * @param {!proto.hiddifyrpc.Empty} request The request proto + * @param {?Object=} metadata User defined + * call metadata + * @return {!grpc.web.ClientReadableStream} + * The XHR Node Readable Stream + */ +proto.hiddifyrpc.CoreClient.prototype.outboundsInfo = + function(request, metadata) { + return this.client_.serverStreaming(this.hostname_ + + '/hiddifyrpc.Core/OutboundsInfo', + request, + metadata || {}, + methodDescriptor_Core_OutboundsInfo); +}; + + +/** + * @param {!proto.hiddifyrpc.Empty} request The request proto + * @param {?Object=} metadata User defined + * call metadata + * @return {!grpc.web.ClientReadableStream} + * The XHR Node Readable Stream + */ +proto.hiddifyrpc.CorePromiseClient.prototype.outboundsInfo = + function(request, metadata) { + return this.client_.serverStreaming(this.hostname_ + + '/hiddifyrpc.Core/OutboundsInfo', + request, + metadata || {}, + methodDescriptor_Core_OutboundsInfo); +}; + + +/** + * @const + * @type {!grpc.web.MethodDescriptor< + * !proto.hiddifyrpc.Empty, + * !proto.hiddifyrpc.OutboundGroupList>} + */ +const methodDescriptor_Core_MainOutboundsInfo = new grpc.web.MethodDescriptor( + '/hiddifyrpc.Core/MainOutboundsInfo', + grpc.web.MethodType.SERVER_STREAMING, + base_pb.Empty, + proto.hiddifyrpc.OutboundGroupList, + /** + * @param {!proto.hiddifyrpc.Empty} request + * @return {!Uint8Array} + */ + function(request) { + return request.serializeBinary(); + }, + proto.hiddifyrpc.OutboundGroupList.deserializeBinary +); + + +/** + * @param {!proto.hiddifyrpc.Empty} request The request proto + * @param {?Object=} metadata User defined + * call metadata + * @return {!grpc.web.ClientReadableStream} + * The XHR Node Readable Stream + */ +proto.hiddifyrpc.CoreClient.prototype.mainOutboundsInfo = + function(request, metadata) { + return this.client_.serverStreaming(this.hostname_ + + '/hiddifyrpc.Core/MainOutboundsInfo', + request, + metadata || {}, + methodDescriptor_Core_MainOutboundsInfo); +}; + + +/** + * @param {!proto.hiddifyrpc.Empty} request The request proto + * @param {?Object=} metadata User defined + * call metadata + * @return {!grpc.web.ClientReadableStream} + * The XHR Node Readable Stream + */ +proto.hiddifyrpc.CorePromiseClient.prototype.mainOutboundsInfo = + function(request, metadata) { + return this.client_.serverStreaming(this.hostname_ + + '/hiddifyrpc.Core/MainOutboundsInfo', + request, + metadata || {}, + methodDescriptor_Core_MainOutboundsInfo); +}; + + +/** + * @const + * @type {!grpc.web.MethodDescriptor< + * !proto.hiddifyrpc.Empty, + * !proto.hiddifyrpc.SystemInfo>} + */ +const methodDescriptor_Core_GetSystemInfo = new grpc.web.MethodDescriptor( + '/hiddifyrpc.Core/GetSystemInfo', + grpc.web.MethodType.SERVER_STREAMING, + base_pb.Empty, + proto.hiddifyrpc.SystemInfo, + /** + * @param {!proto.hiddifyrpc.Empty} request + * @return {!Uint8Array} + */ + function(request) { + return request.serializeBinary(); + }, + proto.hiddifyrpc.SystemInfo.deserializeBinary +); + + +/** + * @param {!proto.hiddifyrpc.Empty} request The request proto + * @param {?Object=} metadata User defined + * call metadata + * @return {!grpc.web.ClientReadableStream} + * The XHR Node Readable Stream + */ +proto.hiddifyrpc.CoreClient.prototype.getSystemInfo = + function(request, metadata) { + return this.client_.serverStreaming(this.hostname_ + + '/hiddifyrpc.Core/GetSystemInfo', + request, + metadata || {}, + methodDescriptor_Core_GetSystemInfo); +}; + + +/** + * @param {!proto.hiddifyrpc.Empty} request The request proto + * @param {?Object=} metadata User defined + * call metadata + * @return {!grpc.web.ClientReadableStream} + * The XHR Node Readable Stream + */ +proto.hiddifyrpc.CorePromiseClient.prototype.getSystemInfo = + function(request, metadata) { + return this.client_.serverStreaming(this.hostname_ + + '/hiddifyrpc.Core/GetSystemInfo', + request, + metadata || {}, + methodDescriptor_Core_GetSystemInfo); +}; + + /** * @const * @type {!grpc.web.MethodDescriptor< @@ -375,16 +599,16 @@ proto.hiddifyrpc.CorePromiseClient.prototype.parse = /** * @const * @type {!grpc.web.MethodDescriptor< - * !proto.hiddifyrpc.ChangeConfigOptionsRequest, + * !proto.hiddifyrpc.ChangeHiddifySettingsRequest, * !proto.hiddifyrpc.CoreInfoResponse>} */ -const methodDescriptor_Core_ChangeConfigOptions = new grpc.web.MethodDescriptor( - '/hiddifyrpc.Core/ChangeConfigOptions', +const methodDescriptor_Core_ChangeHiddifySettings = new grpc.web.MethodDescriptor( + '/hiddifyrpc.Core/ChangeHiddifySettings', grpc.web.MethodType.UNARY, - proto.hiddifyrpc.ChangeConfigOptionsRequest, + proto.hiddifyrpc.ChangeHiddifySettingsRequest, proto.hiddifyrpc.CoreInfoResponse, /** - * @param {!proto.hiddifyrpc.ChangeConfigOptionsRequest} request + * @param {!proto.hiddifyrpc.ChangeHiddifySettingsRequest} request * @return {!Uint8Array} */ function(request) { @@ -395,7 +619,7 @@ const methodDescriptor_Core_ChangeConfigOptions = new grpc.web.MethodDescriptor( /** - * @param {!proto.hiddifyrpc.ChangeConfigOptionsRequest} request The + * @param {!proto.hiddifyrpc.ChangeHiddifySettingsRequest} request The * request proto * @param {?Object} metadata User defined * call metadata @@ -404,32 +628,32 @@ const methodDescriptor_Core_ChangeConfigOptions = new grpc.web.MethodDescriptor( * @return {!grpc.web.ClientReadableStream|undefined} * The XHR Node Readable Stream */ -proto.hiddifyrpc.CoreClient.prototype.changeConfigOptions = +proto.hiddifyrpc.CoreClient.prototype.changeHiddifySettings = function(request, metadata, callback) { return this.client_.rpcCall(this.hostname_ + - '/hiddifyrpc.Core/ChangeConfigOptions', + '/hiddifyrpc.Core/ChangeHiddifySettings', request, metadata || {}, - methodDescriptor_Core_ChangeConfigOptions, + methodDescriptor_Core_ChangeHiddifySettings, callback); }; /** - * @param {!proto.hiddifyrpc.ChangeConfigOptionsRequest} request The + * @param {!proto.hiddifyrpc.ChangeHiddifySettingsRequest} request The * request proto * @param {?Object=} metadata User defined * call metadata * @return {!Promise} * Promise that resolves to the response */ -proto.hiddifyrpc.CorePromiseClient.prototype.changeConfigOptions = +proto.hiddifyrpc.CorePromiseClient.prototype.changeHiddifySettings = function(request, metadata) { return this.client_.unaryCall(this.hostname_ + - '/hiddifyrpc.Core/ChangeConfigOptions', + '/hiddifyrpc.Core/ChangeHiddifySettings', request, metadata || {}, - methodDescriptor_Core_ChangeConfigOptions); + methodDescriptor_Core_ChangeHiddifySettings); }; @@ -921,6 +1145,62 @@ proto.hiddifyrpc.CorePromiseClient.prototype.setSystemProxyEnabled = }; +/** + * @const + * @type {!grpc.web.MethodDescriptor< + * !proto.hiddifyrpc.Empty, + * !proto.hiddifyrpc.LogMessage>} + */ +const methodDescriptor_Core_LogListener = new grpc.web.MethodDescriptor( + '/hiddifyrpc.Core/LogListener', + grpc.web.MethodType.SERVER_STREAMING, + base_pb.Empty, + proto.hiddifyrpc.LogMessage, + /** + * @param {!proto.hiddifyrpc.Empty} request + * @return {!Uint8Array} + */ + function(request) { + return request.serializeBinary(); + }, + proto.hiddifyrpc.LogMessage.deserializeBinary +); + + +/** + * @param {!proto.hiddifyrpc.Empty} request The request proto + * @param {?Object=} metadata User defined + * call metadata + * @return {!grpc.web.ClientReadableStream} + * The XHR Node Readable Stream + */ +proto.hiddifyrpc.CoreClient.prototype.logListener = + function(request, metadata) { + return this.client_.serverStreaming(this.hostname_ + + '/hiddifyrpc.Core/LogListener', + request, + metadata || {}, + methodDescriptor_Core_LogListener); +}; + + +/** + * @param {!proto.hiddifyrpc.Empty} request The request proto + * @param {?Object=} metadata User defined + * call metadata + * @return {!grpc.web.ClientReadableStream} + * The XHR Node Readable Stream + */ +proto.hiddifyrpc.CorePromiseClient.prototype.logListener = + function(request, metadata) { + return this.client_.serverStreaming(this.hostname_ + + '/hiddifyrpc.Core/LogListener', + request, + metadata || {}, + methodDescriptor_Core_LogListener); +}; + + /** * @param {string} hostname * @param {?Object} credentials diff --git a/extension/html/rpc/hiddify_pb.js b/extension/html/rpc/hiddify_pb.js index 7bb8cd2..5532c9b 100644 --- a/extension/html/rpc/hiddify_pb.js +++ b/extension/html/rpc/hiddify_pb.js @@ -23,7 +23,7 @@ var global = var base_pb = require('./base_pb.js'); goog.object.extend(proto, base_pb); -goog.exportSymbol('proto.hiddifyrpc.ChangeConfigOptionsRequest', null, global); +goog.exportSymbol('proto.hiddifyrpc.ChangeHiddifySettingsRequest', null, global); goog.exportSymbol('proto.hiddifyrpc.CoreInfoResponse', null, global); goog.exportSymbol('proto.hiddifyrpc.CoreState', null, global); goog.exportSymbol('proto.hiddifyrpc.GenerateConfigRequest', null, global); @@ -356,16 +356,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.hiddifyrpc.ChangeConfigOptionsRequest = function(opt_data) { +proto.hiddifyrpc.ChangeHiddifySettingsRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.hiddifyrpc.ChangeConfigOptionsRequest, jspb.Message); +goog.inherits(proto.hiddifyrpc.ChangeHiddifySettingsRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.hiddifyrpc.ChangeConfigOptionsRequest.displayName = 'proto.hiddifyrpc.ChangeConfigOptionsRequest'; + proto.hiddifyrpc.ChangeHiddifySettingsRequest.displayName = 'proto.hiddifyrpc.ChangeHiddifySettingsRequest'; } /** * Generated by JsPbCodeGenerator. @@ -3625,8 +3625,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.hiddifyrpc.ChangeConfigOptionsRequest.prototype.toObject = function(opt_includeInstance) { - return proto.hiddifyrpc.ChangeConfigOptionsRequest.toObject(opt_includeInstance, this); +proto.hiddifyrpc.ChangeHiddifySettingsRequest.prototype.toObject = function(opt_includeInstance) { + return proto.hiddifyrpc.ChangeHiddifySettingsRequest.toObject(opt_includeInstance, this); }; @@ -3635,13 +3635,13 @@ proto.hiddifyrpc.ChangeConfigOptionsRequest.prototype.toObject = function(opt_in * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.hiddifyrpc.ChangeConfigOptionsRequest} msg The msg instance to transform. + * @param {!proto.hiddifyrpc.ChangeHiddifySettingsRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.hiddifyrpc.ChangeConfigOptionsRequest.toObject = function(includeInstance, msg) { +proto.hiddifyrpc.ChangeHiddifySettingsRequest.toObject = function(includeInstance, msg) { var f, obj = { -configOptionsJson: jspb.Message.getFieldWithDefault(msg, 1, "") +hiddifySettingsJson: jspb.Message.getFieldWithDefault(msg, 1, "") }; if (includeInstance) { @@ -3655,23 +3655,23 @@ configOptionsJson: jspb.Message.getFieldWithDefault(msg, 1, "") /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.hiddifyrpc.ChangeConfigOptionsRequest} + * @return {!proto.hiddifyrpc.ChangeHiddifySettingsRequest} */ -proto.hiddifyrpc.ChangeConfigOptionsRequest.deserializeBinary = function(bytes) { +proto.hiddifyrpc.ChangeHiddifySettingsRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.hiddifyrpc.ChangeConfigOptionsRequest; - return proto.hiddifyrpc.ChangeConfigOptionsRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.hiddifyrpc.ChangeHiddifySettingsRequest; + return proto.hiddifyrpc.ChangeHiddifySettingsRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.hiddifyrpc.ChangeConfigOptionsRequest} msg The message object to deserialize into. + * @param {!proto.hiddifyrpc.ChangeHiddifySettingsRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.hiddifyrpc.ChangeConfigOptionsRequest} + * @return {!proto.hiddifyrpc.ChangeHiddifySettingsRequest} */ -proto.hiddifyrpc.ChangeConfigOptionsRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.hiddifyrpc.ChangeHiddifySettingsRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -3680,7 +3680,7 @@ proto.hiddifyrpc.ChangeConfigOptionsRequest.deserializeBinaryFromReader = functi switch (field) { case 1: var value = /** @type {string} */ (reader.readString()); - msg.setConfigOptionsJson(value); + msg.setHiddifySettingsJson(value); break; default: reader.skipField(); @@ -3695,9 +3695,9 @@ proto.hiddifyrpc.ChangeConfigOptionsRequest.deserializeBinaryFromReader = functi * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.hiddifyrpc.ChangeConfigOptionsRequest.prototype.serializeBinary = function() { +proto.hiddifyrpc.ChangeHiddifySettingsRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.hiddifyrpc.ChangeConfigOptionsRequest.serializeBinaryToWriter(this, writer); + proto.hiddifyrpc.ChangeHiddifySettingsRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -3705,13 +3705,13 @@ proto.hiddifyrpc.ChangeConfigOptionsRequest.prototype.serializeBinary = function /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.hiddifyrpc.ChangeConfigOptionsRequest} message + * @param {!proto.hiddifyrpc.ChangeHiddifySettingsRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.hiddifyrpc.ChangeConfigOptionsRequest.serializeBinaryToWriter = function(message, writer) { +proto.hiddifyrpc.ChangeHiddifySettingsRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getConfigOptionsJson(); + f = message.getHiddifySettingsJson(); if (f.length > 0) { writer.writeString( 1, @@ -3722,19 +3722,19 @@ proto.hiddifyrpc.ChangeConfigOptionsRequest.serializeBinaryToWriter = function(m /** - * optional string config_options_json = 1; + * optional string hiddify_settings_json = 1; * @return {string} */ -proto.hiddifyrpc.ChangeConfigOptionsRequest.prototype.getConfigOptionsJson = function() { +proto.hiddifyrpc.ChangeHiddifySettingsRequest.prototype.getHiddifySettingsJson = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value - * @return {!proto.hiddifyrpc.ChangeConfigOptionsRequest} returns this + * @return {!proto.hiddifyrpc.ChangeHiddifySettingsRequest} returns this */ -proto.hiddifyrpc.ChangeConfigOptionsRequest.prototype.setConfigOptionsJson = function(value) { +proto.hiddifyrpc.ChangeHiddifySettingsRequest.prototype.setHiddifySettingsJson = function(value) { return jspb.Message.setProto3StringField(this, 1, value); }; diff --git a/extension/interface.go b/extension/interface.go new file mode 100644 index 0000000..4fb7499 --- /dev/null +++ b/extension/interface.go @@ -0,0 +1,45 @@ +package extension + +import ( + "fmt" + "log" + + "github.com/hiddify/hiddify-core/common" +) + +var ( + allExtensionsMap = make(map[string]ExtensionFactory) + enabledExtensionsMap = make(map[string]*Extension) + generalExtensionData = mustSaveExtensionData{ + ExtensionStatusMap: make(map[string]bool), + } +) + +type mustSaveExtensionData struct { + ExtensionStatusMap map[string]bool `json:"extensionStatusMap"` +} + +func RegisterExtension(factory ExtensionFactory) error { + if _, ok := allExtensionsMap[factory.Id]; ok { + err := fmt.Errorf("Extension with ID %s already exists", factory.Id) + log.Fatal(err) + return err + } + allExtensionsMap[factory.Id] = factory + common.Storage.GetExtensionData("default", &generalExtensionData) + + if val, ok := generalExtensionData.ExtensionStatusMap[factory.Id]; ok && val { + loadExtension(factory) + } + return nil +} + +func loadExtension(factory ExtensionFactory) error { + extension := factory.Builder() + extension.init(factory.Id) + + // fmt.Printf("Registered extension: %+v\n", extension) + enabledExtensionsMap[factory.Id] = &extension + + return nil +} diff --git a/extension/sdk/interface.go b/extension/sdk/interface.go new file mode 100644 index 0000000..e84cb2b --- /dev/null +++ b/extension/sdk/interface.go @@ -0,0 +1,47 @@ +package sdk + +import ( + "fmt" + "io/ioutil" + "net/http" + "runtime" + "strings" + + "github.com/hiddify/hiddify-core/config" + v2 "github.com/hiddify/hiddify-core/v2" + "github.com/sagernet/sing-box/option" +) + +func RunInstance(hiddifySettings *config.HiddifyOptions, singconfig *option.Options) (*v2.HiddifyService, error) { + return v2.RunInstance(hiddifySettings, singconfig) +} + +func ParseConfig(hiddifySettings *config.HiddifyOptions, configStr string) (*option.Options, error) { + if hiddifySettings == nil { + hiddifySettings = config.DefaultHiddifyOptions() + } + if strings.HasPrefix(configStr, "http://") || strings.HasPrefix(configStr, "https://") { + client := &http.Client{} + configPath := strings.Split(configStr, "\n")[0] + // Create a new request + req, err := http.NewRequest("GET", configPath, nil) + if err != nil { + fmt.Println("Error creating request:", err) + return nil, err + } + req.Header.Set("User-Agent", "HiddifyNext/2.3.1 ("+runtime.GOOS+") like ClashMeta v2ray sing-box") + resp, err := client.Do(req) + if err != nil { + fmt.Println("Error making GET request:", err) + return nil, err + } + defer resp.Body.Close() + + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, fmt.Errorf("failed to read config body: %w", err) + } + configStr = string(body) + } + return config.ParseConfigContentToOptions(configStr, true, hiddifySettings, false) +} diff --git a/extension/ui_elements/abstract.go b/extension/ui/abstract.go similarity index 98% rename from extension/ui_elements/abstract.go rename to extension/ui/abstract.go index 3e6db3f..b3c703d 100644 --- a/extension/ui_elements/abstract.go +++ b/extension/ui/abstract.go @@ -1,4 +1,4 @@ -package ui_elements +package ui // // Field is an interface that all specific field types implement. // type Field interface { diff --git a/extension/ui_elements/all_test.go b/extension/ui/all_test.go similarity index 98% rename from extension/ui_elements/all_test.go rename to extension/ui/all_test.go index a6189b3..eedd36f 100644 --- a/extension/ui_elements/all_test.go +++ b/extension/ui/all_test.go @@ -1,4 +1,4 @@ -package ui_elements +package ui // import ( // "encoding/json" diff --git a/extension/ui_elements/base.go b/extension/ui/base.go similarity index 61% rename from extension/ui_elements/base.go rename to extension/ui/base.go index 13de25b..7040ed4 100644 --- a/extension/ui_elements/base.go +++ b/extension/ui/base.go @@ -1,4 +1,4 @@ -package ui_elements +package ui import ( "encoding/json" @@ -20,27 +20,27 @@ const ( FieldSwitch string = "Switch" FieldCheckbox string = "Checkbox" FieldRadioButton string = "RadioButton" + FieldConsole string = "Console" ValidatorDigitsOnly string = "digitsOnly" - Button_SubmitCancel string = "SubmitCancel" - Button_Cancel string = "Cancel" + + Button_Ok string = "Ok" + Button_Submit string = "Submit" + Button_Cancel string = "Cancel" ) // FormField extends GenericField with additional common properties. type FormField struct { - Key string `json:"key"` - Type string `json:"type"` - Label string `json:"label,omitempty"` - LabelHidden bool `json:"labelHidden"` - Required bool `json:"required,omitempty"` - Placeholder string `json:"placeholder,omitempty"` - Readonly bool `json:"readonly,omitempty"` - Value string `json:"value"` - Validator string `json:"validator,omitempty"` - Items []SelectItem `json:"items,omitempty"` - Lines int `json:"lines,omitempty"` - VerticalScroll bool `json:"verticalScroll,omitempty"` - HorizontalScroll bool `json:"horizontalScroll,omitempty"` - Monospace bool `json:"monospace,omitempty"` + Key string `json:"key"` + Type string `json:"type"` + Label string `json:"label,omitempty"` + LabelHidden bool `json:"labelHidden"` + Required bool `json:"required,omitempty"` + Placeholder string `json:"placeholder,omitempty"` + Readonly bool `json:"readonly,omitempty"` + Value string `json:"value"` + Validator string `json:"validator,omitempty"` + Items []SelectItem `json:"items,omitempty"` + Lines int `json:"lines,omitempty"` } // GetType returns the type of the field. @@ -62,7 +62,7 @@ type Form struct { Title string `json:"title"` Description string `json:"description"` Fields []FormField `json:"fields"` - ButtonMode string `json:"buttonMode"` + Buttons []string `json:"buttons"` } func (f *Form) ToJSON() string { diff --git a/extension/ui_elements/content.go b/extension/ui/content.go similarity index 97% rename from extension/ui_elements/content.go rename to extension/ui/content.go index ed4e807..d78d045 100644 --- a/extension/ui_elements/content.go +++ b/extension/ui/content.go @@ -1,4 +1,4 @@ -package ui_elements +package ui // // ContentField represents a label with additional properties. // type ContentField struct { diff --git a/extension/ui/data.go b/extension/ui/data.go new file mode 100644 index 0000000..5b1faa2 --- /dev/null +++ b/extension/ui/data.go @@ -0,0 +1 @@ +package ui diff --git a/extension/ui_elements/form.go b/extension/ui/form.go similarity index 99% rename from extension/ui_elements/form.go rename to extension/ui/form.go index ca7b5ae..f07dfc8 100644 --- a/extension/ui_elements/form.go +++ b/extension/ui/form.go @@ -1,4 +1,4 @@ -package ui_elements +package ui // import ( // "encoding/json" diff --git a/go.mod b/go.mod index b345896..5eca1cc 100644 --- a/go.mod +++ b/go.mod @@ -5,9 +5,12 @@ go 1.22.0 toolchain go1.22.3 require ( - github.com/bepass-org/warp-plus v0.0.0-00010101000000-000000000000 + github.com/bepass-org/warp-plus v1.2.4 + github.com/fatih/color v1.16.0 github.com/improbable-eng/grpc-web v0.15.0 + github.com/jellydator/validation v1.1.0 github.com/kardianos/service v1.2.2 + github.com/rodaine/table v1.1.1 github.com/sagernet/gomobile v0.1.3 github.com/sagernet/sing v0.4.2 github.com/sagernet/sing-box v1.8.9 @@ -23,7 +26,11 @@ require ( require ( github.com/cenkalti/backoff/v4 v4.1.1 // indirect github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect + github.com/golang/protobuf v1.5.4 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect github.com/rs/cors v1.7.0 // indirect + gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect nhooyr.io/websocket v1.8.6 // indirect ) @@ -82,7 +89,7 @@ require ( github.com/quic-go/quic-go v0.46.0 // indirect github.com/refraction-networking/utls v1.6.7 // indirect github.com/riobard/go-bloom v0.0.0-20200614022211-cdc8013cb5b3 // indirect - github.com/sagernet/bbolt v0.0.0-20231014093535-ea5cb2fe9f0a // indirect + github.com/sagernet/bbolt v0.0.0-20231014093535-ea5cb2fe9f0a github.com/sagernet/cloudflare-tls v0.0.0-20231208171750-a4483c1b7cd1 // indirect github.com/sagernet/gvisor v0.0.0-20240428053021-e691de28565f // indirect github.com/sagernet/netlink v0.0.0-20240523065131-45e60152f9ba // indirect @@ -115,7 +122,7 @@ require ( golang.org/x/crypto v0.26.0 // indirect golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc // indirect golang.org/x/mod v0.18.0 // indirect - golang.org/x/net v0.28.0 // indirect + golang.org/x/net v0.28.0 golang.org/x/sync v0.8.0 // indirect golang.org/x/text v0.17.0 // indirect golang.org/x/time v0.5.0 // indirect @@ -133,4 +140,4 @@ replace github.com/sagernet/wireguard-go => github.com/hiddify/wireguard-go v0.0 replace github.com/bepass-org/warp-plus => github.com/hiddify/warp-plus v0.0.0-20240717223357-4f3122e0d11d -replace github.com/hiddify/ray2sing => github.com/hiddify/ray2sing v0.0.0-20240807031953-a9df25615108 +replace github.com/hiddify/ray2sing => github.com/hiddify/ray2sing v0.0.0-20240928154308-dd8fc3f6eedb diff --git a/go.sum b/go.sum index 2a9380f..3f62632 100644 --- a/go.sum +++ b/go.sum @@ -35,6 +35,8 @@ github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hC github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= +github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d h1:Byv0BzEl3/e6D5CLfI0j/7hiIEtvGVFPCZ7Ei2oq8iQ= +github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= @@ -90,6 +92,8 @@ github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.m github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= +github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/francoispqt/gojay v1.2.13 h1:d2m3sFjloqoIUQU3TsHBgj6qg/BVGlTBeHDUmyJnXKk= github.com/francoispqt/gojay v1.2.13/go.mod h1:ehT5mTG4ua4581f1++1WLG0vPdaA9HaiDsoyrBGkyDY= @@ -172,8 +176,8 @@ github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvq github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= @@ -235,8 +239,8 @@ github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= github.com/hiddify/hiddify-sing-box v1.8.9-0.20240908122006-6f1809b87260 h1:FmoDhBLHNfbRRON1b5ie8GpXksTJxcBJmgpg2ALZ398= github.com/hiddify/hiddify-sing-box v1.8.9-0.20240908122006-6f1809b87260/go.mod h1:6+uKh2mjUECXVS//CnV8FIHOCHm0q/a+ViRDbmeEokI= -github.com/hiddify/ray2sing v0.0.0-20240807031953-a9df25615108 h1:LuDOjwO9GwKAnxhMADCnQcjBTnEBp6JdsoPisf192Q4= -github.com/hiddify/ray2sing v0.0.0-20240807031953-a9df25615108/go.mod h1:Qp3mFdKsJZ5TwBYLREgWp8n2O6dgmNt3aAoX+xpvnsM= +github.com/hiddify/ray2sing v0.0.0-20240928154308-dd8fc3f6eedb h1:jN/Cn96MkECPcQ2Tg0I7W53UV4p1oj3ehEXdpy/Z3pw= +github.com/hiddify/ray2sing v0.0.0-20240928154308-dd8fc3f6eedb/go.mod h1:Qp3mFdKsJZ5TwBYLREgWp8n2O6dgmNt3aAoX+xpvnsM= github.com/hiddify/warp-plus v0.0.0-20240717223357-4f3122e0d11d h1:vRGKh9ou+/vQGfVYa8MczhbIVjHxlP52OWwrDWO77RA= github.com/hiddify/warp-plus v0.0.0-20240717223357-4f3122e0d11d/go.mod h1:uSRUbr1CcvFrEV69FTvuJFwpzEmwO8N4knb6+Zq3Ys4= github.com/hiddify/wireguard-go v0.0.0-20240727191222-383c1da14ff1 h1:xdbHlZtzs+jijAxy85qal835GglwmjohA/srHT8gm9s= @@ -256,6 +260,8 @@ github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod github.com/insomniacslk/dhcp v0.0.0-20231206064809-8c70d406f6d2 h1:9K06NfxkBh25x56yVhWWlKFE8YpicaSfHwoV8SFbueA= github.com/insomniacslk/dhcp v0.0.0-20231206064809-8c70d406f6d2/go.mod h1:3A9PQ1cunSDF/1rbTq99Ts4pVnycWg+vlPkfeD2NLFI= github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU= +github.com/jellydator/validation v1.1.0 h1:TBkx56y6dd0By2AhtStRdTIhDjtcuoSE9w6G6z7wQ4o= +github.com/jellydator/validation v1.1.0/go.mod h1:AaCjfkQ4Ykdcb+YCwqCtaI3wDsf2UAGhJ06lJs0VgOw= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/josharian/native v1.0.1-0.20221213033349-c1e37c09b531/go.mod h1:7X/raswPFr05uY3HiLlYeyQntB6OO7E/d2Cu7qoaN2w= @@ -287,6 +293,9 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxv github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.3/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= @@ -309,12 +318,17 @@ github.com/lunixbochs/vtclean v1.0.0/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= +github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mholt/acmez v1.2.0 h1:1hhLxSgY5FvH5HCnGUuwbKY2VQVo8IU7rxXKSnZ7F30= github.com/mholt/acmez v1.2.0/go.mod h1:VT9YwH1xgNX1kmYY89gY8xPJC84BFAisjo8Egigt4kE= @@ -348,8 +362,6 @@ github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxzi github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo= github.com/neelance/sourcemap v0.0.0-20151028013722-8c68805598ab/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= @@ -444,8 +456,14 @@ github.com/refraction-networking/utls v1.6.7 h1:zVJ7sP1dJx/WtVuITug3qYUq034cDq9B github.com/refraction-networking/utls v1.6.7/go.mod h1:BC3O4vQzye5hqpmDTWUqi4P5DDhzJfkV1tdqtawQIH0= github.com/riobard/go-bloom v0.0.0-20200614022211-cdc8013cb5b3 h1:f/FNXud6gA3MNr8meMVVGxhp+QBTqY91tM8HjEuMjGg= github.com/riobard/go-bloom v0.0.0-20200614022211-cdc8013cb5b3/go.mod h1:HgjTstvQsPGkxUsCd2KWxErBblirPizecHcpD3ffK+s= +github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= +github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= +github.com/rodaine/table v1.1.1 h1:zBliy3b4Oj6JRmncse2Z85WmoQvDrXOYuy0JXCt8Qz8= +github.com/rodaine/table v1.1.1/go.mod h1:iqTRptjn+EVcrVBYtNMlJ2wrJZa3MpULUmcXFpfcziA= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= @@ -727,6 +745,7 @@ golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220622161953-175b2fd9d664/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -839,8 +858,8 @@ gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLks gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= diff --git a/hiddifyrpc/hiddify.pb.go b/hiddifyrpc/hiddify.pb.go index a3b4116..40fec00 100644 --- a/hiddifyrpc/hiddify.pb.go +++ b/hiddifyrpc/hiddify.pb.go @@ -1212,16 +1212,16 @@ func (x *ParseResponse) GetMessage() string { return "" } -type ChangeHiddifyOptionsRequest struct { +type ChangeHiddifySettingsRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - HiddifyOptionsJson string `protobuf:"bytes,1,opt,name=config_options_json,json=HiddifyOptionsJson,proto3" json:"config_options_json,omitempty"` + HiddifySettingsJson string `protobuf:"bytes,1,opt,name=hiddify_settings_json,json=hiddifySettingsJson,proto3" json:"hiddify_settings_json,omitempty"` } -func (x *ChangeHiddifyOptionsRequest) Reset() { - *x = ChangeHiddifyOptionsRequest{} +func (x *ChangeHiddifySettingsRequest) Reset() { + *x = ChangeHiddifySettingsRequest{} if protoimpl.UnsafeEnabled { mi := &file_hiddify_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1229,13 +1229,13 @@ func (x *ChangeHiddifyOptionsRequest) Reset() { } } -func (x *ChangeHiddifyOptionsRequest) String() string { +func (x *ChangeHiddifySettingsRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ChangeHiddifyOptionsRequest) ProtoMessage() {} +func (*ChangeHiddifySettingsRequest) ProtoMessage() {} -func (x *ChangeHiddifyOptionsRequest) ProtoReflect() protoreflect.Message { +func (x *ChangeHiddifySettingsRequest) ProtoReflect() protoreflect.Message { mi := &file_hiddify_proto_msgTypes[14] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1247,14 +1247,14 @@ func (x *ChangeHiddifyOptionsRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use ChangeHiddifyOptionsRequest.ProtoReflect.Descriptor instead. -func (*ChangeHiddifyOptionsRequest) Descriptor() ([]byte, []int) { +// Deprecated: Use ChangeHiddifySettingsRequest.ProtoReflect.Descriptor instead. +func (*ChangeHiddifySettingsRequest) Descriptor() ([]byte, []int) { return file_hiddify_proto_rawDescGZIP(), []int{14} } -func (x *ChangeHiddifyOptionsRequest) GetHiddifyOptionsJson() string { +func (x *ChangeHiddifySettingsRequest) GetHiddifySettingsJson() string { if x != nil { - return x.HiddifyOptionsJson + return x.HiddifySettingsJson } return "" } @@ -1944,203 +1944,201 @@ var file_hiddify_proto_rawDesc = []byte{ 0x43, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x4c, 0x0a, 0x1a, 0x43, 0x68, 0x61, 0x6e, - 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2e, 0x0a, 0x13, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x5f, 0x6a, 0x73, 0x6f, 0x6e, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x11, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x4f, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x4a, 0x73, 0x6f, 0x6e, 0x22, 0x5e, 0x0a, 0x15, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, - 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, - 0x61, 0x74, 0x68, 0x12, 0x1b, 0x0a, 0x09, 0x74, 0x65, 0x6d, 0x70, 0x5f, 0x70, 0x61, 0x74, 0x68, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x65, 0x6d, 0x70, 0x50, 0x61, 0x74, 0x68, - 0x12, 0x14, 0x0a, 0x05, 0x64, 0x65, 0x62, 0x75, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x05, 0x64, 0x65, 0x62, 0x75, 0x67, 0x22, 0x3f, 0x0a, 0x16, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, - 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, - 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x57, 0x0a, 0x15, 0x53, 0x65, 0x6c, 0x65, 0x63, - 0x74, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x1b, 0x0a, 0x09, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x74, 0x61, 0x67, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x08, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x54, 0x61, 0x67, 0x12, 0x21, 0x0a, - 0x0c, 0x6f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x5f, 0x74, 0x61, 0x67, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x54, 0x61, 0x67, - 0x22, 0x2d, 0x0a, 0x0e, 0x55, 0x72, 0x6c, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x74, 0x61, 0x67, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x54, 0x61, 0x67, 0x22, - 0x7e, 0x0a, 0x19, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x57, 0x61, 0x72, 0x70, 0x43, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x0a, 0x0b, - 0x6c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0a, 0x6c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x4b, 0x65, 0x79, 0x12, 0x1d, 0x0a, - 0x0a, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x09, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x21, 0x0a, 0x0c, - 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0b, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, - 0x3d, 0x0a, 0x1c, 0x53, 0x65, 0x74, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x50, 0x72, 0x6f, 0x78, - 0x79, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x1d, 0x0a, 0x0a, 0x69, 0x73, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x09, 0x69, 0x73, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x22, 0x7b, - 0x0a, 0x0a, 0x4c, 0x6f, 0x67, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x2a, 0x0a, 0x05, - 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x68, 0x69, - 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x6f, 0x67, 0x4c, 0x65, 0x76, 0x65, - 0x6c, 0x52, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x27, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, - 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x6f, 0x67, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, - 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x0d, 0x0a, 0x0b, 0x53, - 0x74, 0x6f, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0xbc, 0x01, 0x0a, 0x12, 0x54, - 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x53, 0x74, 0x61, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x70, 0x76, 0x36, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x04, 0x69, 0x70, 0x76, 0x36, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, - 0x70, 0x6f, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x73, 0x65, 0x72, 0x76, - 0x65, 0x72, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x63, 0x74, - 0x5f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x73, 0x74, - 0x72, 0x69, 0x63, 0x74, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x12, 0x38, 0x0a, 0x18, 0x65, 0x6e, 0x64, - 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, - 0x74, 0x5f, 0x6e, 0x61, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x16, 0x65, 0x6e, 0x64, - 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x49, 0x6e, 0x64, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x74, - 0x4e, 0x61, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x05, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x22, 0x2a, 0x0a, 0x0e, 0x54, 0x75, 0x6e, - 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x2a, 0x41, 0x0a, 0x09, 0x43, 0x6f, 0x72, 0x65, 0x53, 0x74, 0x61, - 0x74, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x54, 0x4f, 0x50, 0x50, 0x45, 0x44, 0x10, 0x00, 0x12, - 0x0c, 0x0a, 0x08, 0x53, 0x54, 0x41, 0x52, 0x54, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x0b, 0x0a, - 0x07, 0x53, 0x54, 0x41, 0x52, 0x54, 0x45, 0x44, 0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x53, 0x54, - 0x4f, 0x50, 0x50, 0x49, 0x4e, 0x47, 0x10, 0x03, 0x2a, 0xcd, 0x02, 0x0a, 0x0b, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x4d, 0x50, 0x54, - 0x59, 0x10, 0x00, 0x12, 0x17, 0x0a, 0x13, 0x45, 0x4d, 0x50, 0x54, 0x59, 0x5f, 0x43, 0x4f, 0x4e, - 0x46, 0x49, 0x47, 0x55, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x01, 0x12, 0x18, 0x0a, 0x14, - 0x53, 0x54, 0x41, 0x52, 0x54, 0x5f, 0x43, 0x4f, 0x4d, 0x4d, 0x41, 0x4e, 0x44, 0x5f, 0x53, 0x45, - 0x52, 0x56, 0x45, 0x52, 0x10, 0x02, 0x12, 0x12, 0x0a, 0x0e, 0x43, 0x52, 0x45, 0x41, 0x54, 0x45, - 0x5f, 0x53, 0x45, 0x52, 0x56, 0x49, 0x43, 0x45, 0x10, 0x03, 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x54, - 0x41, 0x52, 0x54, 0x5f, 0x53, 0x45, 0x52, 0x56, 0x49, 0x43, 0x45, 0x10, 0x04, 0x12, 0x14, 0x0a, - 0x10, 0x55, 0x4e, 0x45, 0x58, 0x50, 0x45, 0x43, 0x54, 0x45, 0x44, 0x5f, 0x45, 0x52, 0x52, 0x4f, - 0x52, 0x10, 0x05, 0x12, 0x13, 0x0a, 0x0f, 0x41, 0x4c, 0x52, 0x45, 0x41, 0x44, 0x59, 0x5f, 0x53, - 0x54, 0x41, 0x52, 0x54, 0x45, 0x44, 0x10, 0x06, 0x12, 0x13, 0x0a, 0x0f, 0x41, 0x4c, 0x52, 0x45, - 0x41, 0x44, 0x59, 0x5f, 0x53, 0x54, 0x4f, 0x50, 0x50, 0x45, 0x44, 0x10, 0x07, 0x12, 0x16, 0x0a, - 0x12, 0x49, 0x4e, 0x53, 0x54, 0x41, 0x4e, 0x43, 0x45, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, - 0x55, 0x4e, 0x44, 0x10, 0x08, 0x12, 0x18, 0x0a, 0x14, 0x49, 0x4e, 0x53, 0x54, 0x41, 0x4e, 0x43, - 0x45, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x53, 0x54, 0x4f, 0x50, 0x50, 0x45, 0x44, 0x10, 0x09, 0x12, - 0x18, 0x0a, 0x14, 0x49, 0x4e, 0x53, 0x54, 0x41, 0x4e, 0x43, 0x45, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, - 0x53, 0x54, 0x41, 0x52, 0x54, 0x45, 0x44, 0x10, 0x0a, 0x12, 0x19, 0x0a, 0x15, 0x45, 0x52, 0x52, - 0x4f, 0x52, 0x5f, 0x42, 0x55, 0x49, 0x4c, 0x44, 0x49, 0x4e, 0x47, 0x5f, 0x43, 0x4f, 0x4e, 0x46, - 0x49, 0x47, 0x10, 0x0b, 0x12, 0x18, 0x0a, 0x14, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x50, 0x41, - 0x52, 0x53, 0x49, 0x4e, 0x47, 0x5f, 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x47, 0x10, 0x0c, 0x12, 0x18, - 0x0a, 0x14, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x52, 0x45, 0x41, 0x44, 0x49, 0x4e, 0x47, 0x5f, - 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x47, 0x10, 0x0d, 0x2a, 0x42, 0x0a, 0x08, 0x4c, 0x6f, 0x67, 0x4c, - 0x65, 0x76, 0x65, 0x6c, 0x12, 0x09, 0x0a, 0x05, 0x44, 0x45, 0x42, 0x55, 0x47, 0x10, 0x00, 0x12, - 0x08, 0x0a, 0x04, 0x49, 0x4e, 0x46, 0x4f, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x57, 0x41, 0x52, - 0x4e, 0x49, 0x4e, 0x47, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, - 0x03, 0x12, 0x09, 0x0a, 0x05, 0x46, 0x41, 0x54, 0x41, 0x4c, 0x10, 0x04, 0x2a, 0x2c, 0x0a, 0x07, - 0x4c, 0x6f, 0x67, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08, 0x0a, 0x04, 0x43, 0x4f, 0x52, 0x45, 0x10, - 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x45, 0x52, 0x56, 0x49, 0x43, 0x45, 0x10, 0x01, 0x12, 0x0a, - 0x0a, 0x06, 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x47, 0x10, 0x02, 0x32, 0x93, 0x01, 0x0a, 0x05, 0x48, - 0x65, 0x6c, 0x6c, 0x6f, 0x12, 0x3f, 0x0a, 0x08, 0x53, 0x61, 0x79, 0x48, 0x65, 0x6c, 0x6c, 0x6f, - 0x12, 0x18, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x48, 0x65, - 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x68, 0x69, 0x64, - 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x49, 0x0a, 0x0e, 0x53, 0x61, 0x79, 0x48, 0x65, 0x6c, 0x6c, - 0x6f, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x18, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, - 0x79, 0x72, 0x70, 0x63, 0x2e, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x19, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x48, - 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x28, 0x01, 0x30, 0x01, - 0x32, 0xe2, 0x09, 0x0a, 0x04, 0x43, 0x6f, 0x72, 0x65, 0x12, 0x3f, 0x0a, 0x05, 0x53, 0x74, 0x61, - 0x72, 0x74, 0x12, 0x18, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, - 0x53, 0x74, 0x61, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x68, - 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x43, 0x6f, 0x72, 0x65, 0x49, 0x6e, - 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4d, 0x0a, 0x10, 0x43, 0x6f, - 0x72, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x65, 0x72, 0x12, 0x17, - 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x74, 0x6f, 0x70, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, + 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x52, 0x0a, 0x1c, 0x43, 0x68, 0x61, 0x6e, + 0x67, 0x65, 0x48, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x32, 0x0a, 0x15, 0x68, 0x69, 0x64, 0x64, + 0x69, 0x66, 0x79, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x5f, 0x6a, 0x73, 0x6f, + 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x13, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, + 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x4a, 0x73, 0x6f, 0x6e, 0x22, 0x5e, 0x0a, 0x15, + 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x1b, 0x0a, 0x09, 0x74, 0x65, 0x6d, + 0x70, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x65, + 0x6d, 0x70, 0x50, 0x61, 0x74, 0x68, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x65, 0x62, 0x75, 0x67, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x64, 0x65, 0x62, 0x75, 0x67, 0x22, 0x3f, 0x0a, 0x16, + 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, + 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x57, 0x0a, + 0x15, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, + 0x74, 0x61, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x67, 0x72, 0x6f, 0x75, 0x70, + 0x54, 0x61, 0x67, 0x12, 0x21, 0x0a, 0x0c, 0x6f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x5f, + 0x74, 0x61, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6f, 0x75, 0x74, 0x62, 0x6f, + 0x75, 0x6e, 0x64, 0x54, 0x61, 0x67, 0x22, 0x2d, 0x0a, 0x0e, 0x55, 0x72, 0x6c, 0x54, 0x65, 0x73, + 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x67, 0x72, 0x6f, 0x75, + 0x70, 0x5f, 0x74, 0x61, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x67, 0x72, 0x6f, + 0x75, 0x70, 0x54, 0x61, 0x67, 0x22, 0x7e, 0x0a, 0x19, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, + 0x65, 0x57, 0x61, 0x72, 0x70, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x6c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x5f, 0x6b, 0x65, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, + 0x4b, 0x65, 0x79, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x69, + 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x49, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x74, 0x6f, 0x6b, + 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, + 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x3d, 0x0a, 0x1c, 0x53, 0x65, 0x74, 0x53, 0x79, 0x73, 0x74, + 0x65, 0x6d, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x69, 0x73, 0x5f, 0x65, 0x6e, 0x61, 0x62, + 0x6c, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x69, 0x73, 0x45, 0x6e, 0x61, + 0x62, 0x6c, 0x65, 0x64, 0x22, 0x7b, 0x0a, 0x0a, 0x4c, 0x6f, 0x67, 0x4d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x12, 0x2a, 0x0a, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0e, 0x32, 0x14, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x4c, + 0x6f, 0x67, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x52, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x27, + 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x68, + 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x6f, 0x67, 0x54, 0x79, 0x70, + 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x22, 0x0d, 0x0a, 0x0b, 0x53, 0x74, 0x6f, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x22, 0xbc, 0x01, 0x0a, 0x12, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x53, 0x74, 0x61, 0x72, 0x74, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x70, 0x76, 0x36, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x70, 0x76, 0x36, 0x12, 0x1f, 0x0a, 0x0b, 0x73, + 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x0a, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x21, 0x0a, 0x0c, + 0x73, 0x74, 0x72, 0x69, 0x63, 0x74, 0x5f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x63, 0x74, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x12, + 0x38, 0x0a, 0x18, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x5f, 0x69, 0x6e, 0x64, 0x65, + 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x74, 0x5f, 0x6e, 0x61, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x16, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x49, 0x6e, 0x64, 0x65, 0x70, + 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x74, 0x4e, 0x61, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, + 0x63, 0x6b, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x22, + 0x2a, 0x0a, 0x0e, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2a, 0x41, 0x0a, 0x09, 0x43, + 0x6f, 0x72, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x54, 0x4f, 0x50, + 0x50, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x53, 0x54, 0x41, 0x52, 0x54, 0x49, 0x4e, + 0x47, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x54, 0x41, 0x52, 0x54, 0x45, 0x44, 0x10, 0x02, + 0x12, 0x0c, 0x0a, 0x08, 0x53, 0x54, 0x4f, 0x50, 0x50, 0x49, 0x4e, 0x47, 0x10, 0x03, 0x2a, 0xcd, + 0x02, 0x0a, 0x0b, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x09, + 0x0a, 0x05, 0x45, 0x4d, 0x50, 0x54, 0x59, 0x10, 0x00, 0x12, 0x17, 0x0a, 0x13, 0x45, 0x4d, 0x50, + 0x54, 0x59, 0x5f, 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x47, 0x55, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, + 0x10, 0x01, 0x12, 0x18, 0x0a, 0x14, 0x53, 0x54, 0x41, 0x52, 0x54, 0x5f, 0x43, 0x4f, 0x4d, 0x4d, + 0x41, 0x4e, 0x44, 0x5f, 0x53, 0x45, 0x52, 0x56, 0x45, 0x52, 0x10, 0x02, 0x12, 0x12, 0x0a, 0x0e, + 0x43, 0x52, 0x45, 0x41, 0x54, 0x45, 0x5f, 0x53, 0x45, 0x52, 0x56, 0x49, 0x43, 0x45, 0x10, 0x03, + 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x54, 0x41, 0x52, 0x54, 0x5f, 0x53, 0x45, 0x52, 0x56, 0x49, 0x43, + 0x45, 0x10, 0x04, 0x12, 0x14, 0x0a, 0x10, 0x55, 0x4e, 0x45, 0x58, 0x50, 0x45, 0x43, 0x54, 0x45, + 0x44, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x05, 0x12, 0x13, 0x0a, 0x0f, 0x41, 0x4c, 0x52, + 0x45, 0x41, 0x44, 0x59, 0x5f, 0x53, 0x54, 0x41, 0x52, 0x54, 0x45, 0x44, 0x10, 0x06, 0x12, 0x13, + 0x0a, 0x0f, 0x41, 0x4c, 0x52, 0x45, 0x41, 0x44, 0x59, 0x5f, 0x53, 0x54, 0x4f, 0x50, 0x50, 0x45, + 0x44, 0x10, 0x07, 0x12, 0x16, 0x0a, 0x12, 0x49, 0x4e, 0x53, 0x54, 0x41, 0x4e, 0x43, 0x45, 0x5f, + 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, 0x08, 0x12, 0x18, 0x0a, 0x14, 0x49, + 0x4e, 0x53, 0x54, 0x41, 0x4e, 0x43, 0x45, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x53, 0x54, 0x4f, 0x50, + 0x50, 0x45, 0x44, 0x10, 0x09, 0x12, 0x18, 0x0a, 0x14, 0x49, 0x4e, 0x53, 0x54, 0x41, 0x4e, 0x43, + 0x45, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x53, 0x54, 0x41, 0x52, 0x54, 0x45, 0x44, 0x10, 0x0a, 0x12, + 0x19, 0x0a, 0x15, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x42, 0x55, 0x49, 0x4c, 0x44, 0x49, 0x4e, + 0x47, 0x5f, 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x47, 0x10, 0x0b, 0x12, 0x18, 0x0a, 0x14, 0x45, 0x52, + 0x52, 0x4f, 0x52, 0x5f, 0x50, 0x41, 0x52, 0x53, 0x49, 0x4e, 0x47, 0x5f, 0x43, 0x4f, 0x4e, 0x46, + 0x49, 0x47, 0x10, 0x0c, 0x12, 0x18, 0x0a, 0x14, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x52, 0x45, + 0x41, 0x44, 0x49, 0x4e, 0x47, 0x5f, 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x47, 0x10, 0x0d, 0x2a, 0x42, + 0x0a, 0x08, 0x4c, 0x6f, 0x67, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x09, 0x0a, 0x05, 0x44, 0x45, + 0x42, 0x55, 0x47, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x49, 0x4e, 0x46, 0x4f, 0x10, 0x01, 0x12, + 0x0b, 0x0a, 0x07, 0x57, 0x41, 0x52, 0x4e, 0x49, 0x4e, 0x47, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, + 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x03, 0x12, 0x09, 0x0a, 0x05, 0x46, 0x41, 0x54, 0x41, 0x4c, + 0x10, 0x04, 0x2a, 0x2c, 0x0a, 0x07, 0x4c, 0x6f, 0x67, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08, 0x0a, + 0x04, 0x43, 0x4f, 0x52, 0x45, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x45, 0x52, 0x56, 0x49, + 0x43, 0x45, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x47, 0x10, 0x02, + 0x32, 0x93, 0x01, 0x0a, 0x05, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x12, 0x3f, 0x0a, 0x08, 0x53, 0x61, + 0x79, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x12, 0x18, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, + 0x72, 0x70, 0x63, 0x2e, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x19, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x48, 0x65, + 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x49, 0x0a, 0x0e, 0x53, + 0x61, 0x79, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x18, 0x2e, + 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x48, 0x65, 0x6c, 0x6c, 0x6f, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, + 0x79, 0x72, 0x70, 0x63, 0x2e, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x28, 0x01, 0x30, 0x01, 0x32, 0xbe, 0x09, 0x0a, 0x04, 0x43, 0x6f, 0x72, 0x65, 0x12, + 0x3f, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x72, 0x74, 0x12, 0x18, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, + 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, + 0x43, 0x6f, 0x72, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x45, 0x0a, 0x10, 0x43, 0x6f, 0x72, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x4c, 0x69, 0x73, 0x74, + 0x65, 0x6e, 0x65, 0x72, 0x12, 0x11, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, + 0x63, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1c, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x43, 0x6f, 0x72, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x28, 0x01, 0x30, 0x01, 0x12, 0x4b, 0x0a, 0x0d, 0x4f, 0x75, 0x74, - 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x73, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x17, 0x2e, 0x68, 0x69, 0x64, - 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x74, 0x6f, 0x70, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, - 0x2e, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4c, 0x69, - 0x73, 0x74, 0x28, 0x01, 0x30, 0x01, 0x12, 0x4f, 0x0a, 0x11, 0x4d, 0x61, 0x69, 0x6e, 0x4f, 0x75, - 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x73, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x17, 0x2e, 0x68, 0x69, - 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x74, 0x6f, 0x70, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x43, 0x0a, 0x0d, 0x4f, 0x75, 0x74, 0x62, 0x6f, + 0x75, 0x6e, 0x64, 0x73, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x11, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, + 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1d, 0x2e, 0x68, 0x69, + 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, + 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4c, 0x69, 0x73, 0x74, 0x30, 0x01, 0x12, 0x47, 0x0a, 0x11, + 0x4d, 0x61, 0x69, 0x6e, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x73, 0x49, 0x6e, 0x66, + 0x6f, 0x12, 0x11, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x45, + 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1d, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4c, - 0x69, 0x73, 0x74, 0x28, 0x01, 0x30, 0x01, 0x12, 0x44, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x53, 0x79, - 0x73, 0x74, 0x65, 0x6d, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x17, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, - 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x74, 0x6f, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x16, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x53, - 0x79, 0x73, 0x74, 0x65, 0x6d, 0x49, 0x6e, 0x66, 0x6f, 0x28, 0x01, 0x30, 0x01, 0x12, 0x37, 0x0a, - 0x05, 0x53, 0x65, 0x74, 0x75, 0x70, 0x12, 0x18, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, - 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x74, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x14, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3c, 0x0a, 0x05, 0x50, 0x61, 0x72, 0x73, 0x65, 0x12, - 0x18, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x50, 0x61, 0x72, - 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x68, 0x69, 0x64, 0x64, - 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x50, 0x61, 0x72, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5b, 0x0a, 0x13, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x43, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x26, 0x2e, 0x68, 0x69, - 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x43, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, - 0x2e, 0x43, 0x6f, 0x72, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x46, 0x0a, 0x0c, 0x53, 0x74, 0x61, 0x72, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x12, 0x18, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x53, - 0x74, 0x61, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x68, 0x69, - 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x43, 0x6f, 0x72, 0x65, 0x49, 0x6e, 0x66, - 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, 0x04, 0x53, 0x74, 0x6f, - 0x70, 0x12, 0x11, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x45, - 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1c, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, - 0x63, 0x2e, 0x43, 0x6f, 0x72, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x41, 0x0a, 0x07, 0x52, 0x65, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x18, 0x2e, - 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x74, 0x61, 0x72, 0x74, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, - 0x79, 0x72, 0x70, 0x63, 0x2e, 0x43, 0x6f, 0x72, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x49, 0x0a, 0x0e, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x4f, - 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x12, 0x21, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, - 0x79, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x4f, 0x75, 0x74, 0x62, 0x6f, - 0x75, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x68, 0x69, 0x64, - 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x3b, 0x0a, 0x07, 0x55, 0x72, 0x6c, 0x54, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x2e, 0x68, 0x69, - 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x55, 0x72, 0x6c, 0x54, 0x65, 0x73, 0x74, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, - 0x79, 0x72, 0x70, 0x63, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5f, 0x0a, - 0x12, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x57, 0x61, 0x72, 0x70, 0x43, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x12, 0x25, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, - 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x57, 0x61, 0x72, 0x70, 0x43, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x68, 0x69, 0x64, - 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x57, 0x61, 0x72, 0x70, 0x47, 0x65, 0x6e, 0x65, - 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x48, - 0x0a, 0x14, 0x47, 0x65, 0x74, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x50, 0x72, 0x6f, 0x78, 0x79, - 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x11, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, - 0x72, 0x70, 0x63, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1d, 0x2e, 0x68, 0x69, 0x64, 0x64, - 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x50, 0x72, 0x6f, - 0x78, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x57, 0x0a, 0x15, 0x53, 0x65, 0x74, 0x53, - 0x79, 0x73, 0x74, 0x65, 0x6d, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, - 0x64, 0x12, 0x28, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x53, - 0x65, 0x74, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x45, 0x6e, 0x61, - 0x62, 0x6c, 0x65, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x68, 0x69, - 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x42, 0x0a, 0x0b, 0x4c, 0x6f, 0x67, 0x4c, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x65, 0x72, - 0x12, 0x17, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x74, - 0x6f, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x68, 0x69, 0x64, 0x64, - 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x6f, 0x67, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x28, 0x01, 0x30, 0x01, 0x32, 0xfb, 0x01, 0x0a, 0x0d, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x43, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x72, 0x74, - 0x12, 0x1e, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x54, 0x75, - 0x6e, 0x6e, 0x65, 0x6c, 0x53, 0x74, 0x61, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x1a, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x54, 0x75, - 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x35, 0x0a, 0x04, - 0x53, 0x74, 0x6f, 0x70, 0x12, 0x11, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, - 0x63, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1a, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, - 0x79, 0x72, 0x70, 0x63, 0x2e, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x11, 0x2e, - 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, - 0x1a, 0x1a, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x54, 0x75, - 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x35, 0x0a, 0x04, - 0x45, 0x78, 0x69, 0x74, 0x12, 0x11, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, - 0x63, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1a, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, - 0x79, 0x72, 0x70, 0x63, 0x2e, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x42, 0x0e, 0x5a, 0x0c, 0x2e, 0x2f, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, - 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x69, 0x73, 0x74, 0x30, 0x01, 0x12, 0x3c, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x53, 0x79, 0x73, 0x74, + 0x65, 0x6d, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x11, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, + 0x72, 0x70, 0x63, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x16, 0x2e, 0x68, 0x69, 0x64, 0x64, + 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x49, 0x6e, 0x66, + 0x6f, 0x30, 0x01, 0x12, 0x37, 0x0a, 0x05, 0x53, 0x65, 0x74, 0x75, 0x70, 0x12, 0x18, 0x2e, 0x68, + 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x74, 0x75, 0x70, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, + 0x72, 0x70, 0x63, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3c, 0x0a, 0x05, + 0x50, 0x61, 0x72, 0x73, 0x65, 0x12, 0x18, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, + 0x70, 0x63, 0x2e, 0x50, 0x61, 0x72, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x19, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x50, 0x61, 0x72, + 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5f, 0x0a, 0x15, 0x43, 0x68, + 0x61, 0x6e, 0x67, 0x65, 0x48, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x53, 0x65, 0x74, 0x74, 0x69, + 0x6e, 0x67, 0x73, 0x12, 0x28, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, + 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x53, 0x65, + 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, + 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x43, 0x6f, 0x72, 0x65, 0x49, + 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x46, 0x0a, 0x0c, 0x53, + 0x74, 0x61, 0x72, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x18, 0x2e, 0x68, 0x69, + 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, + 0x70, 0x63, 0x2e, 0x43, 0x6f, 0x72, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, 0x04, 0x53, 0x74, 0x6f, 0x70, 0x12, 0x11, 0x2e, 0x68, 0x69, + 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1c, + 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x43, 0x6f, 0x72, 0x65, + 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, 0x07, + 0x52, 0x65, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x18, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, + 0x79, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x1c, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x43, + 0x6f, 0x72, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x49, 0x0a, 0x0e, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, + 0x64, 0x12, 0x21, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x53, + 0x65, 0x6c, 0x65, 0x63, 0x74, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, + 0x63, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x07, 0x55, 0x72, + 0x6c, 0x54, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, + 0x70, 0x63, 0x2e, 0x55, 0x72, 0x6c, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x14, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5f, 0x0a, 0x12, 0x47, 0x65, 0x6e, 0x65, 0x72, + 0x61, 0x74, 0x65, 0x57, 0x61, 0x72, 0x70, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x25, 0x2e, + 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, + 0x61, 0x74, 0x65, 0x57, 0x61, 0x72, 0x70, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, + 0x63, 0x2e, 0x57, 0x61, 0x72, 0x70, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x48, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x53, + 0x79, 0x73, 0x74, 0x65, 0x6d, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x12, 0x11, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x45, 0x6d, + 0x70, 0x74, 0x79, 0x1a, 0x1d, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, + 0x2e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x53, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x12, 0x57, 0x0a, 0x15, 0x53, 0x65, 0x74, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x50, + 0x72, 0x6f, 0x78, 0x79, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x28, 0x2e, 0x68, 0x69, + 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x74, 0x53, 0x79, 0x73, 0x74, + 0x65, 0x6d, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, + 0x70, 0x63, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3a, 0x0a, 0x0b, 0x4c, + 0x6f, 0x67, 0x4c, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x65, 0x72, 0x12, 0x11, 0x2e, 0x68, 0x69, 0x64, + 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x16, 0x2e, + 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x6f, 0x67, 0x4d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x30, 0x01, 0x32, 0xfb, 0x01, 0x0a, 0x0d, 0x54, 0x75, 0x6e, 0x6e, + 0x65, 0x6c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x43, 0x0a, 0x05, 0x53, 0x74, 0x61, + 0x72, 0x74, 0x12, 0x1e, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, + 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x53, 0x74, 0x61, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, + 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x35, + 0x0a, 0x04, 0x53, 0x74, 0x6f, 0x70, 0x12, 0x11, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, + 0x72, 0x70, 0x63, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1a, 0x2e, 0x68, 0x69, 0x64, 0x64, + 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, + 0x11, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x45, 0x6d, 0x70, + 0x74, 0x79, 0x1a, 0x1a, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, + 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x35, + 0x0a, 0x04, 0x45, 0x78, 0x69, 0x74, 0x12, 0x11, 0x2e, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, + 0x72, 0x70, 0x63, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1a, 0x2e, 0x68, 0x69, 0x64, 0x64, + 0x69, 0x66, 0x79, 0x72, 0x70, 0x63, 0x2e, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x0e, 0x5a, 0x0c, 0x2e, 0x2f, 0x68, 0x69, 0x64, 0x64, 0x69, + 0x66, 0x79, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -2176,7 +2174,7 @@ var file_hiddify_proto_goTypes = []any{ (*SystemProxyStatus)(nil), // 15: hiddifyrpc.SystemProxyStatus (*ParseRequest)(nil), // 16: hiddifyrpc.ParseRequest (*ParseResponse)(nil), // 17: hiddifyrpc.ParseResponse - (*ChangeHiddifyOptionsRequest)(nil), // 18: hiddifyrpc.ChangeHiddifyOptionsRequest + (*ChangeHiddifySettingsRequest)(nil), // 18: hiddifyrpc.ChangeHiddifySettingsRequest (*GenerateConfigRequest)(nil), // 19: hiddifyrpc.GenerateConfigRequest (*GenerateConfigResponse)(nil), // 20: hiddifyrpc.GenerateConfigResponse (*SelectOutboundRequest)(nil), // 21: hiddifyrpc.SelectOutboundRequest @@ -2206,13 +2204,13 @@ var file_hiddify_proto_depIdxs = []int32{ 30, // 10: hiddifyrpc.Hello.SayHello:input_type -> hiddifyrpc.HelloRequest 30, // 11: hiddifyrpc.Hello.SayHelloStream:input_type -> hiddifyrpc.HelloRequest 5, // 12: hiddifyrpc.Core.Start:input_type -> hiddifyrpc.StartRequest - 26, // 13: hiddifyrpc.Core.CoreInfoListener:input_type -> hiddifyrpc.StopRequest - 26, // 14: hiddifyrpc.Core.OutboundsInfo:input_type -> hiddifyrpc.StopRequest - 26, // 15: hiddifyrpc.Core.MainOutboundsInfo:input_type -> hiddifyrpc.StopRequest - 26, // 16: hiddifyrpc.Core.GetSystemInfo:input_type -> hiddifyrpc.StopRequest + 31, // 13: hiddifyrpc.Core.CoreInfoListener:input_type -> hiddifyrpc.Empty + 31, // 14: hiddifyrpc.Core.OutboundsInfo:input_type -> hiddifyrpc.Empty + 31, // 15: hiddifyrpc.Core.MainOutboundsInfo:input_type -> hiddifyrpc.Empty + 31, // 16: hiddifyrpc.Core.GetSystemInfo:input_type -> hiddifyrpc.Empty 6, // 17: hiddifyrpc.Core.Setup:input_type -> hiddifyrpc.SetupRequest 16, // 18: hiddifyrpc.Core.Parse:input_type -> hiddifyrpc.ParseRequest - 18, // 19: hiddifyrpc.Core.ChangeHiddifyOptions:input_type -> hiddifyrpc.ChangeHiddifyOptionsRequest + 18, // 19: hiddifyrpc.Core.ChangeHiddifySettings:input_type -> hiddifyrpc.ChangeHiddifySettingsRequest 5, // 20: hiddifyrpc.Core.StartService:input_type -> hiddifyrpc.StartRequest 31, // 21: hiddifyrpc.Core.Stop:input_type -> hiddifyrpc.Empty 5, // 22: hiddifyrpc.Core.Restart:input_type -> hiddifyrpc.StartRequest @@ -2221,7 +2219,7 @@ var file_hiddify_proto_depIdxs = []int32{ 23, // 25: hiddifyrpc.Core.GenerateWarpConfig:input_type -> hiddifyrpc.GenerateWarpConfigRequest 31, // 26: hiddifyrpc.Core.GetSystemProxyStatus:input_type -> hiddifyrpc.Empty 24, // 27: hiddifyrpc.Core.SetSystemProxyEnabled:input_type -> hiddifyrpc.SetSystemProxyEnabledRequest - 26, // 28: hiddifyrpc.Core.LogListener:input_type -> hiddifyrpc.StopRequest + 31, // 28: hiddifyrpc.Core.LogListener:input_type -> hiddifyrpc.Empty 27, // 29: hiddifyrpc.TunnelService.Start:input_type -> hiddifyrpc.TunnelStartRequest 31, // 30: hiddifyrpc.TunnelService.Stop:input_type -> hiddifyrpc.Empty 31, // 31: hiddifyrpc.TunnelService.Status:input_type -> hiddifyrpc.Empty @@ -2235,7 +2233,7 @@ var file_hiddify_proto_depIdxs = []int32{ 8, // 39: hiddifyrpc.Core.GetSystemInfo:output_type -> hiddifyrpc.SystemInfo 7, // 40: hiddifyrpc.Core.Setup:output_type -> hiddifyrpc.Response 17, // 41: hiddifyrpc.Core.Parse:output_type -> hiddifyrpc.ParseResponse - 4, // 42: hiddifyrpc.Core.ChangeHiddifyOptions:output_type -> hiddifyrpc.CoreInfoResponse + 4, // 42: hiddifyrpc.Core.ChangeHiddifySettings:output_type -> hiddifyrpc.CoreInfoResponse 4, // 43: hiddifyrpc.Core.StartService:output_type -> hiddifyrpc.CoreInfoResponse 4, // 44: hiddifyrpc.Core.Stop:output_type -> hiddifyrpc.CoreInfoResponse 4, // 45: hiddifyrpc.Core.Restart:output_type -> hiddifyrpc.CoreInfoResponse @@ -2432,7 +2430,7 @@ func file_hiddify_proto_init() { } } file_hiddify_proto_msgTypes[14].Exporter = func(v any, i int) any { - switch v := v.(*ChangeHiddifyOptionsRequest); i { + switch v := v.(*ChangeHiddifySettingsRequest); i { case 0: return &v.state case 1: diff --git a/hiddifyrpc/hiddify.proto b/hiddifyrpc/hiddify.proto index b4fc98f..36a8ae2 100644 --- a/hiddifyrpc/hiddify.proto +++ b/hiddifyrpc/hiddify.proto @@ -123,8 +123,8 @@ message ParseResponse { string message = 3; } -message ChangeConfigOptionsRequest { - string config_options_json = 1; +message ChangeHiddifySettingsRequest { + string hiddify_settings_json = 1; } message GenerateConfigRequest { @@ -200,13 +200,13 @@ service Hello { } service Core { rpc Start (StartRequest) returns (CoreInfoResponse); - rpc CoreInfoListener (stream StopRequest) returns (stream CoreInfoResponse); - rpc OutboundsInfo (stream StopRequest) returns (stream OutboundGroupList); - rpc MainOutboundsInfo (stream StopRequest) returns (stream OutboundGroupList); - rpc GetSystemInfo (stream StopRequest) returns (stream SystemInfo); + rpc CoreInfoListener (Empty) returns (stream CoreInfoResponse); + rpc OutboundsInfo (Empty) returns (stream OutboundGroupList); + rpc MainOutboundsInfo (Empty) returns (stream OutboundGroupList); + rpc GetSystemInfo (Empty) returns (stream SystemInfo); rpc Setup (SetupRequest) returns (Response); rpc Parse (ParseRequest) returns (ParseResponse); - rpc ChangeConfigOptions (ChangeConfigOptionsRequest) returns (CoreInfoResponse); + rpc ChangeHiddifySettings (ChangeHiddifySettingsRequest) returns (CoreInfoResponse); //rpc GenerateConfig (GenerateConfigRequest) returns (GenerateConfigResponse); rpc StartService (StartRequest) returns (CoreInfoResponse); rpc Stop (Empty) returns (CoreInfoResponse); @@ -216,7 +216,7 @@ service Core { rpc GenerateWarpConfig (GenerateWarpConfigRequest) returns (WarpGenerationResponse); rpc GetSystemProxyStatus (Empty) returns (SystemProxyStatus); rpc SetSystemProxyEnabled (SetSystemProxyEnabledRequest) returns (Response); - rpc LogListener (stream StopRequest) returns (stream LogMessage); + rpc LogListener (Empty) returns (stream LogMessage); } diff --git a/hiddifyrpc/hiddify_grpc.pb.go b/hiddifyrpc/hiddify_grpc.pb.go index 2b7e7d7..21e6fd2 100644 --- a/hiddifyrpc/hiddify_grpc.pb.go +++ b/hiddifyrpc/hiddify_grpc.pb.go @@ -161,7 +161,7 @@ const ( Core_GetSystemInfo_FullMethodName = "/hiddifyrpc.Core/GetSystemInfo" Core_Setup_FullMethodName = "/hiddifyrpc.Core/Setup" Core_Parse_FullMethodName = "/hiddifyrpc.Core/Parse" - Core_ChangeHiddifyOptions_FullMethodName = "/hiddifyrpc.Core/ChangeHiddifyOptions" + Core_ChangeHiddifySettings_FullMethodName = "/hiddifyrpc.Core/ChangeHiddifySettings" Core_StartService_FullMethodName = "/hiddifyrpc.Core/StartService" Core_Stop_FullMethodName = "/hiddifyrpc.Core/Stop" Core_Restart_FullMethodName = "/hiddifyrpc.Core/Restart" @@ -178,13 +178,13 @@ const ( // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type CoreClient interface { Start(ctx context.Context, in *StartRequest, opts ...grpc.CallOption) (*CoreInfoResponse, error) - CoreInfoListener(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[StopRequest, CoreInfoResponse], error) - OutboundsInfo(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[StopRequest, OutboundGroupList], error) - MainOutboundsInfo(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[StopRequest, OutboundGroupList], error) - GetSystemInfo(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[StopRequest, SystemInfo], error) + CoreInfoListener(ctx context.Context, in *Empty, opts ...grpc.CallOption) (grpc.ServerStreamingClient[CoreInfoResponse], error) + OutboundsInfo(ctx context.Context, in *Empty, opts ...grpc.CallOption) (grpc.ServerStreamingClient[OutboundGroupList], error) + MainOutboundsInfo(ctx context.Context, in *Empty, opts ...grpc.CallOption) (grpc.ServerStreamingClient[OutboundGroupList], error) + GetSystemInfo(ctx context.Context, in *Empty, opts ...grpc.CallOption) (grpc.ServerStreamingClient[SystemInfo], error) Setup(ctx context.Context, in *SetupRequest, opts ...grpc.CallOption) (*Response, error) Parse(ctx context.Context, in *ParseRequest, opts ...grpc.CallOption) (*ParseResponse, error) - ChangeHiddifyOptions(ctx context.Context, in *ChangeHiddifyOptionsRequest, opts ...grpc.CallOption) (*CoreInfoResponse, error) + ChangeHiddifySettings(ctx context.Context, in *ChangeHiddifySettingsRequest, opts ...grpc.CallOption) (*CoreInfoResponse, error) //rpc GenerateConfig (GenerateConfigRequest) returns (GenerateConfigResponse); StartService(ctx context.Context, in *StartRequest, opts ...grpc.CallOption) (*CoreInfoResponse, error) Stop(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*CoreInfoResponse, error) @@ -194,7 +194,7 @@ type CoreClient interface { GenerateWarpConfig(ctx context.Context, in *GenerateWarpConfigRequest, opts ...grpc.CallOption) (*WarpGenerationResponse, error) GetSystemProxyStatus(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*SystemProxyStatus, error) SetSystemProxyEnabled(ctx context.Context, in *SetSystemProxyEnabledRequest, opts ...grpc.CallOption) (*Response, error) - LogListener(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[StopRequest, LogMessage], error) + LogListener(ctx context.Context, in *Empty, opts ...grpc.CallOption) (grpc.ServerStreamingClient[LogMessage], error) } type coreClient struct { @@ -215,57 +215,81 @@ func (c *coreClient) Start(ctx context.Context, in *StartRequest, opts ...grpc.C return out, nil } -func (c *coreClient) CoreInfoListener(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[StopRequest, CoreInfoResponse], error) { +func (c *coreClient) CoreInfoListener(ctx context.Context, in *Empty, opts ...grpc.CallOption) (grpc.ServerStreamingClient[CoreInfoResponse], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &Core_ServiceDesc.Streams[0], Core_CoreInfoListener_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &grpc.GenericClientStream[StopRequest, CoreInfoResponse]{ClientStream: stream} + x := &grpc.GenericClientStream[Empty, CoreInfoResponse]{ClientStream: stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } return x, nil } // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type Core_CoreInfoListenerClient = grpc.BidiStreamingClient[StopRequest, CoreInfoResponse] +type Core_CoreInfoListenerClient = grpc.ServerStreamingClient[CoreInfoResponse] -func (c *coreClient) OutboundsInfo(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[StopRequest, OutboundGroupList], error) { +func (c *coreClient) OutboundsInfo(ctx context.Context, in *Empty, opts ...grpc.CallOption) (grpc.ServerStreamingClient[OutboundGroupList], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &Core_ServiceDesc.Streams[1], Core_OutboundsInfo_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &grpc.GenericClientStream[StopRequest, OutboundGroupList]{ClientStream: stream} + x := &grpc.GenericClientStream[Empty, OutboundGroupList]{ClientStream: stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } return x, nil } // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type Core_OutboundsInfoClient = grpc.BidiStreamingClient[StopRequest, OutboundGroupList] +type Core_OutboundsInfoClient = grpc.ServerStreamingClient[OutboundGroupList] -func (c *coreClient) MainOutboundsInfo(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[StopRequest, OutboundGroupList], error) { +func (c *coreClient) MainOutboundsInfo(ctx context.Context, in *Empty, opts ...grpc.CallOption) (grpc.ServerStreamingClient[OutboundGroupList], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &Core_ServiceDesc.Streams[2], Core_MainOutboundsInfo_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &grpc.GenericClientStream[StopRequest, OutboundGroupList]{ClientStream: stream} + x := &grpc.GenericClientStream[Empty, OutboundGroupList]{ClientStream: stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } return x, nil } // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type Core_MainOutboundsInfoClient = grpc.BidiStreamingClient[StopRequest, OutboundGroupList] +type Core_MainOutboundsInfoClient = grpc.ServerStreamingClient[OutboundGroupList] -func (c *coreClient) GetSystemInfo(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[StopRequest, SystemInfo], error) { +func (c *coreClient) GetSystemInfo(ctx context.Context, in *Empty, opts ...grpc.CallOption) (grpc.ServerStreamingClient[SystemInfo], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &Core_ServiceDesc.Streams[3], Core_GetSystemInfo_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &grpc.GenericClientStream[StopRequest, SystemInfo]{ClientStream: stream} + x := &grpc.GenericClientStream[Empty, SystemInfo]{ClientStream: stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } return x, nil } // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type Core_GetSystemInfoClient = grpc.BidiStreamingClient[StopRequest, SystemInfo] +type Core_GetSystemInfoClient = grpc.ServerStreamingClient[SystemInfo] func (c *coreClient) Setup(ctx context.Context, in *SetupRequest, opts ...grpc.CallOption) (*Response, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) @@ -287,10 +311,10 @@ func (c *coreClient) Parse(ctx context.Context, in *ParseRequest, opts ...grpc.C return out, nil } -func (c *coreClient) ChangeHiddifyOptions(ctx context.Context, in *ChangeHiddifyOptionsRequest, opts ...grpc.CallOption) (*CoreInfoResponse, error) { +func (c *coreClient) ChangeHiddifySettings(ctx context.Context, in *ChangeHiddifySettingsRequest, opts ...grpc.CallOption) (*CoreInfoResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(CoreInfoResponse) - err := c.cc.Invoke(ctx, Core_ChangeHiddifyOptions_FullMethodName, in, out, cOpts...) + err := c.cc.Invoke(ctx, Core_ChangeHiddifySettings_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -377,31 +401,37 @@ func (c *coreClient) SetSystemProxyEnabled(ctx context.Context, in *SetSystemPro return out, nil } -func (c *coreClient) LogListener(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[StopRequest, LogMessage], error) { +func (c *coreClient) LogListener(ctx context.Context, in *Empty, opts ...grpc.CallOption) (grpc.ServerStreamingClient[LogMessage], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &Core_ServiceDesc.Streams[4], Core_LogListener_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &grpc.GenericClientStream[StopRequest, LogMessage]{ClientStream: stream} + x := &grpc.GenericClientStream[Empty, LogMessage]{ClientStream: stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } return x, nil } // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type Core_LogListenerClient = grpc.BidiStreamingClient[StopRequest, LogMessage] +type Core_LogListenerClient = grpc.ServerStreamingClient[LogMessage] // CoreServer is the server API for Core service. // All implementations must embed UnimplementedCoreServer // for forward compatibility. type CoreServer interface { Start(context.Context, *StartRequest) (*CoreInfoResponse, error) - CoreInfoListener(grpc.BidiStreamingServer[StopRequest, CoreInfoResponse]) error - OutboundsInfo(grpc.BidiStreamingServer[StopRequest, OutboundGroupList]) error - MainOutboundsInfo(grpc.BidiStreamingServer[StopRequest, OutboundGroupList]) error - GetSystemInfo(grpc.BidiStreamingServer[StopRequest, SystemInfo]) error + CoreInfoListener(*Empty, grpc.ServerStreamingServer[CoreInfoResponse]) error + OutboundsInfo(*Empty, grpc.ServerStreamingServer[OutboundGroupList]) error + MainOutboundsInfo(*Empty, grpc.ServerStreamingServer[OutboundGroupList]) error + GetSystemInfo(*Empty, grpc.ServerStreamingServer[SystemInfo]) error Setup(context.Context, *SetupRequest) (*Response, error) Parse(context.Context, *ParseRequest) (*ParseResponse, error) - ChangeHiddifyOptions(context.Context, *ChangeHiddifyOptionsRequest) (*CoreInfoResponse, error) + ChangeHiddifySettings(context.Context, *ChangeHiddifySettingsRequest) (*CoreInfoResponse, error) //rpc GenerateConfig (GenerateConfigRequest) returns (GenerateConfigResponse); StartService(context.Context, *StartRequest) (*CoreInfoResponse, error) Stop(context.Context, *Empty) (*CoreInfoResponse, error) @@ -411,7 +441,7 @@ type CoreServer interface { GenerateWarpConfig(context.Context, *GenerateWarpConfigRequest) (*WarpGenerationResponse, error) GetSystemProxyStatus(context.Context, *Empty) (*SystemProxyStatus, error) SetSystemProxyEnabled(context.Context, *SetSystemProxyEnabledRequest) (*Response, error) - LogListener(grpc.BidiStreamingServer[StopRequest, LogMessage]) error + LogListener(*Empty, grpc.ServerStreamingServer[LogMessage]) error mustEmbedUnimplementedCoreServer() } @@ -425,16 +455,16 @@ type UnimplementedCoreServer struct{} func (UnimplementedCoreServer) Start(context.Context, *StartRequest) (*CoreInfoResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Start not implemented") } -func (UnimplementedCoreServer) CoreInfoListener(grpc.BidiStreamingServer[StopRequest, CoreInfoResponse]) error { +func (UnimplementedCoreServer) CoreInfoListener(*Empty, grpc.ServerStreamingServer[CoreInfoResponse]) error { return status.Errorf(codes.Unimplemented, "method CoreInfoListener not implemented") } -func (UnimplementedCoreServer) OutboundsInfo(grpc.BidiStreamingServer[StopRequest, OutboundGroupList]) error { +func (UnimplementedCoreServer) OutboundsInfo(*Empty, grpc.ServerStreamingServer[OutboundGroupList]) error { return status.Errorf(codes.Unimplemented, "method OutboundsInfo not implemented") } -func (UnimplementedCoreServer) MainOutboundsInfo(grpc.BidiStreamingServer[StopRequest, OutboundGroupList]) error { +func (UnimplementedCoreServer) MainOutboundsInfo(*Empty, grpc.ServerStreamingServer[OutboundGroupList]) error { return status.Errorf(codes.Unimplemented, "method MainOutboundsInfo not implemented") } -func (UnimplementedCoreServer) GetSystemInfo(grpc.BidiStreamingServer[StopRequest, SystemInfo]) error { +func (UnimplementedCoreServer) GetSystemInfo(*Empty, grpc.ServerStreamingServer[SystemInfo]) error { return status.Errorf(codes.Unimplemented, "method GetSystemInfo not implemented") } func (UnimplementedCoreServer) Setup(context.Context, *SetupRequest) (*Response, error) { @@ -443,8 +473,8 @@ func (UnimplementedCoreServer) Setup(context.Context, *SetupRequest) (*Response, func (UnimplementedCoreServer) Parse(context.Context, *ParseRequest) (*ParseResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Parse not implemented") } -func (UnimplementedCoreServer) ChangeHiddifyOptions(context.Context, *ChangeHiddifyOptionsRequest) (*CoreInfoResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ChangeHiddifyOptions not implemented") +func (UnimplementedCoreServer) ChangeHiddifySettings(context.Context, *ChangeHiddifySettingsRequest) (*CoreInfoResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ChangeHiddifySettings not implemented") } func (UnimplementedCoreServer) StartService(context.Context, *StartRequest) (*CoreInfoResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method StartService not implemented") @@ -470,7 +500,7 @@ func (UnimplementedCoreServer) GetSystemProxyStatus(context.Context, *Empty) (*S func (UnimplementedCoreServer) SetSystemProxyEnabled(context.Context, *SetSystemProxyEnabledRequest) (*Response, error) { return nil, status.Errorf(codes.Unimplemented, "method SetSystemProxyEnabled not implemented") } -func (UnimplementedCoreServer) LogListener(grpc.BidiStreamingServer[StopRequest, LogMessage]) error { +func (UnimplementedCoreServer) LogListener(*Empty, grpc.ServerStreamingServer[LogMessage]) error { return status.Errorf(codes.Unimplemented, "method LogListener not implemented") } func (UnimplementedCoreServer) mustEmbedUnimplementedCoreServer() {} @@ -513,32 +543,48 @@ func _Core_Start_Handler(srv interface{}, ctx context.Context, dec func(interfac } func _Core_CoreInfoListener_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(CoreServer).CoreInfoListener(&grpc.GenericServerStream[StopRequest, CoreInfoResponse]{ServerStream: stream}) + m := new(Empty) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(CoreServer).CoreInfoListener(m, &grpc.GenericServerStream[Empty, CoreInfoResponse]{ServerStream: stream}) } // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type Core_CoreInfoListenerServer = grpc.BidiStreamingServer[StopRequest, CoreInfoResponse] +type Core_CoreInfoListenerServer = grpc.ServerStreamingServer[CoreInfoResponse] func _Core_OutboundsInfo_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(CoreServer).OutboundsInfo(&grpc.GenericServerStream[StopRequest, OutboundGroupList]{ServerStream: stream}) + m := new(Empty) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(CoreServer).OutboundsInfo(m, &grpc.GenericServerStream[Empty, OutboundGroupList]{ServerStream: stream}) } // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type Core_OutboundsInfoServer = grpc.BidiStreamingServer[StopRequest, OutboundGroupList] +type Core_OutboundsInfoServer = grpc.ServerStreamingServer[OutboundGroupList] func _Core_MainOutboundsInfo_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(CoreServer).MainOutboundsInfo(&grpc.GenericServerStream[StopRequest, OutboundGroupList]{ServerStream: stream}) + m := new(Empty) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(CoreServer).MainOutboundsInfo(m, &grpc.GenericServerStream[Empty, OutboundGroupList]{ServerStream: stream}) } // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type Core_MainOutboundsInfoServer = grpc.BidiStreamingServer[StopRequest, OutboundGroupList] +type Core_MainOutboundsInfoServer = grpc.ServerStreamingServer[OutboundGroupList] func _Core_GetSystemInfo_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(CoreServer).GetSystemInfo(&grpc.GenericServerStream[StopRequest, SystemInfo]{ServerStream: stream}) + m := new(Empty) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(CoreServer).GetSystemInfo(m, &grpc.GenericServerStream[Empty, SystemInfo]{ServerStream: stream}) } // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type Core_GetSystemInfoServer = grpc.BidiStreamingServer[StopRequest, SystemInfo] +type Core_GetSystemInfoServer = grpc.ServerStreamingServer[SystemInfo] func _Core_Setup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(SetupRequest) @@ -576,20 +622,20 @@ func _Core_Parse_Handler(srv interface{}, ctx context.Context, dec func(interfac return interceptor(ctx, in, info, handler) } -func _Core_ChangeHiddifyOptions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ChangeHiddifyOptionsRequest) +func _Core_ChangeHiddifySettings_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ChangeHiddifySettingsRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(CoreServer).ChangeHiddifyOptions(ctx, in) + return srv.(CoreServer).ChangeHiddifySettings(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: Core_ChangeHiddifyOptions_FullMethodName, + FullMethod: Core_ChangeHiddifySettings_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CoreServer).ChangeHiddifyOptions(ctx, req.(*ChangeHiddifyOptionsRequest)) + return srv.(CoreServer).ChangeHiddifySettings(ctx, req.(*ChangeHiddifySettingsRequest)) } return interceptor(ctx, in, info, handler) } @@ -739,11 +785,15 @@ func _Core_SetSystemProxyEnabled_Handler(srv interface{}, ctx context.Context, d } func _Core_LogListener_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(CoreServer).LogListener(&grpc.GenericServerStream[StopRequest, LogMessage]{ServerStream: stream}) + m := new(Empty) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(CoreServer).LogListener(m, &grpc.GenericServerStream[Empty, LogMessage]{ServerStream: stream}) } // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type Core_LogListenerServer = grpc.BidiStreamingServer[StopRequest, LogMessage] +type Core_LogListenerServer = grpc.ServerStreamingServer[LogMessage] // Core_ServiceDesc is the grpc.ServiceDesc for Core service. // It's only intended for direct use with grpc.RegisterService, @@ -765,8 +815,8 @@ var Core_ServiceDesc = grpc.ServiceDesc{ Handler: _Core_Parse_Handler, }, { - MethodName: "ChangeHiddifyOptions", - Handler: _Core_ChangeHiddifyOptions_Handler, + MethodName: "ChangeHiddifySettings", + Handler: _Core_ChangeHiddifySettings_Handler, }, { MethodName: "StartService", @@ -806,31 +856,26 @@ var Core_ServiceDesc = grpc.ServiceDesc{ StreamName: "CoreInfoListener", Handler: _Core_CoreInfoListener_Handler, ServerStreams: true, - ClientStreams: true, }, { StreamName: "OutboundsInfo", Handler: _Core_OutboundsInfo_Handler, ServerStreams: true, - ClientStreams: true, }, { StreamName: "MainOutboundsInfo", Handler: _Core_MainOutboundsInfo_Handler, ServerStreams: true, - ClientStreams: true, }, { StreamName: "GetSystemInfo", Handler: _Core_GetSystemInfo_Handler, ServerStreams: true, - ClientStreams: true, }, { StreamName: "LogListener", Handler: _Core_LogListener_Handler, ServerStreams: true, - ClientStreams: true, }, }, Metadata: "hiddify.proto", diff --git a/v2/commands.go b/v2/commands.go index b958e69..effe5d8 100644 --- a/v2/commands.go +++ b/v2/commands.go @@ -6,11 +6,14 @@ import ( pb "github.com/hiddify/hiddify-core/hiddifyrpc" "github.com/sagernet/sing-box/experimental/libbox" + "google.golang.org/grpc" ) -var systemInfoObserver = NewObserver[pb.SystemInfo](10) -var outboundsInfoObserver = NewObserver[pb.OutboundGroupList](10) -var mainOutboundsInfoObserver = NewObserver[pb.OutboundGroupList](10) +var ( + systemInfoObserver = NewObserver[pb.SystemInfo](10) + outboundsInfoObserver = NewObserver[pb.OutboundGroupList](10) + mainOutboundsInfoObserver = NewObserver[pb.OutboundGroupList](10) +) var ( statusClient *libbox.CommandClient @@ -18,13 +21,13 @@ var ( groupInfoOnlyClient *libbox.CommandClient ) -func (s *CoreService) GetSystemInfo(stream pb.Core_GetSystemInfoServer) error { +func (s *CoreService) GetSystemInfo(req *pb.Empty, stream grpc.ServerStreamingServer[pb.SystemInfo]) error { if statusClient == nil { statusClient = libbox.NewCommandClient( &CommandClientHandler{}, &libbox.CommandClientOptions{ Command: libbox.CommandStatus, - StatusInterval: 1000000000, //1000ms debounce + StatusInterval: 1000000000, // 1000ms debounce }, ) @@ -35,18 +38,14 @@ func (s *CoreService) GetSystemInfo(stream pb.Core_GetSystemInfoServer) error { statusClient.Connect() } - sub, _, _ := systemInfoObserver.Subscribe() - stopch := make(chan int) - go func() { - stream.Recv() - close(stopch) - }() + sub, done, _ := systemInfoObserver.Subscribe() + for { select { case <-stream.Context().Done(): - break - case <-stopch: - break + return nil + case <-done: + return nil case info := <-sub: stream.Send(&info) case <-time.After(1000 * time.Millisecond): @@ -54,13 +53,13 @@ func (s *CoreService) GetSystemInfo(stream pb.Core_GetSystemInfoServer) error { } } -func (s *CoreService) OutboundsInfo(stream pb.Core_OutboundsInfoServer) error { +func (s *CoreService) OutboundsInfo(req *pb.Empty, stream grpc.ServerStreamingServer[pb.OutboundGroupList]) error { if groupClient == nil { groupClient = libbox.NewCommandClient( &CommandClientHandler{}, &libbox.CommandClientOptions{ Command: libbox.CommandGroup, - StatusInterval: 500000000, //500ms debounce + StatusInterval: 500000000, // 500ms debounce }, ) @@ -71,18 +70,14 @@ func (s *CoreService) OutboundsInfo(stream pb.Core_OutboundsInfoServer) error { groupClient.Connect() } - sub, _, _ := outboundsInfoObserver.Subscribe() - stopch := make(chan int) - go func() { - stream.Recv() - close(stopch) - }() + sub, done, _ := outboundsInfoObserver.Subscribe() + for { select { case <-stream.Context().Done(): - break - case <-stopch: - break + return nil + case <-done: + return nil case info := <-sub: stream.Send(&info) case <-time.After(500 * time.Millisecond): @@ -90,13 +85,13 @@ func (s *CoreService) OutboundsInfo(stream pb.Core_OutboundsInfoServer) error { } } -func (s *CoreService) MainOutboundsInfo(stream pb.Core_MainOutboundsInfoServer) error { +func (s *CoreService) MainOutboundsInfo(req *pb.Empty, stream grpc.ServerStreamingServer[pb.OutboundGroupList]) error { if groupInfoOnlyClient == nil { groupInfoOnlyClient = libbox.NewCommandClient( &CommandClientHandler{}, &libbox.CommandClientOptions{ Command: libbox.CommandGroupInfoOnly, - StatusInterval: 500000000, //500ms debounce + StatusInterval: 500000000, // 500ms debounce }, ) @@ -107,18 +102,14 @@ func (s *CoreService) MainOutboundsInfo(stream pb.Core_MainOutboundsInfoServer) groupInfoOnlyClient.Connect() } - sub, _, _ := mainOutboundsInfoObserver.Subscribe() - stopch := make(chan int) - go func() { - stream.Recv() - close(stopch) - }() + sub, stopch, _ := mainOutboundsInfoObserver.Subscribe() + for { select { case <-stream.Context().Done(): - break + return nil case <-stopch: - break + return nil case info := <-sub: stream.Send(&info) case <-time.After(500 * time.Millisecond): @@ -129,9 +120,9 @@ func (s *CoreService) MainOutboundsInfo(stream pb.Core_MainOutboundsInfoServer) func (s *CoreService) SelectOutbound(ctx context.Context, in *pb.SelectOutboundRequest) (*pb.Response, error) { return SelectOutbound(in) } + func SelectOutbound(in *pb.SelectOutboundRequest) (*pb.Response, error) { err := libbox.NewStandaloneCommandClient().SelectOutbound(in.GroupTag, in.OutboundTag) - if err != nil { return &pb.Response{ ResponseCode: pb.ResponseCode_FAILED, @@ -148,9 +139,9 @@ func SelectOutbound(in *pb.SelectOutboundRequest) (*pb.Response, error) { func (s *CoreService) UrlTest(ctx context.Context, in *pb.UrlTestRequest) (*pb.Response, error) { return UrlTest(in) } + func UrlTest(in *pb.UrlTestRequest) (*pb.Response, error) { err := libbox.NewStandaloneCommandClient().URLTest(in.GroupTag) - if err != nil { return &pb.Response{ ResponseCode: pb.ResponseCode_FAILED, @@ -162,5 +153,4 @@ func UrlTest(in *pb.UrlTestRequest) (*pb.Response, error) { ResponseCode: pb.ResponseCode_OK, Message: "", }, nil - } diff --git a/v2/coreinfo.go b/v2/coreinfo.go index b3f2057..4703f48 100644 --- a/v2/coreinfo.go +++ b/v2/coreinfo.go @@ -3,16 +3,18 @@ package v2 import ( "encoding/json" "fmt" - "time" "github.com/hiddify/hiddify-core/bridge" pb "github.com/hiddify/hiddify-core/hiddifyrpc" + "google.golang.org/grpc" ) -var coreInfoObserver = NewObserver[pb.CoreInfoResponse](10) -var CoreState = pb.CoreState_STOPPED +var ( + coreInfoObserver = *NewObserver[*pb.CoreInfoResponse](1) + CoreState = pb.CoreState_STOPPED +) -func SetCoreStatus(state pb.CoreState, msgType pb.MessageType, message string) pb.CoreInfoResponse { +func SetCoreStatus(state pb.CoreState, msgType pb.MessageType, message string) *pb.CoreInfoResponse { msg := fmt.Sprintf("%s: %s %s", state.String(), msgType.String(), message) if msgType == pb.MessageType_EMPTY { msg = fmt.Sprintf("%s: %s", state.String(), message) @@ -24,32 +26,32 @@ func SetCoreStatus(state pb.CoreState, msgType pb.MessageType, message string) p MessageType: msgType, Message: message, } - coreInfoObserver.Emit(info) + coreInfoObserver.Emit(&info) if useFlutterBridge { msg, _ := json.Marshal(StatusMessage{Status: convert2OldState(CoreState)}) bridge.SendStringToPort(statusPropagationPort, string(msg)) } - return info - + return &info } -func (s *CoreService) CoreInfoListener(stream pb.Core_CoreInfoListenerServer) error { - coreSub, _, _ := coreInfoObserver.Subscribe() +func (s *CoreService) CoreInfoListener(req *pb.Empty, stream grpc.ServerStreamingServer[pb.CoreInfoResponse]) error { + coreSub, done, err := coreInfoObserver.Subscribe() + if err != nil { + return err + } defer coreInfoObserver.UnSubscribe(coreSub) - stopch := make(chan int) - go func() { - stream.Recv() - close(stopch) - }() + for { select { case <-stream.Context().Done(): return nil - case <-stopch: + case <-done: return nil case info := <-coreSub: - stream.Send(&info) - case <-time.After(500 * time.Millisecond): + stream.Send(info) + // case <-time.After(500 * time.Millisecond): + // info := SetCoreStatus(pb.CoreState_STOPPED, pb.MessageType_EMPTY, "") + // stream.Send(info) } } } diff --git a/v2/custom.go b/v2/custom.go index 4ea6fa4..7bde2ef 100644 --- a/v2/custom.go +++ b/v2/custom.go @@ -83,7 +83,7 @@ func StartService(in *pb.StartRequest) (*pb.CoreInfoResponse, error) { Log(pb.LogLevel_FATAL, pb.LogType_CORE, err.Error()) resp := SetCoreStatus(pb.CoreState_STOPPED, pb.MessageType_ERROR_READING_CONFIG, err.Error()) StopAndAlert(pb.MessageType_UNEXPECTED_ERROR, err.Error()) - return &resp, err + return resp, err } content = string(fileContent) } @@ -96,7 +96,7 @@ func StartService(in *pb.StartRequest) (*pb.CoreInfoResponse, error) { Log(pb.LogLevel_FATAL, pb.LogType_CORE, err.Error()) resp := SetCoreStatus(pb.CoreState_STOPPED, pb.MessageType_ERROR_PARSING_CONFIG, err.Error()) StopAndAlert(pb.MessageType_UNEXPECTED_ERROR, err.Error()) - return &resp, err + return resp, err } if !in.EnableRawConfig { Log(pb.LogLevel_DEBUG, pb.LogType_CORE, "Building config") @@ -105,7 +105,7 @@ func StartService(in *pb.StartRequest) (*pb.CoreInfoResponse, error) { Log(pb.LogLevel_FATAL, pb.LogType_CORE, err.Error()) resp := SetCoreStatus(pb.CoreState_STOPPED, pb.MessageType_ERROR_BUILDING_CONFIG, err.Error()) StopAndAlert(pb.MessageType_UNEXPECTED_ERROR, err.Error()) - return &resp, err + return resp, err } parsedContent = *parsedContent_tmp } @@ -122,7 +122,7 @@ func StartService(in *pb.StartRequest) (*pb.CoreInfoResponse, error) { Log(pb.LogLevel_FATAL, pb.LogType_CORE, err.Error()) resp := SetCoreStatus(pb.CoreState_STOPPED, pb.MessageType_START_COMMAND_SERVER, err.Error()) StopAndAlert(pb.MessageType_UNEXPECTED_ERROR, err.Error()) - return &resp, err + return resp, err } } @@ -132,7 +132,7 @@ func StartService(in *pb.StartRequest) (*pb.CoreInfoResponse, error) { Log(pb.LogLevel_FATAL, pb.LogType_CORE, err.Error()) resp := SetCoreStatus(pb.CoreState_STOPPED, pb.MessageType_CREATE_SERVICE, err.Error()) StopAndAlert(pb.MessageType_UNEXPECTED_ERROR, err.Error()) - return &resp, err + return resp, err } Log(pb.LogLevel_DEBUG, pb.LogType_CORE, "Service.. started") if in.DelayStart { @@ -144,7 +144,7 @@ func StartService(in *pb.StartRequest) (*pb.CoreInfoResponse, error) { Log(pb.LogLevel_FATAL, pb.LogType_CORE, err.Error()) resp := SetCoreStatus(pb.CoreState_STOPPED, pb.MessageType_START_SERVICE, err.Error()) StopAndAlert(pb.MessageType_UNEXPECTED_ERROR, err.Error()) - return &resp, err + return resp, err } Box = instance if in.EnableOldCommandServer { @@ -152,7 +152,7 @@ func StartService(in *pb.StartRequest) (*pb.CoreInfoResponse, error) { } resp := SetCoreStatus(pb.CoreState_STARTED, pb.MessageType_EMPTY, "") - return &resp, nil + return resp, nil } func (s *CoreService) Parse(ctx context.Context, in *pb.ParseRequest) (*pb.ParseResponse, error) { @@ -199,13 +199,13 @@ func Parse(in *pb.ParseRequest) (*pb.ParseResponse, error) { }, err } -func (s *CoreService) ChangeHiddifyOptions(ctx context.Context, in *pb.ChangeHiddifyOptionsRequest) (*pb.CoreInfoResponse, error) { - return ChangeHiddifyOptions(in) +func (s *CoreService) ChangeHiddifySettings(ctx context.Context, in *pb.ChangeHiddifySettingsRequest) (*pb.CoreInfoResponse, error) { + return ChangeHiddifySettings(in) } -func ChangeHiddifyOptions(in *pb.ChangeHiddifyOptionsRequest) (*pb.CoreInfoResponse, error) { - HiddifyOptions = &config.HiddifyOptions{} - err := json.Unmarshal([]byte(in.HiddifyOptionsJson), HiddifyOptions) +func ChangeHiddifySettings(in *pb.ChangeHiddifySettingsRequest) (*pb.CoreInfoResponse, error) { + HiddifyOptions = config.DefaultHiddifyOptions() + err := json.Unmarshal([]byte(in.HiddifySettingsJson), HiddifyOptions) if err != nil { return nil, err } @@ -314,7 +314,7 @@ func Stop() (*pb.CoreInfoResponse, error) { oldCommandServer = nil } resp := SetCoreStatus(pb.CoreState_STOPPED, pb.MessageType_EMPTY, "") - return &resp, nil + return resp, nil } func (s *CoreService) Restart(ctx context.Context, in *pb.StartRequest) (*pb.CoreInfoResponse, error) { diff --git a/v2/grpc_server.go b/v2/grpc_server.go index 23b1fdb..e38a19d 100644 --- a/v2/grpc_server.go +++ b/v2/grpc_server.go @@ -33,6 +33,11 @@ func StartGrpcServer(listenAddressG string, service string) (*grpc.Server, error } s := grpc.NewServer() if service == "core" { + + // Setup("./tmp/", "./tmp", "./tmp", 11111, false) + Setup("./tmp", "./", "./tmp", 0, false) + + useFlutterBridge = false pb.RegisterCoreServer(s, &CoreService{}) pb.RegisterExtensionHostServiceServer(s, &extension.ExtensionHostService{}) } else if service == "hello" { diff --git a/v2/independent_instance.go b/v2/independent_instance.go new file mode 100644 index 0000000..6d5581c --- /dev/null +++ b/v2/independent_instance.go @@ -0,0 +1,172 @@ +package v2 + +import ( + "fmt" + "io" + "net" + "net/http" + "time" + + "github.com/hiddify/hiddify-core/config" + "golang.org/x/net/proxy" + + "github.com/sagernet/sing-box/experimental/libbox" + "github.com/sagernet/sing-box/option" +) + +func getRandomAvailblePort() uint16 { + // TODO: implement it + listener, err := net.Listen("tcp", ":0") + if err != nil { + panic(err) + } + defer listener.Close() + return uint16(listener.Addr().(*net.TCPAddr).Port) +} + +func RunInstanceString(hiddifySettings *config.HiddifyOptions, proxiesInput string) (*HiddifyService, error) { + if hiddifySettings == nil { + hiddifySettings = config.DefaultHiddifyOptions() + } + singconfigs, err := config.ParseConfigContentToOptions(proxiesInput, true, hiddifySettings, false) + if err != nil { + return nil, err + } + return RunInstance(hiddifySettings, singconfigs) +} + +func RunInstance(hiddifySettings *config.HiddifyOptions, singconfig *option.Options) (*HiddifyService, error) { + if hiddifySettings == nil { + hiddifySettings = config.DefaultHiddifyOptions() + } + hiddifySettings.EnableClashApi = false + hiddifySettings.InboundOptions.MixedPort = getRandomAvailblePort() + hiddifySettings.InboundOptions.EnableTun = false + hiddifySettings.InboundOptions.EnableTunService = false + hiddifySettings.InboundOptions.SetSystemProxy = false + hiddifySettings.InboundOptions.TProxyPort = 0 + hiddifySettings.InboundOptions.LocalDnsPort = 0 + hiddifySettings.Region = "other" + hiddifySettings.BlockAds = false + hiddifySettings.LogFile = "/dev/null" + + finalConfigs, err := config.BuildConfig(*hiddifySettings, *singconfig) + if err != nil { + return nil, err + } + + instance, err := NewService(*finalConfigs) + if err != nil { + return nil, err + } + err = instance.Start() + if err != nil { + return nil, err + } + <-time.After(250 * time.Millisecond) + hservice := &HiddifyService{libbox: instance, ListenPort: hiddifySettings.InboundOptions.MixedPort} + hservice.PingCloudflare() + return hservice, nil +} + +type HiddifyService struct { + libbox *libbox.BoxService + ListenPort uint16 +} + +// dialer, err := s.libbox.GetInstance().Router().Dialer(context.Background()) + +func (s *HiddifyService) Close() error { + return s.libbox.Close() +} + +func (s *HiddifyService) GetContent(url string) (string, error) { + return s.ContentFromURL("GET", url, 10*time.Second) +} + +func (s *HiddifyService) ContentFromURL(method string, url string, timeout time.Duration) (string, error) { + if method == "" { + return "", fmt.Errorf("empty method") + } + if url == "" { + return "", fmt.Errorf("empty url") + } + + req, err := http.NewRequest(method, url, nil) + if err != nil { + return "", err + } + + dialer, err := proxy.SOCKS5("tcp", fmt.Sprintf("127.0.0.1:%d", s.ListenPort), nil, proxy.Direct) + if err != nil { + return "", err + } + + transport := &http.Transport{ + Dial: dialer.Dial, + } + + client := &http.Client{ + Transport: transport, + Timeout: timeout, + } + + resp, err := client.Do(req) + if err != nil { + return "", err + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusNoContent { + return "", fmt.Errorf("request failed with status code: %d", resp.StatusCode) + } + + body, err := io.ReadAll(resp.Body) + if err != nil { + return "", err + } + + if body == nil { + return "", fmt.Errorf("empty body") + } + + return string(body), nil +} + +func (s *HiddifyService) PingCloudflare() (time.Duration, error) { + return s.Ping("http://cp.cloudflare.com") +} + +// func (s *HiddifyService) RawConnection(ctx context.Context, url string) (net.Conn, error) { +// return +// } + +func (s *HiddifyService) PingAverage(url string, count int) (time.Duration, error) { + if count <= 0 { + return -1, fmt.Errorf("count must be greater than 0") + } + + var sum int + real_count := 0 + for i := 0; i < count; i++ { + delay, err := s.Ping(url) + if err == nil { + real_count++ + sum += int(delay.Milliseconds()) + } else if real_count == 0 && i > count/2 { + return -1, fmt.Errorf("ping average failed") + } + + } + return time.Duration(sum / real_count * int(time.Millisecond)), nil +} + +func (s *HiddifyService) Ping(url string) (time.Duration, error) { + startTime := time.Now() + _, err := s.ContentFromURL("HEAD", url, 4*time.Second) + if err != nil { + return -1, err + } + duration := time.Since(startTime) + return duration, nil +} diff --git a/v2/logproto.go b/v2/logproto.go index 7516569..ee2c0c0 100644 --- a/v2/logproto.go +++ b/v2/logproto.go @@ -6,10 +6,11 @@ import ( pb "github.com/hiddify/hiddify-core/hiddifyrpc" "github.com/sagernet/sing/common/observable" + "google.golang.org/grpc" ) func NewObserver[T any](listenerBufferSize int) *observable.Observer[T] { - return observable.NewObserver[T](&observable.Subscriber[T]{}, listenerBufferSize) + return observable.NewObserver(observable.NewSubscriber[T](listenerBufferSize), listenerBufferSize) } var logObserver = NewObserver[pb.LogMessage](10) @@ -17,29 +18,24 @@ var logObserver = NewObserver[pb.LogMessage](10) func Log(level pb.LogLevel, typ pb.LogType, message string) { if level != pb.LogLevel_DEBUG { fmt.Printf("%s %s %s\n", level, typ, message) - } logObserver.Emit(pb.LogMessage{ Level: level, Type: typ, Message: message, }) - } -func (s *CoreService) LogListener(stream pb.Core_LogListenerServer) error { - logSub, _, _ := logObserver.Subscribe() +func (s *CoreService) LogListener(req *pb.Empty, stream grpc.ServerStreamingServer[pb.LogMessage]) error { + logSub, stopch, _ := logObserver.Subscribe() defer logObserver.UnSubscribe(logSub) - stopch := make(chan int) - go func() { - stream.Recv() - close(stopch) - }() for { select { case <-stream.Context().Done(): return nil + case <-stopch: + return nil case info := <-logSub: stream.Send(&info) case <-time.After(500 * time.Millisecond): diff --git a/v2/standalone.go b/v2/standalone.go index 9a21fee..173c9ee 100644 --- a/v2/standalone.go +++ b/v2/standalone.go @@ -68,7 +68,7 @@ func readAndBuildConfig(hiddifySettingPath string, configPath string, defaultCon } if hiddifySettingPath != "" { - hiddifyconfig, err = readHiddifyOptionsAt(hiddifySettingPath) + hiddifyconfig, err = ReadHiddifyOptionsAt(hiddifySettingPath) if err != nil { return result, err } @@ -96,7 +96,7 @@ func readConfigContent(configPath string) (ConfigResult, error) { fmt.Println("Error creating request:", err) return ConfigResult{}, err } - req.Header.Set("User-Agent", "HiddifyNext/17.5.0 ("+runtime.GOOS+") like ClashMeta v2ray sing-box") + req.Header.Set("User-Agent", "HiddifyNext/2.3.1 ("+runtime.GOOS+") like ClashMeta v2ray sing-box") resp, err := client.Do(req) if err != nil { fmt.Println("Error making GET request:", err) @@ -222,7 +222,7 @@ func readConfigBytes(content []byte) (*option.Options, error) { return &options, nil } -func readHiddifyOptionsAt(path string) (*config.HiddifyOptions, error) { +func ReadHiddifyOptionsAt(path string) (*config.HiddifyOptions, error) { content, err := os.ReadFile(path) if err != nil { return nil, err