From e895661bdbc5b17a5c67434a8db5eeae393eec14 Mon Sep 17 00:00:00 2001 From: x Date: Mon, 11 Nov 2024 00:21:19 +0330 Subject: [PATCH] new: big changes, stablity and more --- cmd/cmd_command.go | 81 +++ cmd/cmd_run.go | 4 +- cmd/cmd_temp.go | 75 +- docs/hiddifyrpc.md | 30 +- extension/server/run_server.go | 4 +- go.mod | 21 +- go.sum | 46 +- platform/desktop/cmd_interface.go | 1 + platform/desktop/custom.go | 170 ++++- platform/mobile/mobile.go | 2 +- v2/config/config.go | 2 +- v2/extension/server/run_server.go | 4 +- v2/hcore/{config.go => buildconfighelper.go} | 34 +- v2/hcore/command_client.go | 140 ++-- v2/hcore/command_server.go | 84 +-- v2/hcore/commands.go | 100 ++- v2/hcore/coreinfo.go | 13 +- v2/hcore/custom.go | 14 +- v2/hcore/grpc_server.go | 17 +- v2/hcore/hcore.pb.go | 691 +++++++++++-------- v2/hcore/hcore.proto | 25 +- v2/hcore/logproto.go | 14 +- v2/hcore/proxy_info.go | 37 +- v2/hcore/restart.go | 4 +- v2/hcore/service.go | 40 +- v2/hcore/standalone.go | 21 +- v2/hcore/start.go | 10 +- v2/hcore/static_data.go | 30 + v2/hcore/stop.go | 8 +- 29 files changed, 1060 insertions(+), 662 deletions(-) create mode 100644 cmd/cmd_command.go rename v2/hcore/{config.go => buildconfighelper.go} (79%) create mode 100644 v2/hcore/static_data.go diff --git a/cmd/cmd_command.go b/cmd/cmd_command.go new file mode 100644 index 00000000..91d67dba --- /dev/null +++ b/cmd/cmd_command.go @@ -0,0 +1,81 @@ +package cmd + +import ( + "context" + "log" + "time" + + "github.com/hiddify/hiddify-core/v2/hcommon" + hcore "github.com/hiddify/hiddify-core/v2/hcore" + + "github.com/spf13/cobra" + "google.golang.org/grpc" +) + +var execCommand = &cobra.Command{ + Use: "command", + Short: "command", + Args: cobra.OnlyValidArgs, + Run: execCommandgrpc, +} + +func init() { + // commandRun.PersistentFlags().BoolP("help", "", false, "help for this command") + // commandRun.Flags().StringVarP(&hiddifySettingPath, "hiddify", "d", "", "Hiddify Setting JSON Path") + + mainCommand.AddCommand(execCommand) +} + +func execCommandgrpc(cmd *cobra.Command, args []string) { + conn, err := grpc.Dial("127.0.0.1:17078", grpc.WithInsecure()) + if err != nil { + log.Fatalf("did not connect: %v", err) + } + defer conn.Close() + c := hcore.NewCoreClient(conn) + + ctx, cancel := context.WithTimeout(context.Background(), time.Second*100) + defer cancel() + tream, err := c.CoreInfoListener(ctx, &hcommon.Empty{}) + stream2, err := c.OutboundsInfo(ctx, &hcommon.Empty{}) + stream, err := c.MainOutboundsInfo(ctx, &hcommon.Empty{}) + logstream, err := c.LogListener(ctx, &hcommon.Empty{}) + if err != nil { + log.Fatalf("could not stream: %v", err) + } + + go coreLogger(tream, "coreinfo") + go coreLogger(stream2, "alloutbounds") + go coreLogger(stream, "mainoutbounds") + go coreLogger(logstream, "log") + for _, x := range []string{ + "m4 § 0", + "warp in warp § 1", + "LocalIP § 2", + "WarpInWarp✅ § 3", + } { + c.UrlTest(ctx, &hcore.UrlTestRequest{GroupTag: "auto"}) + log.Printf("Sending: %s", x) + resp, err := c.SelectOutbound(ctx, &hcore.SelectOutboundRequest{ + GroupTag: "select", + OutboundTag: x, + }) + if err != nil { + log.Fatalf("could not greet: %s %v", x, err) + } + + log.Printf("Received: %s %v", x, resp) + <-time.After(1 * time.Second) + } + <-time.After(10 * time.Second) +} + +func coreLogger[T any](stream grpc.ServerStreamingClient[T], name string) { + for { + c, err := stream.Recv() + if err != nil { + log.Printf("could not receive %s : %v", name, err) + } + log.Printf("Received: %s, %v", name, c) + } +} diff --git a/cmd/cmd_run.go b/cmd/cmd_run.go index 374c29d2..9f702e96 100644 --- a/cmd/cmd_run.go +++ b/cmd/cmd_run.go @@ -24,13 +24,13 @@ func init() { func runCommand(cmd *cobra.Command, args []string) { hcore.Setup( - hcore.SetupParameters{ + &hcore.SetupRequest{ BasePath: "./tmp", WorkingDir: "./", TempDir: "./tmp", FlutterStatusPort: 0, Debug: false, - Mode: hcore.GRPC_NORMAL_INSECURE, + Mode: hcore.SetupMode_GRPC_NORMAL_INSECURE, Listen: "127.0.0.1:17078", }, ) diff --git a/cmd/cmd_temp.go b/cmd/cmd_temp.go index ec69c957..8cc0277f 100644 --- a/cmd/cmd_temp.go +++ b/cmd/cmd_temp.go @@ -1,45 +1,34 @@ package cmd -import ( - "context" - "log" - "os" - "time" - - "github.com/hiddify/hiddify-core/v2/hcommon" - hcore "github.com/hiddify/hiddify-core/v2/hcore" - "google.golang.org/grpc" -) - -const ( - address = "localhost:17078" - defaultName = "world" -) - -func init() { - if os.Args[1] == "test" { - conn, err := grpc.Dial(address, grpc.WithInsecure()) - if err != nil { - log.Fatalf("did not connect: %v", err) - } - defer conn.Close() - c := hcore.NewCoreClient(conn) - - // ctx, cancel := context.WithTimeout(context.Background(), time.Second*10) - // defer cancel() - ctx := context.Background() - - // SayHello - stream, err := c.OutboundsInfo(ctx, &hcommon.Empty{}) - - for { - r, err := stream.Recv() - if err != nil { - log.Fatalf("could not receive: %v", err) - } - log.Printf("Received1: %s", r.String()) - - time.Sleep(1 * time.Second) - } - } -} +// const ( +// address = "localhost:17078" +// defaultName = "world" +// ) + +// // func init() { +// // if len(os.Args) > 1 && os.Args[1] == "test" { +// // conn, err := grpc.Dial(address, grpc.WithInsecure()) +// // if err != nil { +// // log.Fatalf("did not connect: %v", err) +// // } +// // defer conn.Close() +// // c := hcore.NewCoreClient(conn) + +// // ctx, cancel := context.WithTimeout(context.Background(), time.Second*10) +// // defer cancel() +// ctx := context.Background() + +// // SayHello +// stream, err := c.OutboundsInfo(ctx, &hcommon.Empty{}) + +// for { +// r, err := stream.Recv() +// if err != nil { +// log.Fatalf("could not receive: %v", err) +// } +// log.Printf("Received1: %s", r.String()) + +// time.Sleep(1 * time.Second) +// } +// } +// } diff --git a/docs/hiddifyrpc.md b/docs/hiddifyrpc.md index b19bd86e..2d613dcc 100644 --- a/docs/hiddifyrpc.md +++ b/docs/hiddifyrpc.md @@ -32,6 +32,7 @@ - [LogLevel](#hcore-LogLevel) - [LogType](#hcore-LogType) - [MessageType](#hcore-MessageType) + - [SetupMode](#hcore-SetupMode) - [v2/hcore/hcore_service.proto](#v2_hcore_hcore_service-proto) - [Core](#hcore-Core) @@ -281,9 +282,10 @@ | type | [string](#string) | | | | url_test_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | | | url_test_delay | [int32](#int32) | | | -| ipinfo | [IpInfo](#hcore-IpInfo) | | | +| ipinfo | [IpInfo](#hcore-IpInfo) | optional | | | is_selected | [bool](#bool) | | | | is_group | [bool](#bool) | | | +| group_selected_outbound | [OutboundInfo](#hcore-OutboundInfo) | optional | | | is_secure | [bool](#bool) | | | | is_visible | [bool](#bool) | | | | port | [uint32](#uint32) | | | @@ -364,14 +366,19 @@ ### SetupRequest - +Define the message equivalent of SetupParameters | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | base_path | [string](#string) | | | -| working_path | [string](#string) | | | -| temp_path | [string](#string) | | | +| working_dir | [string](#string) | | | +| temp_dir | [string](#string) | | | +| flutter_status_port | [int64](#int64) | | | +| listen | [string](#string) | | | +| secret | [string](#string) | | | +| debug | [bool](#bool) | | | +| mode | [SetupMode](#hcore-SetupMode) | | | @@ -582,6 +589,21 @@ | ERROR_EXTENSION | 14 | | + + + +### SetupMode + + +| Name | Number | Description | +| ---- | ------ | ----------- | +| OLD | 0 | | +| GRPC_NORMAL | 1 | | +| GRPC_BACKGROUND | 2 | | +| GRPC_NORMAL_INSECURE | 3 | | +| GRPC_BACKGROUND_INSECURE | 4 | | + + diff --git a/extension/server/run_server.go b/extension/server/run_server.go index 9444ae22..c6faceca 100644 --- a/extension/server/run_server.go +++ b/extension/server/run_server.go @@ -18,7 +18,7 @@ import ( func StartTestExtensionServer() { hcore.Setup( - hcore.SetupParameters{ + &hcore.SetupRequest{ BasePath: "./tmp", WorkingDir: "./", TempDir: "./tmp", @@ -26,7 +26,7 @@ func StartTestExtensionServer() { Listen: "", Secret: "", Debug: false, - Mode: hcore.OLD, + Mode: hcore.SetupMode_OLD, }, ) // "./tmp", "./", "./tmp", 0, false) diff --git a/go.mod b/go.mod index 9586b4c7..1cf2b8ab 100644 --- a/go.mod +++ b/go.mod @@ -171,9 +171,9 @@ require ( github.com/sagernet/sing-dns v0.2.3 github.com/spf13/cobra v1.8.0 github.com/xmdhs/clash2singbox v0.0.2 - golang.org/x/sys v0.25.0 - google.golang.org/grpc v1.67.0 - google.golang.org/protobuf v1.34.2 + golang.org/x/sys v0.26.0 + google.golang.org/grpc v1.67.1 + google.golang.org/protobuf v1.35.1 gopkg.in/yaml.v3 v3.0.1 ) @@ -186,6 +186,7 @@ require ( require ( github.com/DataDog/zstd v1.4.1 // indirect + github.com/biter777/countries v1.7.5 // indirect github.com/cenkalti/backoff/v4 v4.1.1 // indirect github.com/cespare/xxhash v1.1.0 // indirect github.com/cosmos/gorocksdb v1.2.0 // indirect @@ -254,7 +255,7 @@ require ( github.com/pion/transport/v2 v2.2.3 // indirect github.com/pion/transport/v3 v3.0.1 // indirect github.com/pion/turn/v3 v3.0.1 // indirect - github.com/pires/go-proxyproto v0.7.0 // indirect + github.com/pires/go-proxyproto v0.8.0 // indirect github.com/quic-go/qpack v0.4.0 // indirect github.com/quic-go/qtls-go1-20 v0.4.1 // indirect github.com/quic-go/quic-go v0.46.0 // indirect @@ -289,12 +290,12 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect go4.org/netipx v0.0.0-20231129151722-fdeea329fbba // indirect - golang.org/x/crypto v0.27.0 // indirect + golang.org/x/crypto v0.28.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.29.0 + golang.org/x/net v0.30.0 golang.org/x/sync v0.8.0 // indirect - golang.org/x/text v0.18.0 // indirect + golang.org/x/text v0.19.0 // indirect golang.org/x/time v0.5.0 // indirect golang.org/x/tools v0.22.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect @@ -302,12 +303,12 @@ require ( lukechampine.com/blake3 v1.3.0 // indirect ) -replace github.com/sagernet/sing-box => github.com/hiddify/hiddify-sing-box v1.8.9-0.20241020111745-22b807080fe7 +replace github.com/sagernet/sing-box => github.com/hiddify/hiddify-sing-box v1.8.9-0.20241110203637-1f1d31677f7f -replace github.com/xtls/xray-core => github.com/hiddify/xray-core v0.0.0-20241019134126-3f94892df016 +replace github.com/xtls/xray-core => github.com/hiddify/xray-core v0.0.0-20241110202159-0fd7ffea9361 replace github.com/sagernet/wireguard-go => github.com/hiddify/wireguard-go v0.0.0-20240727191222-383c1da14ff1 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-20240928221833-190b549d5222 +replace github.com/hiddify/ray2sing => github.com/hiddify/ray2sing v0.0.0-20241110203152-4c6984597d36 diff --git a/go.sum b/go.sum index 85bd3c58..5acaf9b7 100644 --- a/go.sum +++ b/go.sum @@ -41,6 +41,8 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24 github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/biter777/countries v1.7.5 h1:MJ+n3+rSxWQdqVJU8eBy9RqcdH6ePPn4PJHocVWUa+Q= +github.com/biter777/countries v1.7.5/go.mod h1:1HSpZ526mYqKJcpT5Ti1kcGQ0L0SrXWIaptUWjFfv2E= github.com/caddyserver/certmagic v0.20.0 h1:bTw7LcEZAh9ucYCRXyCpIrSAGplplI0vGYJ4BpCQ/Fc= github.com/caddyserver/certmagic v0.20.0/go.mod h1:N4sXgpICQUskEWpj7zVzvWD41p3NYacrNoZYiRM2jTg= github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= @@ -242,16 +244,16 @@ github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= github.com/hectane/go-acl v0.0.0-20230122075934-ca0b05cb1adb h1:PGufWXXDq9yaev6xX1YQauaO1MV90e6Mpoq1I7Lz/VM= github.com/hectane/go-acl v0.0.0-20230122075934-ca0b05cb1adb/go.mod h1:QiyDdbZLaJ/mZP4Zwc9g2QsfaEA4o7XvvgZegSci5/E= -github.com/hiddify/hiddify-sing-box v1.8.9-0.20241020111745-22b807080fe7 h1:+eeJtla199xUya0DonMvsMhpr/rsQrM5ePFTgfJZunI= -github.com/hiddify/hiddify-sing-box v1.8.9-0.20241020111745-22b807080fe7/go.mod h1:6apAGQPqJIb58BIYsr66tu49S5UcCNyuv1lVX+72eQA= -github.com/hiddify/ray2sing v0.0.0-20240928221833-190b549d5222 h1:+MFxFxoWCA44WhqIixqL/Zkt4DwnqhQvafS0Dm4+dKM= -github.com/hiddify/ray2sing v0.0.0-20240928221833-190b549d5222/go.mod h1:cFEg1b0eBgL9kBgIPAD71lHO1Q5g20PZL4dUGhQpAO8= +github.com/hiddify/hiddify-sing-box v1.8.9-0.20241110203637-1f1d31677f7f h1:3PqROrv7EjQKUTQLsG85MwXC6pRUcrx3qQp+eLXfjKc= +github.com/hiddify/hiddify-sing-box v1.8.9-0.20241110203637-1f1d31677f7f/go.mod h1:up1OUi36rUNxeEGjXBXwp4J1Kemsm0OKg5X98Asilew= +github.com/hiddify/ray2sing v0.0.0-20241110203152-4c6984597d36 h1:jOXVV76YjIqOEgna1hf6TdVRdzufR4bVzauS349qZ9s= +github.com/hiddify/ray2sing v0.0.0-20241110203152-4c6984597d36/go.mod h1:soYE48y/Q2HtgRFpcX6LcekVyigy7IELYw4fmIGwLSA= 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= github.com/hiddify/wireguard-go v0.0.0-20240727191222-383c1da14ff1/go.mod h1:K4J7/npM+VAMUeUmTa2JaA02JmyheP0GpRBOUvn3ecc= -github.com/hiddify/xray-core v0.0.0-20241019134126-3f94892df016 h1:7nNtURFd+e/SJyq/tnd7NzHBjupolYfc2N+TAWt/SkM= -github.com/hiddify/xray-core v0.0.0-20241019134126-3f94892df016/go.mod h1:D35b6Q0dCRvGKVMJbx18+8vSXtJoyvVVUz2Ww8Yg+T0= +github.com/hiddify/xray-core v0.0.0-20241110202159-0fd7ffea9361 h1:ucSVezymbKYaWGY97FQKJ85X28tdCcbMXeB7f06AStI= +github.com/hiddify/xray-core v0.0.0-20241110202159-0fd7ffea9361/go.mod h1:c3FI6cl7kX+2bonpZfs8cEWZ5vDJqKFY/QZ2/NGAABg= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= github.com/imkira/go-observer/v2 v2.0.0-20230629064422-8e0b61f11f1b h1:1+115FqGoS8p6Iry9AYmrcWDvSveH0F7P2nX1LU00qg= @@ -418,8 +420,8 @@ github.com/pion/transport/v3 v3.0.1 h1:gDTlPJwROfSfz6QfSi0ZmeCSkFcnWWiiR9ES0ouAN github.com/pion/transport/v3 v3.0.1/go.mod h1:UY7kiITrlMv7/IKgd5eTUcaahZx5oUN3l9SzK5f5xE0= github.com/pion/turn/v3 v3.0.1 h1:wLi7BTQr6/Q20R0vt/lHbjv6y4GChFtC33nkYbasoT8= github.com/pion/turn/v3 v3.0.1/go.mod h1:MrJDKgqryDyWy1/4NT9TWfXWGMC7UHT6pJIv1+gMeNE= -github.com/pires/go-proxyproto v0.7.0 h1:IukmRewDQFWC7kfnb66CSomk2q/seBuilHBYFwyq0Hs= -github.com/pires/go-proxyproto v0.7.0/go.mod h1:Vz/1JPY/OACxWGQNIRY2BeyDmpoaWmEP40O9LbuiFR4= +github.com/pires/go-proxyproto v0.8.0 h1:5unRmEAPbHXHuLjDg01CxJWf91cw3lKHc/0xzKpXEe0= +github.com/pires/go-proxyproto v0.8.0/go.mod h1:iknsfgnH8EkjrMeMyvfKByp9TiBZCKZM0jx2xmKqnVY= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -625,8 +627,8 @@ golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5 golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE= golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= -golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= -golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= +golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= @@ -675,8 +677,8 @@ golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= -golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= -golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= +golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -738,16 +740,16 @@ golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU= -golang.org/x/term v0.24.0 h1:Mh5cbb+Zk2hqqXNO7S1iTjEphVL+jb8ZWaqh/g+JWkM= -golang.org/x/term v0.24.0/go.mod h1:lOBK/LVxemqiMij05LGJ0tzNr8xlmwBRJ81PX6wVLH8= +golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24= +golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -756,8 +758,8 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= @@ -812,8 +814,8 @@ google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8 google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= google.golang.org/grpc v1.32.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= -google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= +google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E= +google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -824,8 +826,8 @@ google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= -google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= +google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= +google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= 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= diff --git a/platform/desktop/cmd_interface.go b/platform/desktop/cmd_interface.go index 762275d1..69fff29c 100644 --- a/platform/desktop/cmd_interface.go +++ b/platform/desktop/cmd_interface.go @@ -4,6 +4,7 @@ package main #include */ import "C" + import ( "unsafe" diff --git a/platform/desktop/custom.go b/platform/desktop/custom.go index 2026d02f..67e88f28 100644 --- a/platform/desktop/custom.go +++ b/platform/desktop/custom.go @@ -1,79 +1,193 @@ package main /* +#include +#include #include "stdint.h" + +static void init_signals() { + stack_t ss = {}; + ss.ss_sp = malloc(SIGSTKSZ); + ss.ss_size = SIGSTKSZ; + ss.ss_flags = 0; + sigaltstack(&ss, NULL); + + struct sigaction sa = {}; + sa.sa_flags = SA_ONSTACK; + sigemptyset(&sa.sa_mask); + + // Add handlers for specific signals + sigaction(SIGABRT, &sa, NULL); + sigaction(SIGSEGV, &sa, NULL); + sigaction(SIGBUS, &sa, NULL); + sigaction(SIGILL, &sa, NULL); + sigaction(SIGFPE, &sa, NULL); +} +*/ +/* +static void cleanup_signals() { + stack_t ss = {}; + ss.ss_flags = SS_DISABLE; + sigaltstack(&ss, NULL); +} */ import "C" import ( - hcore "github.com/hiddify/hiddify-core/v2/hcore" + "os" + "os/signal" + "runtime" + "syscall" + "unsafe" + hcore "github.com/hiddify/hiddify-core/v2/hcore" "github.com/sagernet/sing-box/log" ) +func init() { + runtime.LockOSThread() + C.init_signals() + runtime.UnlockOSThread() + + go handleSignals() + + // Your other initialization code can go here +} + +// Signal handling function +func handleSignals() { + signalChan := make(chan os.Signal, 1) + signal.Notify(signalChan, syscall.SIGINT, syscall.SIGURG) + + for { + <-signalChan + // switch sig { + // case syscall.SIGINT, syscall.SIGTERM: + // // runtime.LockOSThread() // Lock to the current OS thread + // // defer runtime.UnlockOSThread() + // log.Info("Received signal:", sig) + + // // Call stop function or perform cleanup + // if err := stop(); err != nil { + // log.Error("Error stopping the application:", err) + // } + // log.Info("Application stopped gracefully.") + // } + } +} + +func main() {} + +//export cleanup +func cleanup() { + runtime.LockOSThread() + defer runtime.UnlockOSThread() + C.cleanup_signals() +} + +func emptyOrErrorC(err error) *C.char { + runtime.LockOSThread() + defer runtime.UnlockOSThread() + + if err == nil { + return C.CString("") + } + log.Error(err.Error()) + str := C.CString(err.Error()) + runtime.SetFinalizer(unsafe.Pointer(str), func(p unsafe.Pointer) { + C.free(p) + }) + return str +} + //export setup -func setup(baseDir *C.char, workingDir *C.char, tempDir *C.char, mode C.int, listen *C.char, secret *C.char, statusPort C.longlong, debug bool) (CErr *C.char) { - // err := hcore.Setup(C.GoString(baseDir), C.GoString(workingDir), C.GoString(tempDir), int64(statusPort), debug) - err := hcore.Setup(hcore.SetupParameters{ +func setup(baseDir *C.char, workingDir *C.char, tempDir *C.char, mode C.int, listen *C.char, secret *C.char, statusPort C.longlong, debug bool) *C.char { + runtime.LockOSThread() + defer runtime.UnlockOSThread() + + // Ensure signals are initialized + C.init_signals() + + params := hcore.SetupRequest{ BasePath: C.GoString(baseDir), WorkingDir: C.GoString(workingDir), TempDir: C.GoString(tempDir), FlutterStatusPort: int64(statusPort), - Debug: debug, + Debug: bool(debug), Mode: hcore.SetupMode(mode), Listen: C.GoString(listen), Secret: C.GoString(secret), - }) + } + err := hcore.Setup(¶ms) return emptyOrErrorC(err) } +//export freeString +func freeString(str *C.char) { + runtime.LockOSThread() + defer runtime.UnlockOSThread() + C.free(unsafe.Pointer(str)) +} + //export start -func start(configPath *C.char, disableMemoryLimit bool) (CErr *C.char) { +func start(configPath *C.char, disableMemoryLimit bool) *C.char { + runtime.LockOSThread() + defer runtime.UnlockOSThread() + _, err := hcore.Start(&hcore.StartRequest{ ConfigPath: C.GoString(configPath), EnableOldCommandServer: true, - DisableMemoryLimit: disableMemoryLimit, + DisableMemoryLimit: bool(disableMemoryLimit), }) return emptyOrErrorC(err) } //export stop -func stop() (CErr *C.char) { +func stop() *C.char { + runtime.LockOSThread() + defer runtime.UnlockOSThread() + _, err := hcore.Stop() return emptyOrErrorC(err) } //export restart -func restart(configPath *C.char, disableMemoryLimit bool) (CErr *C.char) { +func restart(configPath *C.char, disableMemoryLimit bool) *C.char { + runtime.LockOSThread() + defer runtime.UnlockOSThread() + _, err := hcore.Restart(&hcore.StartRequest{ ConfigPath: C.GoString(configPath), EnableOldCommandServer: true, - DisableMemoryLimit: disableMemoryLimit, + DisableMemoryLimit: bool(disableMemoryLimit), }) return emptyOrErrorC(err) } -func emptyOrErrorC(err error) *C.char { - if err == nil { - return C.CString("") - } - log.Error(err.Error()) - return C.CString(err.Error()) -} - -func main() {} - //export GetServerPublicKey -func GetServerPublicKey() []byte { - return hcore.GetGrpcServerPublicKey() +func GetServerPublicKey() *C.char { + runtime.LockOSThread() + defer runtime.UnlockOSThread() + + publicKey := hcore.GetGrpcServerPublicKey() + return C.CString(string(publicKey)) // Return as C string, caller must free } //export AddGrpcClientPublicKey -func AddGrpcClientPublicKey(clientPublicKey []byte) error { - return hcore.AddGrpcClientPublicKey(clientPublicKey) +func AddGrpcClientPublicKey(clientPublicKey *C.char) *C.char { + runtime.LockOSThread() + defer runtime.UnlockOSThread() + + // Convert C string to Go byte slice + clientKey := C.GoBytes(unsafe.Pointer(clientPublicKey), C.int(len(C.GoString(clientPublicKey)))) + err := hcore.AddGrpcClientPublicKey(clientKey) + return emptyOrErrorC(err) } -//export close -func close(mode C.int) { - hcore.Close(hcore.SetupMode(int32(mode))) +//export closeGrpc +func closeGrpc(mode C.int) { + runtime.LockOSThread() + defer runtime.UnlockOSThread() + + hcore.Close(hcore.SetupMode(mode)) } diff --git a/platform/mobile/mobile.go b/platform/mobile/mobile.go index dc85e9c2..73c063d6 100644 --- a/platform/mobile/mobile.go +++ b/platform/mobile/mobile.go @@ -9,7 +9,7 @@ import ( ) func Setup(baseDir string, workingDir string, tempDir string, mode int, listen string, secret string, debug bool) error { - return hcore.Setup(hcore.SetupParameters{ + return hcore.Setup(&hcore.SetupRequest{ BasePath: baseDir, WorkingDir: workingDir, TempDir: tempDir, diff --git a/v2/config/config.go b/v2/config/config.go index 7c185691..a1bd82f4 100644 --- a/v2/config/config.go +++ b/v2/config/config.go @@ -68,7 +68,7 @@ func BuildConfig(opt HiddifyOptions, input option.Options) (*option.Options, err options.DNS = &option.DNSOptions{ StaticIPs: map[string][]string{}, } - // setClashAPI(&options, &opt) + setClashAPI(&options, &opt) setLog(&options, &opt) setInbound(&options, &opt) setDns(&options, &opt) diff --git a/v2/extension/server/run_server.go b/v2/extension/server/run_server.go index b4a501f8..b8778f9a 100644 --- a/v2/extension/server/run_server.go +++ b/v2/extension/server/run_server.go @@ -17,7 +17,7 @@ import ( ) func StartTestExtensionServer() { - hcore.Setup(hcore.SetupParameters{ + hcore.Setup(&hcore.SetupRequest{ BasePath: "./tmp", WorkingDir: "./", TempDir: "./tmp", @@ -25,7 +25,7 @@ func StartTestExtensionServer() { Listen: "", Secret: "", Debug: false, - Mode: hcore.OLD, + Mode: hcore.SetupMode_OLD, }) StartExtensionServer() } diff --git a/v2/hcore/config.go b/v2/hcore/buildconfighelper.go similarity index 79% rename from v2/hcore/config.go rename to v2/hcore/buildconfighelper.go index 75a87b51..99897da6 100644 --- a/v2/hcore/config.go +++ b/v2/hcore/buildconfighelper.go @@ -44,13 +44,13 @@ func BuildConfig(in *StartRequest) (*option.Options, error) { } if !in.EnableRawConfig { - hcontent, err := json.MarshalIndent(HiddifyOptions, "", " ") + hcontent, err := json.MarshalIndent(static.HiddifyOptions, "", " ") if err != nil { return nil, err } Log(LogLevel_DEBUG, LogType_CORE, "Building config ", string(hcontent)) - return config.BuildConfig(*HiddifyOptions, parsedContent) + return config.BuildConfig(*static.HiddifyOptions, parsedContent) } @@ -68,17 +68,21 @@ func Parse(in *ParseRequest) (*ParseResponse, error) { }) content := in.Content - if in.TempPath != "" { - contentBytes, err := os.ReadFile(in.TempPath) + if content == "" { + path := in.TempPath + if path == "" { + path = in.ConfigPath + } + contentBytes, err := os.ReadFile(path) content = string(contentBytes) - os.Chdir(filepath.Dir(in.ConfigPath)) + // os.Chdir(filepath.Dir(in.ConfigPath)) if err != nil { return nil, err } } - config, err := config.ParseConfigContent(content, true, HiddifyOptions, false) + config, err := config.ParseConfigContent(content, true, static.HiddifyOptions, false) if err != nil { return &ParseResponse{ ResponseCode: hcommon.ResponseCode_FAILED, @@ -106,7 +110,7 @@ func (s *CoreService) ChangeHiddifySettings(ctx context.Context, in *ChangeHiddi } func ChangeHiddifySettings(in *ChangeHiddifySettingsRequest) (*CoreInfoResponse, error) { - HiddifyOptions = config.DefaultHiddifyOptions() + static.HiddifyOptions = config.DefaultHiddifyOptions() if in.HiddifySettingsJson == "" { return &CoreInfoResponse{}, nil } @@ -115,18 +119,18 @@ func ChangeHiddifySettings(in *ChangeHiddifySettingsRequest) (*CoreInfoResponse, Id: "HiddifySettingsJson", Value: in.HiddifySettingsJson, }) - err := json.Unmarshal([]byte(in.HiddifySettingsJson), HiddifyOptions) + err := json.Unmarshal([]byte(in.HiddifySettingsJson), static.HiddifyOptions) if err != nil { return nil, err } - if HiddifyOptions.Warp.WireguardConfigStr != "" { - err := json.Unmarshal([]byte(HiddifyOptions.Warp.WireguardConfigStr), &HiddifyOptions.Warp.WireguardConfig) + if static.HiddifyOptions.Warp.WireguardConfigStr != "" { + err := json.Unmarshal([]byte(static.HiddifyOptions.Warp.WireguardConfigStr), &static.HiddifyOptions.Warp.WireguardConfig) if err != nil { return nil, err } } - if HiddifyOptions.Warp2.WireguardConfigStr != "" { - err := json.Unmarshal([]byte(HiddifyOptions.Warp2.WireguardConfigStr), &HiddifyOptions.Warp2.WireguardConfig) + if static.HiddifyOptions.Warp2.WireguardConfigStr != "" { + err := json.Unmarshal([]byte(static.HiddifyOptions.Warp2.WireguardConfigStr), &static.HiddifyOptions.Warp2.WireguardConfig) if err != nil { return nil, err } @@ -143,10 +147,10 @@ func GenerateConfig(in *GenerateConfigRequest) (*GenerateConfigResponse, error) Log(LogLevel_FATAL, LogType_CONFIG, err.Error()) StopAndAlert(MessageType_UNEXPECTED_ERROR, err.Error()) }) - if HiddifyOptions == nil { - HiddifyOptions = config.DefaultHiddifyOptions() + if static.HiddifyOptions == nil { + static.HiddifyOptions = config.DefaultHiddifyOptions() } - config, err := generateConfigFromFile(in.Path, *HiddifyOptions) + config, err := generateConfigFromFile(in.Path, *static.HiddifyOptions) if err != nil { return nil, err } diff --git a/v2/hcore/command_client.go b/v2/hcore/command_client.go index 584c9170..138307c0 100644 --- a/v2/hcore/command_client.go +++ b/v2/hcore/command_client.go @@ -1,83 +1,83 @@ package hcore -import ( - "github.com/sagernet/sing-box/experimental/libbox" - timestamppb "google.golang.org/protobuf/types/known/timestamppb" -) +// import ( +// "github.com/sagernet/sing-box/experimental/libbox" +// timestamppb "google.golang.org/protobuf/types/known/timestamppb" +// ) -var _ libbox.CommandClientHandler = (*CommandClientHandler)(nil) +// var _ libbox.CommandClientHandler = (*CommandClientHandler)(nil) -const ( - CommandCli = "core" -) +// const ( +// CommandCli = "core" +// ) -type CommandClientHandler struct { - command int32 -} +// type CommandClientHandler struct { +// command int32 +// } -func (cch *CommandClientHandler) Connected() { - Log(LogLevel_DEBUG, LogType_CORE, "CONNECTED") -} +// func (cch *CommandClientHandler) Connected() { +// Log(LogLevel_DEBUG, LogType_CORE, "CONNECTED") +// } -func (cch *CommandClientHandler) Disconnected(message string) { - Log(LogLevel_DEBUG, LogType_CORE, "DISCONNECTED: ", message) -} +// func (cch *CommandClientHandler) Disconnected(message string) { +// Log(LogLevel_DEBUG, LogType_CORE, "DISCONNECTED: ", message) +// } -func (cch *CommandClientHandler) ClearLog() { - Log(LogLevel_DEBUG, LogType_CORE, "clear log") -} +// func (cch *CommandClientHandler) ClearLog() { +// Log(LogLevel_DEBUG, LogType_CORE, "clear log") +// } -func (cch *CommandClientHandler) WriteLog(message string) { - Log(LogLevel_DEBUG, LogType_CORE, "log: ", message) -} +// func (cch *CommandClientHandler) WriteLog(message string) { +// Log(LogLevel_DEBUG, LogType_CORE, "log: ", message) +// } -func (cch *CommandClientHandler) WriteStatus(message *libbox.StatusMessage) { - systemInfoObserver.Emit(&SystemInfo{ - ConnectionsIn: message.ConnectionsIn, - ConnectionsOut: message.ConnectionsOut, - Uplink: message.Uplink, - Downlink: message.Downlink, - UplinkTotal: message.UplinkTotal, - DownlinkTotal: message.DownlinkTotal, - Memory: message.Memory, - Goroutines: message.Goroutines, - }) - Log(LogLevel_DEBUG, LogType_CORE, "Memory: ", libbox.FormatBytes(message.Memory), ", Goroutines: ", message.Goroutines) -} +// func (cch *CommandClientHandler) WriteStatus(message *libbox.StatusMessage) { +// static.systemInfoObserver.Emit(&SystemInfo{ +// ConnectionsIn: message.ConnectionsIn, +// ConnectionsOut: message.ConnectionsOut, +// Uplink: message.Uplink, +// Downlink: message.Downlink, +// UplinkTotal: message.UplinkTotal, +// DownlinkTotal: message.DownlinkTotal, +// Memory: message.Memory, +// Goroutines: message.Goroutines, +// }) +// Log(LogLevel_DEBUG, LogType_CORE, "Memory: ", libbox.FormatBytes(message.Memory), ", Goroutines: ", message.Goroutines) +// } -func (cch *CommandClientHandler) WriteGroups(message libbox.OutboundGroupIterator) { - if message == nil { - return - } - groups := OutboundGroupList{} - for message.HasNext() { - group := message.Next() - items := group.GetItems() - groupItems := []*OutboundInfo{} - for items.HasNext() { - item := items.Next() - groupItems = append(groupItems, - &OutboundInfo{ - Tag: item.Tag, - Type: item.Type, - UrlTestTime: ×tamppb.Timestamp{Seconds: item.URLTestTime}, - UrlTestDelay: item.URLTestDelay, - }, - ) - } - groups.Items = append(groups.Items, &OutboundGroup{Tag: group.Tag, Type: group.Type, Selected: nil, Items: groupItems}) - } - if cch.command == libbox.CommandGroupInfoOnly { - mainOutboundsInfoObserver.Emit(&groups) - } else { - outboundsInfoObserver.Emit(&groups) - } -} +// func (cch *CommandClientHandler) WriteGroups(message libbox.OutboundGroupIterator) { +// if message == nil { +// return +// } +// groups := OutboundGroupList{} +// for message.HasNext() { +// group := message.Next() +// items := group.GetItems() +// groupItems := []*OutboundInfo{} +// for items.HasNext() { +// item := items.Next() +// groupItems = append(groupItems, +// &OutboundInfo{ +// Tag: item.Tag, +// Type: item.Type, +// UrlTestTime: ×tamppb.Timestamp{Seconds: item.URLTestTime}, +// UrlTestDelay: item.URLTestDelay, +// }, +// ) +// } +// groups.Items = append(groups.Items, &OutboundGroup{Tag: group.Tag, Type: group.Type, Selected: nil, Items: groupItems}) +// } +// if cch.command == libbox.CommandGroupInfoOnly { +// static.mainOutboundsInfoObserver.Emit(&groups) +// } else { +// static.outboundsInfoObserver.Emit(&groups) +// } +// } -func (cch *CommandClientHandler) InitializeClashMode(modeList libbox.StringIterator, currentMode string) { - Log(LogLevel_DEBUG, LogType_CORE, "initial clash mode: ", currentMode) -} +// func (cch *CommandClientHandler) InitializeClashMode(modeList libbox.StringIterator, currentMode string) { +// Log(LogLevel_DEBUG, LogType_CORE, "initial clash mode: ", currentMode) +// } -func (cch *CommandClientHandler) UpdateClashMode(newMode string) { - Log(LogLevel_DEBUG, LogType_CORE, "update clash mode: ", newMode) -} +// func (cch *CommandClientHandler) UpdateClashMode(newMode string) { +// Log(LogLevel_DEBUG, LogType_CORE, "update clash mode: ", newMode) +// } diff --git a/v2/hcore/command_server.go b/v2/hcore/command_server.go index 4b9dc9e1..edd006a1 100644 --- a/v2/hcore/command_server.go +++ b/v2/hcore/command_server.go @@ -1,44 +1,44 @@ package hcore -import ( - "github.com/sagernet/sing-box/experimental/libbox" -) - -var commandServer *libbox.CommandServer - -type CommandServerHandler struct{} - -func (csh *CommandServerHandler) ServiceReload() error { - Log(LogLevel_DEBUG, LogType_CORE, "Reloading service") - - Stop() - _, err := StartService(&StartRequest{ - EnableOldCommandServer: true, - DelayStart: true, - }, nil) - return err -} - -func (csh *CommandServerHandler) GetSystemProxyStatus() *libbox.SystemProxyStatus { - Log(LogLevel_DEBUG, LogType_CORE, "Getting system proxy status") - return &libbox.SystemProxyStatus{Available: true, Enabled: false} -} - -func (csh *CommandServerHandler) SetSystemProxyEnabled(isEnabled bool) error { - Log(LogLevel_DEBUG, LogType_CORE, "Setting system proxy status, enabled? ", isEnabled) - return csh.ServiceReload() -} - -func (csh *CommandServerHandler) PostServiceClose() { - if commandServer != nil { - commandServer.Close() - commandServer.SetService(nil) - } - commandServer = nil -} - -func startCommandServer(sbox *libbox.BoxService) error { - commandServer = libbox.NewCommandServer(&CommandServerHandler{}, 300) - commandServer.SetService(sbox) - return commandServer.Start() -} +// import ( +// "github.com/sagernet/sing-box/experimental/libbox" +// ) + +// var commandServer *libbox.CommandServer + +// type CommandServerHandler struct{} + +// func (csh *CommandServerHandler) ServiceReload() error { +// Log(LogLevel_DEBUG, LogType_CORE, "Reloading service") + +// Stop() +// _, err := StartService(&StartRequest{ +// EnableOldCommandServer: true, +// DelayStart: true, +// }, nil) +// return err +// } + +// func (csh *CommandServerHandler) GetSystemProxyStatus() *libbox.SystemProxyStatus { +// Log(LogLevel_DEBUG, LogType_CORE, "Getting system proxy status") +// return &libbox.SystemProxyStatus{Available: true, Enabled: false} +// } + +// func (csh *CommandServerHandler) SetSystemProxyEnabled(isEnabled bool) error { +// Log(LogLevel_DEBUG, LogType_CORE, "Setting system proxy status, enabled? ", isEnabled) +// return csh.ServiceReload() +// } + +// func (csh *CommandServerHandler) PostServiceClose() { +// if commandServer != nil { +// commandServer.Close() +// commandServer.SetService(nil) +// } +// commandServer = nil +// } + +// func startCommandServer(sbox *libbox.BoxService) error { +// commandServer = libbox.NewCommandServer(&CommandServerHandler{}, 300) +// commandServer.SetService(sbox) +// return commandServer.Start() +// } diff --git a/v2/hcore/commands.go b/v2/hcore/commands.go index c535ea4d..c0425a93 100644 --- a/v2/hcore/commands.go +++ b/v2/hcore/commands.go @@ -2,12 +2,12 @@ package hcore import ( "context" + "fmt" "time" hcommon "github.com/hiddify/hiddify-core/v2/hcommon" adapter "github.com/sagernet/sing-box/adapter" "github.com/sagernet/sing-box/common/urltest" - "github.com/sagernet/sing-box/experimental/libbox" outbound "github.com/sagernet/sing-box/outbound" common "github.com/sagernet/sing/common" "github.com/sagernet/sing/common/batch" @@ -15,51 +15,40 @@ import ( "google.golang.org/grpc" ) -var ( - systemInfoObserver = NewObserver[*SystemInfo](1) - outboundsInfoObserver = NewObserver[*OutboundGroupList](1) - mainOutboundsInfoObserver = NewObserver[*OutboundGroupList](1) -) - -var ( - statusClient *libbox.CommandClient - groupClient *libbox.CommandClient - groupInfoOnlyClient *libbox.CommandClient -) - func (s *CoreService) GetSystemInfo(req *hcommon.Empty, stream grpc.ServerStreamingServer[SystemInfo]) error { - if statusClient == nil { - statusClient = libbox.NewCommandClient( - &CommandClientHandler{ - command: libbox.CommandStatus, - // port: s.port, - }, - &libbox.CommandClientOptions{ - Command: libbox.CommandStatus, - StatusInterval: 1000000000, // 1000ms debounce - }, - ) + return fmt.Errorf("not implemented yet") + // if statusClient == nil { + // statusClient = libbox.NewCommandClient( + // &CommandClientHandler{ + // command: libbox.CommandStatus, + // // port: s.port, + // }, + // &libbox.CommandClientOptions{ + // Command: libbox.CommandStatus, + // StatusInterval: 1000000000, // 1000ms debounce + // }, + // ) - defer func() { - statusClient.Disconnect() - statusClient = nil - }() - statusClient.Connect() - } + // defer func() { + // statusClient.Disconnect() + // statusClient = nil + // }() + // statusClient.Connect() + // } - sub, done, _ := systemInfoObserver.Subscribe() + // sub, done, _ := static.systemInfoObserver.Subscribe() - for { - select { - case <-stream.Context().Done(): - return nil - case <-done: - return nil - case info := <-sub: - stream.Send(info) - // case <-time.After(1000 * time.Millisecond): - } - } + // for { + // select { + // case <-stream.Context().Done(): + // return nil + // case <-done: + // return nil + // case info := <-sub: + // stream.Send(info) + // // case <-time.After(1000 * time.Millisecond): + // } + // } } // func (s *CoreService) OutboundsInfo(req *hcommon.Empty, stream grpc.ServerStreamingServer[OutboundGroupList]) error { @@ -151,7 +140,7 @@ func SelectOutbound(in *SelectOutboundRequest) (*hcommon.Response, error) { // Message: "", // }, nil Log(LogLevel_DEBUG, LogType_CORE, "select outbound: ", in.GroupTag, " -> ", in.OutboundTag) - outboundGroup, isLoaded := Box.GetInstance().Router().Outbound(in.GroupTag) + outboundGroup, isLoaded := static.Box.GetInstance().Router().Outbound(in.GroupTag) if !isLoaded { return &hcommon.Response{ Code: hcommon.ResponseCode_FAILED, @@ -171,8 +160,17 @@ func SelectOutbound(in *SelectOutboundRequest) (*hcommon.Response, error) { Message: E.New("outbound not found in selector:: ", in.GroupTag).Error(), }, E.New("outbound not found in selector: ", in.GroupTag) } - - Box.UrlTestHistory().Observer().Emit(2) + Log(LogLevel_DEBUG, LogType_CORE, "Trying to ping outbound: ", in.OutboundTag) + go func() { + for _, detour := range static.Box.GetInstance().Router().Outbounds() { + if urlTest, ok := detour.(*outbound.URLTest); ok { + if urlTest.ForceRecheckOutbound(in.OutboundTag) == nil { + break + } + } + } + }() + static.Box.UrlTestHistory().Observer().Emit(2) return &hcommon.Response{ Code: hcommon.ResponseCode_OK, Message: "", @@ -199,10 +197,10 @@ func UrlTest(in *UrlTestRequest) (*hcommon.Response, error) { groupTag := in.GroupTag - if Box == nil { + if static.Box == nil { return nil, E.New("service not ready") } - abstractOutboundGroup, isLoaded := Box.GetInstance().Router().Outbound(groupTag) + abstractOutboundGroup, isLoaded := static.Box.GetInstance().Router().Outbound(groupTag) if !isLoaded { return &hcommon.Response{ Code: hcommon.ResponseCode_FAILED, @@ -221,9 +219,9 @@ func UrlTest(in *UrlTestRequest) (*hcommon.Response, error) { if isURLTest { go urlTest.CheckOutbounds() } else { - historyStorage := Box.UrlTestHistory() + historyStorage := static.Box.UrlTestHistory() outbounds := common.Filter(common.Map(outboundGroup.All(), func(it string) adapter.Outbound { - itOutbound, _ := Box.GetInstance().Router().Outbound(it) + itOutbound, _ := static.Box.GetInstance().Router().Outbound(it) return itOutbound }), func(it adapter.Outbound) bool { if it == nil { @@ -232,12 +230,12 @@ func UrlTest(in *UrlTestRequest) (*hcommon.Response, error) { _, isGroup := it.(adapter.OutboundGroup) return !isGroup }) - b, _ := batch.New(Box.Context(), batch.WithConcurrencyNum[any](10)) + b, _ := batch.New(static.Box.Context(), batch.WithConcurrencyNum[any](10)) for _, detour := range outbounds { outboundToTest := detour outboundTag := outboundToTest.Tag() b.Go(outboundTag, func() (any, error) { - t, err := urltest.URLTest(Box.Context(), "", outboundToTest) + t, err := urltest.URLTest(static.Box.Context(), "", outboundToTest) if err != nil { // historyStorage.DeleteURLTestHistory(outboundTag) t = 65535 diff --git a/v2/hcore/coreinfo.go b/v2/hcore/coreinfo.go index 2509c645..088cea6d 100644 --- a/v2/hcore/coreinfo.go +++ b/v2/hcore/coreinfo.go @@ -7,34 +7,29 @@ import ( "google.golang.org/grpc" ) -var ( - coreInfoObserver = NewObserver[*CoreInfoResponse](1) - CoreState = CoreStates_STOPPED -) - func SetCoreStatus(state CoreStates, msgType MessageType, message string) *CoreInfoResponse { msg := fmt.Sprintf("%s: %s %s", state.String(), msgType.String(), message) if msgType == MessageType_EMPTY { msg = fmt.Sprintf("%s: %s", state.String(), message) } Log(LogLevel_INFO, LogType_CORE, msg) - CoreState = state + static.CoreState = state info := CoreInfoResponse{ CoreState: state, MessageType: msgType, Message: message, } - coreInfoObserver.Emit(&info) + static.coreInfoObserver.Emit(&info) return &info } func (s *CoreService) CoreInfoListener(req *hcommon.Empty, stream grpc.ServerStreamingServer[CoreInfoResponse]) error { - coreSub, done, err := coreInfoObserver.Subscribe() + coreSub, done, err := static.coreInfoObserver.Subscribe() if err != nil { return err } - defer coreInfoObserver.UnSubscribe(coreSub) + defer static.coreInfoObserver.UnSubscribe(coreSub) for { select { diff --git a/v2/hcore/custom.go b/v2/hcore/custom.go index 6ffa943c..2c121359 100644 --- a/v2/hcore/custom.go +++ b/v2/hcore/custom.go @@ -2,17 +2,9 @@ package hcore import ( "github.com/hiddify/hiddify-core/v2/config" - "github.com/sagernet/sing-box/experimental/libbox" "github.com/sagernet/sing-box/log" ) -var ( - Box *libbox.BoxService - HiddifyOptions *config.HiddifyOptions - // activeConfigPath string - coreLogFactory log.Factory -) - func errorWrapper(state MessageType, err error) (*CoreInfoResponse, error) { Log(LogLevel_FATAL, LogType_CORE, err.Error()) StopAndAlert(MessageType_UNEXPECTED_ERROR, err.Error()) @@ -22,9 +14,9 @@ func errorWrapper(state MessageType, err error) (*CoreInfoResponse, error) { func StopAndAlert(msgType MessageType, message string) { SetCoreStatus(CoreStates_STOPPED, msgType, message) - if Box != nil { - Box.Close() - Box = nil + if static.Box != nil { + static.Box.Close() + static.Box = nil } } diff --git a/v2/hcore/grpc_server.go b/v2/hcore/grpc_server.go index cb2c3803..4fcca192 100644 --- a/v2/hcore/grpc_server.go +++ b/v2/hcore/grpc_server.go @@ -11,6 +11,8 @@ import ( "fmt" "log" "net" + "strconv" + "strings" hcommon "github.com/hiddify/hiddify-core/v2/hcommon" "github.com/hiddify/hiddify-core/v2/hello" @@ -68,6 +70,19 @@ var ( // StartGrpcServerByMode starts a gRPC server on the specified address with mTLS. func StartGrpcServerByMode(listenAddressG string, mode SetupMode) (*grpc.Server, error) { + if !strings.Contains(listenAddressG, ":") { + return nil, fmt.Errorf("invalid listen address (no port): %s", listenAddressG) + } + // Convert the port from string to uint16 + portStr := strings.Split(listenAddressG, ":")[1] + port, err := strconv.ParseUint(portStr, 10, 16) + if err != nil { + return nil, fmt.Errorf("failed to convert port %s to uint16: %v", portStr, err) + } + if hutils.IsPortInUse(uint16(port)) { + return nil, fmt.Errorf("port %s is already in use", portStr) + } + // Fetch the server private key and public key from the database if grpcServer[mode] != nil { Log(LogLevel_WARNING, LogType_CORE, "grpcServer already started") @@ -112,7 +127,7 @@ func StartGrpcServerByMode(listenAddressG string, mode SetupMode) (*grpc.Server, // Create a new gRPC server with TLS credentials creds := credentials.NewTLS(tlsConfig) - if mode == GRPC_BACKGROUND_INSECURE || mode == GRPC_NORMAL_INSECURE { + if mode == SetupMode_GRPC_BACKGROUND_INSECURE || mode == SetupMode_GRPC_NORMAL_INSECURE { grpcServer[mode] = grpc.NewServer() } else { grpcServer[mode] = grpc.NewServer(grpc.Creds(creds)) diff --git a/v2/hcore/hcore.pb.go b/v2/hcore/hcore.pb.go index 2909bfbd..62ca67fb 100644 --- a/v2/hcore/hcore.pb.go +++ b/v2/hcore/hcore.pb.go @@ -159,6 +159,61 @@ func (MessageType) EnumDescriptor() ([]byte, []int) { return file_v2_hcore_hcore_proto_rawDescGZIP(), []int{1} } +type SetupMode int32 + +const ( + SetupMode_OLD SetupMode = 0 + SetupMode_GRPC_NORMAL SetupMode = 1 + SetupMode_GRPC_BACKGROUND SetupMode = 2 + SetupMode_GRPC_NORMAL_INSECURE SetupMode = 3 + SetupMode_GRPC_BACKGROUND_INSECURE SetupMode = 4 +) + +// Enum value maps for SetupMode. +var ( + SetupMode_name = map[int32]string{ + 0: "OLD", + 1: "GRPC_NORMAL", + 2: "GRPC_BACKGROUND", + 3: "GRPC_NORMAL_INSECURE", + 4: "GRPC_BACKGROUND_INSECURE", + } + SetupMode_value = map[string]int32{ + "OLD": 0, + "GRPC_NORMAL": 1, + "GRPC_BACKGROUND": 2, + "GRPC_NORMAL_INSECURE": 3, + "GRPC_BACKGROUND_INSECURE": 4, + } +) + +func (x SetupMode) Enum() *SetupMode { + p := new(SetupMode) + *p = x + return p +} + +func (x SetupMode) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (SetupMode) Descriptor() protoreflect.EnumDescriptor { + return file_v2_hcore_hcore_proto_enumTypes[2].Descriptor() +} + +func (SetupMode) Type() protoreflect.EnumType { + return &file_v2_hcore_hcore_proto_enumTypes[2] +} + +func (x SetupMode) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use SetupMode.Descriptor instead. +func (SetupMode) EnumDescriptor() ([]byte, []int) { + return file_v2_hcore_hcore_proto_rawDescGZIP(), []int{2} +} + type LogLevel int32 const ( @@ -198,11 +253,11 @@ func (x LogLevel) String() string { } func (LogLevel) Descriptor() protoreflect.EnumDescriptor { - return file_v2_hcore_hcore_proto_enumTypes[2].Descriptor() + return file_v2_hcore_hcore_proto_enumTypes[3].Descriptor() } func (LogLevel) Type() protoreflect.EnumType { - return &file_v2_hcore_hcore_proto_enumTypes[2] + return &file_v2_hcore_hcore_proto_enumTypes[3] } func (x LogLevel) Number() protoreflect.EnumNumber { @@ -211,7 +266,7 @@ func (x LogLevel) Number() protoreflect.EnumNumber { // Deprecated: Use LogLevel.Descriptor instead. func (LogLevel) EnumDescriptor() ([]byte, []int) { - return file_v2_hcore_hcore_proto_rawDescGZIP(), []int{2} + return file_v2_hcore_hcore_proto_rawDescGZIP(), []int{3} } type LogType int32 @@ -247,11 +302,11 @@ func (x LogType) String() string { } func (LogType) Descriptor() protoreflect.EnumDescriptor { - return file_v2_hcore_hcore_proto_enumTypes[3].Descriptor() + return file_v2_hcore_hcore_proto_enumTypes[4].Descriptor() } func (LogType) Type() protoreflect.EnumType { - return &file_v2_hcore_hcore_proto_enumTypes[3] + return &file_v2_hcore_hcore_proto_enumTypes[4] } func (x LogType) Number() protoreflect.EnumNumber { @@ -260,7 +315,7 @@ func (x LogType) Number() protoreflect.EnumNumber { // Deprecated: Use LogType.Descriptor instead. func (LogType) EnumDescriptor() ([]byte, []int) { - return file_v2_hcore_hcore_proto_rawDescGZIP(), []int{3} + return file_v2_hcore_hcore_proto_rawDescGZIP(), []int{4} } type CoreInfoResponse struct { @@ -413,14 +468,20 @@ func (x *StartRequest) GetEnableRawConfig() bool { return false } +// Define the message equivalent of SetupParameters type SetupRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - BasePath string `protobuf:"bytes,1,opt,name=base_path,json=basePath,proto3" json:"base_path,omitempty"` - WorkingPath string `protobuf:"bytes,2,opt,name=working_path,json=workingPath,proto3" json:"working_path,omitempty"` - TempPath string `protobuf:"bytes,3,opt,name=temp_path,json=tempPath,proto3" json:"temp_path,omitempty"` + BasePath string `protobuf:"bytes,1,opt,name=base_path,json=basePath,proto3" json:"base_path,omitempty"` + WorkingDir string `protobuf:"bytes,2,opt,name=working_dir,json=workingDir,proto3" json:"working_dir,omitempty"` + TempDir string `protobuf:"bytes,3,opt,name=temp_dir,json=tempDir,proto3" json:"temp_dir,omitempty"` + FlutterStatusPort int64 `protobuf:"varint,4,opt,name=flutter_status_port,json=flutterStatusPort,proto3" json:"flutter_status_port,omitempty"` + Listen string `protobuf:"bytes,5,opt,name=listen,proto3" json:"listen,omitempty"` + Secret string `protobuf:"bytes,6,opt,name=secret,proto3" json:"secret,omitempty"` + Debug bool `protobuf:"varint,7,opt,name=debug,proto3" json:"debug,omitempty"` + Mode SetupMode `protobuf:"varint,8,opt,name=mode,proto3,enum=hcore.SetupMode" json:"mode,omitempty"` } func (x *SetupRequest) Reset() { @@ -462,20 +523,55 @@ func (x *SetupRequest) GetBasePath() string { return "" } -func (x *SetupRequest) GetWorkingPath() string { +func (x *SetupRequest) GetWorkingDir() string { if x != nil { - return x.WorkingPath + return x.WorkingDir } return "" } -func (x *SetupRequest) GetTempPath() string { +func (x *SetupRequest) GetTempDir() string { if x != nil { - return x.TempPath + return x.TempDir + } + return "" +} + +func (x *SetupRequest) GetFlutterStatusPort() int64 { + if x != nil { + return x.FlutterStatusPort + } + return 0 +} + +func (x *SetupRequest) GetListen() string { + if x != nil { + return x.Listen + } + return "" +} + +func (x *SetupRequest) GetSecret() string { + if x != nil { + return x.Secret } return "" } +func (x *SetupRequest) GetDebug() bool { + if x != nil { + return x.Debug + } + return false +} + +func (x *SetupRequest) GetMode() SetupMode { + if x != nil { + return x.Mode + } + return SetupMode_OLD +} + type SystemInfo struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -592,18 +688,19 @@ type OutboundInfo struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Tag string `protobuf:"bytes,1,opt,name=tag,proto3" json:"tag,omitempty"` - Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` - UrlTestTime *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=url_test_time,json=urlTestTime,proto3" json:"url_test_time,omitempty"` - UrlTestDelay int32 `protobuf:"varint,4,opt,name=url_test_delay,json=urlTestDelay,proto3" json:"url_test_delay,omitempty"` - Ipinfo *IpInfo `protobuf:"bytes,5,opt,name=ipinfo,proto3" json:"ipinfo,omitempty"` - IsSelected bool `protobuf:"varint,6,opt,name=is_selected,json=isSelected,proto3" json:"is_selected,omitempty"` - IsGroup bool `protobuf:"varint,7,opt,name=is_group,json=isGroup,proto3" json:"is_group,omitempty"` - IsSecure bool `protobuf:"varint,8,opt,name=is_secure,json=isSecure,proto3" json:"is_secure,omitempty"` - IsVisible bool `protobuf:"varint,9,opt,name=is_visible,json=isVisible,proto3" json:"is_visible,omitempty"` - Port uint32 `protobuf:"varint,10,opt,name=port,proto3" json:"port,omitempty"` - Host string `protobuf:"bytes,11,opt,name=host,proto3" json:"host,omitempty"` - TagDisplay string `protobuf:"bytes,12,opt,name=tag_display,json=tagDisplay,proto3" json:"tag_display,omitempty"` + Tag string `protobuf:"bytes,1,opt,name=tag,proto3" json:"tag,omitempty"` + Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` + UrlTestTime *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=url_test_time,json=urlTestTime,proto3" json:"url_test_time,omitempty"` + UrlTestDelay int32 `protobuf:"varint,4,opt,name=url_test_delay,json=urlTestDelay,proto3" json:"url_test_delay,omitempty"` + Ipinfo *IpInfo `protobuf:"bytes,5,opt,name=ipinfo,proto3,oneof" json:"ipinfo,omitempty"` + IsSelected bool `protobuf:"varint,6,opt,name=is_selected,json=isSelected,proto3" json:"is_selected,omitempty"` + IsGroup bool `protobuf:"varint,7,opt,name=is_group,json=isGroup,proto3" json:"is_group,omitempty"` + GroupSelectedOutbound *OutboundInfo `protobuf:"bytes,13,opt,name=group_selected_outbound,json=groupSelectedOutbound,proto3,oneof" json:"group_selected_outbound,omitempty"` + IsSecure bool `protobuf:"varint,8,opt,name=is_secure,json=isSecure,proto3" json:"is_secure,omitempty"` + IsVisible bool `protobuf:"varint,9,opt,name=is_visible,json=isVisible,proto3" json:"is_visible,omitempty"` + Port uint32 `protobuf:"varint,10,opt,name=port,proto3" json:"port,omitempty"` + Host string `protobuf:"bytes,11,opt,name=host,proto3" json:"host,omitempty"` + TagDisplay string `protobuf:"bytes,12,opt,name=tag_display,json=tagDisplay,proto3" json:"tag_display,omitempty"` } func (x *OutboundInfo) Reset() { @@ -687,6 +784,13 @@ func (x *OutboundInfo) GetIsGroup() bool { return false } +func (x *OutboundInfo) GetGroupSelectedOutbound() *OutboundInfo { + if x != nil { + return x.GroupSelectedOutbound + } + return nil +} + func (x *OutboundInfo) GetIsSecure() bool { if x != nil { return x.IsSecure @@ -1866,50 +1970,65 @@ var file_v2_hcore_hcore_proto_rawDesc = []byte{ 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x2a, 0x0a, 0x11, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x72, 0x61, 0x77, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x61, 0x77, 0x43, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x22, 0x6b, 0x0a, 0x0c, 0x53, 0x65, 0x74, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x62, 0x61, 0x73, 0x65, 0x50, 0x61, 0x74, 0x68, 0x12, - 0x21, 0x0a, 0x0c, 0x77, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x77, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x50, 0x61, - 0x74, 0x68, 0x12, 0x1b, 0x0a, 0x09, 0x74, 0x65, 0x6d, 0x70, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x65, 0x6d, 0x70, 0x50, 0x61, 0x74, 0x68, 0x22, - 0xbf, 0x02, 0x0a, 0x0a, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x16, - 0x0a, 0x06, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, - 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x12, 0x1e, 0x0a, 0x0a, 0x67, 0x6f, 0x72, 0x6f, 0x75, 0x74, - 0x69, 0x6e, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x67, 0x6f, 0x72, 0x6f, - 0x75, 0x74, 0x69, 0x6e, 0x65, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x5f, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0d, - 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x49, 0x6e, 0x12, 0x27, 0x0a, - 0x0f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x5f, 0x6f, 0x75, 0x74, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x4f, 0x75, 0x74, 0x12, 0x2b, 0x0a, 0x11, 0x74, 0x72, 0x61, 0x66, 0x66, 0x69, - 0x63, 0x5f, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x10, 0x74, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, - 0x62, 0x6c, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x70, 0x6c, 0x69, 0x6e, 0x6b, 0x18, 0x06, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x70, 0x6c, 0x69, 0x6e, 0x6b, 0x12, 0x1a, 0x0a, 0x08, 0x64, - 0x6f, 0x77, 0x6e, 0x6c, 0x69, 0x6e, 0x6b, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x64, - 0x6f, 0x77, 0x6e, 0x6c, 0x69, 0x6e, 0x6b, 0x12, 0x21, 0x0a, 0x0c, 0x75, 0x70, 0x6c, 0x69, 0x6e, - 0x6b, 0x5f, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x75, - 0x70, 0x6c, 0x69, 0x6e, 0x6b, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x12, 0x25, 0x0a, 0x0e, 0x64, 0x6f, - 0x77, 0x6e, 0x6c, 0x69, 0x6e, 0x6b, 0x5f, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x09, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x0d, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x69, 0x6e, 0x6b, 0x54, 0x6f, 0x74, 0x61, - 0x6c, 0x22, 0x82, 0x03, 0x0a, 0x0c, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x49, 0x6e, - 0x66, 0x6f, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x61, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x03, 0x74, 0x61, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x3e, 0x0a, 0x0d, 0x75, 0x72, 0x6c, 0x5f, - 0x74, 0x65, 0x73, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0b, 0x75, 0x72, 0x6c, - 0x54, 0x65, 0x73, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x24, 0x0a, 0x0e, 0x75, 0x72, 0x6c, 0x5f, - 0x74, 0x65, 0x73, 0x74, 0x5f, 0x64, 0x65, 0x6c, 0x61, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x0c, 0x75, 0x72, 0x6c, 0x54, 0x65, 0x73, 0x74, 0x44, 0x65, 0x6c, 0x61, 0x79, 0x12, 0x25, - 0x0a, 0x06, 0x69, 0x70, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, - 0x2e, 0x68, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x49, 0x70, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x06, 0x69, - 0x70, 0x69, 0x6e, 0x66, 0x6f, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x73, 0x5f, 0x73, 0x65, 0x6c, 0x65, - 0x63, 0x74, 0x65, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x69, 0x73, 0x53, 0x65, - 0x6c, 0x65, 0x63, 0x74, 0x65, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x69, 0x73, 0x5f, 0x67, 0x72, 0x6f, - 0x75, 0x70, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x69, 0x73, 0x47, 0x72, 0x6f, 0x75, - 0x70, 0x12, 0x1b, 0x0a, 0x09, 0x69, 0x73, 0x5f, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x18, 0x08, + 0x69, 0x67, 0x22, 0x83, 0x02, 0x0a, 0x0c, 0x53, 0x65, 0x74, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x70, 0x61, 0x74, 0x68, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x62, 0x61, 0x73, 0x65, 0x50, 0x61, 0x74, 0x68, + 0x12, 0x1f, 0x0a, 0x0b, 0x77, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x69, 0x72, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x77, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x44, 0x69, + 0x72, 0x12, 0x19, 0x0a, 0x08, 0x74, 0x65, 0x6d, 0x70, 0x5f, 0x64, 0x69, 0x72, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x07, 0x74, 0x65, 0x6d, 0x70, 0x44, 0x69, 0x72, 0x12, 0x2e, 0x0a, 0x13, + 0x66, 0x6c, 0x75, 0x74, 0x74, 0x65, 0x72, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x5f, 0x70, + 0x6f, 0x72, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x11, 0x66, 0x6c, 0x75, 0x74, 0x74, + 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x16, 0x0a, 0x06, + 0x6c, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6c, 0x69, + 0x73, 0x74, 0x65, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x12, 0x14, 0x0a, 0x05, + 0x64, 0x65, 0x62, 0x75, 0x67, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x64, 0x65, 0x62, + 0x75, 0x67, 0x12, 0x24, 0x0a, 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x10, 0x2e, 0x68, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x53, 0x65, 0x74, 0x75, 0x70, 0x4d, 0x6f, + 0x64, 0x65, 0x52, 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x22, 0xbf, 0x02, 0x0a, 0x0a, 0x53, 0x79, 0x73, + 0x74, 0x65, 0x6d, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65, 0x6d, 0x6f, 0x72, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x12, + 0x1e, 0x0a, 0x0a, 0x67, 0x6f, 0x72, 0x6f, 0x75, 0x74, 0x69, 0x6e, 0x65, 0x73, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x0a, 0x67, 0x6f, 0x72, 0x6f, 0x75, 0x74, 0x69, 0x6e, 0x65, 0x73, 0x12, + 0x25, 0x0a, 0x0e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x5f, 0x69, + 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x49, 0x6e, 0x12, 0x27, 0x0a, 0x0f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x5f, 0x6f, 0x75, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x0e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x4f, 0x75, 0x74, 0x12, + 0x2b, 0x0a, 0x11, 0x74, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, 0x5f, 0x61, 0x76, 0x61, 0x69, 0x6c, + 0x61, 0x62, 0x6c, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x74, 0x72, 0x61, 0x66, + 0x66, 0x69, 0x63, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x16, 0x0a, 0x06, + 0x75, 0x70, 0x6c, 0x69, 0x6e, 0x6b, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x70, + 0x6c, 0x69, 0x6e, 0x6b, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x69, 0x6e, 0x6b, + 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x69, 0x6e, 0x6b, + 0x12, 0x21, 0x0a, 0x0c, 0x75, 0x70, 0x6c, 0x69, 0x6e, 0x6b, 0x5f, 0x74, 0x6f, 0x74, 0x61, 0x6c, + 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x75, 0x70, 0x6c, 0x69, 0x6e, 0x6b, 0x54, 0x6f, + 0x74, 0x61, 0x6c, 0x12, 0x25, 0x0a, 0x0e, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x69, 0x6e, 0x6b, 0x5f, + 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x64, 0x6f, 0x77, + 0x6e, 0x6c, 0x69, 0x6e, 0x6b, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x22, 0x80, 0x04, 0x0a, 0x0c, 0x4f, + 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x10, 0x0a, 0x03, 0x74, + 0x61, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x74, 0x61, 0x67, 0x12, 0x12, 0x0a, + 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, + 0x65, 0x12, 0x3e, 0x0a, 0x0d, 0x75, 0x72, 0x6c, 0x5f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x74, 0x69, + 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, + 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0b, 0x75, 0x72, 0x6c, 0x54, 0x65, 0x73, 0x74, 0x54, 0x69, 0x6d, + 0x65, 0x12, 0x24, 0x0a, 0x0e, 0x75, 0x72, 0x6c, 0x5f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x64, 0x65, + 0x6c, 0x61, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x75, 0x72, 0x6c, 0x54, 0x65, + 0x73, 0x74, 0x44, 0x65, 0x6c, 0x61, 0x79, 0x12, 0x2a, 0x0a, 0x06, 0x69, 0x70, 0x69, 0x6e, 0x66, + 0x6f, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x68, 0x63, 0x6f, 0x72, 0x65, 0x2e, + 0x49, 0x70, 0x49, 0x6e, 0x66, 0x6f, 0x48, 0x00, 0x52, 0x06, 0x69, 0x70, 0x69, 0x6e, 0x66, 0x6f, + 0x88, 0x01, 0x01, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x73, 0x5f, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, + 0x65, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x69, 0x73, 0x53, 0x65, 0x6c, 0x65, + 0x63, 0x74, 0x65, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x69, 0x73, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, + 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x69, 0x73, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, + 0x50, 0x0a, 0x17, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x65, + 0x64, 0x5f, 0x6f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x13, 0x2e, 0x68, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, + 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x48, 0x01, 0x52, 0x15, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x53, 0x65, + 0x6c, 0x65, 0x63, 0x74, 0x65, 0x64, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x88, 0x01, + 0x01, 0x12, 0x1b, 0x0a, 0x09, 0x69, 0x73, 0x5f, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x69, 0x73, 0x53, 0x65, 0x63, 0x75, 0x72, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x69, 0x73, 0x5f, 0x76, 0x69, 0x73, 0x69, 0x62, 0x6c, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x69, 0x73, 0x56, 0x69, 0x73, 0x69, 0x62, 0x6c, 0x65, 0x12, 0x12, 0x0a, @@ -1917,171 +2036,181 @@ var file_v2_hcore_hcore_proto_rawDesc = []byte{ 0x74, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x61, 0x67, 0x5f, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x74, 0x61, 0x67, 0x44, - 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x22, 0xe8, 0x01, 0x0a, 0x06, 0x49, 0x70, 0x49, 0x6e, 0x66, - 0x6f, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, - 0x70, 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x5f, 0x63, 0x6f, 0x64, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, - 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, - 0x04, 0x63, 0x69, 0x74, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x69, 0x74, - 0x79, 0x12, 0x10, 0x0a, 0x03, 0x61, 0x73, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, - 0x61, 0x73, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x6f, 0x72, 0x67, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x03, 0x6f, 0x72, 0x67, 0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x61, 0x74, 0x69, 0x74, 0x75, 0x64, - 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x01, 0x52, 0x08, 0x6c, 0x61, 0x74, 0x69, 0x74, 0x75, 0x64, - 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6c, 0x6f, 0x6e, 0x67, 0x69, 0x74, 0x75, 0x64, 0x65, 0x18, 0x08, - 0x20, 0x01, 0x28, 0x01, 0x52, 0x09, 0x6c, 0x6f, 0x6e, 0x67, 0x69, 0x74, 0x75, 0x64, 0x65, 0x12, - 0x20, 0x0a, 0x0b, 0x70, 0x6f, 0x73, 0x74, 0x61, 0x6c, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x09, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x6f, 0x73, 0x74, 0x61, 0x6c, 0x5f, 0x63, 0x6f, 0x64, - 0x65, 0x22, 0xce, 0x01, 0x0a, 0x0d, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x47, 0x72, - 0x6f, 0x75, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x61, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x03, 0x74, 0x61, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x2f, 0x0a, 0x08, 0x73, 0x65, 0x6c, - 0x65, 0x63, 0x74, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x68, 0x63, - 0x6f, 0x72, 0x65, 0x2e, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x49, 0x6e, 0x66, 0x6f, - 0x52, 0x08, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x65, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x65, - 0x6c, 0x65, 0x63, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, - 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x49, 0x73, - 0x5f, 0x65, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x49, - 0x73, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x12, 0x29, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, - 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x68, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x4f, - 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x69, 0x74, 0x65, - 0x6d, 0x73, 0x22, 0x3f, 0x0a, 0x11, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x47, 0x72, - 0x6f, 0x75, 0x70, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x2a, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x68, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x4f, - 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x05, 0x69, 0x74, - 0x65, 0x6d, 0x73, 0x22, 0x4f, 0x0a, 0x0b, 0x57, 0x61, 0x72, 0x70, 0x41, 0x63, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x69, 0x64, - 0x18, 0x01, 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, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, - 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0xdf, 0x01, 0x0a, 0x13, 0x57, 0x61, 0x72, 0x70, 0x57, 0x69, 0x72, - 0x65, 0x67, 0x75, 0x61, 0x72, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x20, 0x0a, 0x0b, - 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0b, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x2d, 0x6b, 0x65, 0x79, 0x12, 0x2e, - 0x0a, 0x12, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x5f, - 0x69, 0x70, 0x76, 0x34, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x6c, 0x6f, 0x63, 0x61, - 0x6c, 0x2d, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x2d, 0x69, 0x70, 0x76, 0x34, 0x12, 0x2e, - 0x0a, 0x12, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x5f, - 0x69, 0x70, 0x76, 0x36, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x6c, 0x6f, 0x63, 0x61, - 0x6c, 0x2d, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x2d, 0x69, 0x70, 0x76, 0x36, 0x12, 0x28, - 0x0a, 0x0f, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, - 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x70, 0x65, 0x65, 0x72, 0x2d, 0x70, 0x75, - 0x62, 0x6c, 0x69, 0x63, 0x2d, 0x6b, 0x65, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x6c, 0x69, 0x65, - 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x6c, 0x69, - 0x65, 0x6e, 0x74, 0x2d, 0x69, 0x64, 0x22, 0x8c, 0x01, 0x0a, 0x16, 0x57, 0x61, 0x72, 0x70, 0x47, - 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x2c, 0x0a, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x68, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x57, 0x61, 0x72, 0x70, 0x41, - 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, - 0x10, 0x0a, 0x03, 0x6c, 0x6f, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6c, 0x6f, - 0x67, 0x12, 0x32, 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1a, 0x2e, 0x68, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x57, 0x61, 0x72, 0x70, 0x57, 0x69, - 0x72, 0x65, 0x67, 0x75, 0x61, 0x72, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x06, 0x63, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x22, 0x4b, 0x0a, 0x11, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x50, - 0x72, 0x6f, 0x78, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x76, - 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x61, - 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x6e, 0x61, 0x62, - 0x6c, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, - 0x65, 0x64, 0x22, 0x7c, 0x0a, 0x0c, 0x50, 0x61, 0x72, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x1f, 0x0a, 0x0b, - 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0a, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x50, 0x61, 0x74, 0x68, 0x12, 0x1b, 0x0a, - 0x09, 0x74, 0x65, 0x6d, 0x70, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x08, 0x74, 0x65, 0x6d, 0x70, 0x50, 0x61, 0x74, 0x68, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x65, - 0x62, 0x75, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x64, 0x65, 0x62, 0x75, 0x67, - 0x22, 0x7f, 0x0a, 0x0d, 0x50, 0x61, 0x72, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x3a, 0x0a, 0x0d, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x63, 0x6f, - 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x68, 0x63, 0x6f, 0x6d, 0x6d, - 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x52, - 0x0c, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 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, 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, 0xa1, 0x01, - 0x0a, 0x0a, 0x4c, 0x6f, 0x67, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x25, 0x0a, 0x05, - 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0f, 0x2e, 0x68, 0x63, - 0x6f, 0x72, 0x65, 0x2e, 0x4c, 0x6f, 0x67, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x52, 0x05, 0x6c, 0x65, - 0x76, 0x65, 0x6c, 0x12, 0x22, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0e, 0x32, 0x0e, 0x2e, 0x68, 0x63, 0x6f, 0x72, 0x65, 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, 0x12, 0x2e, 0x0a, 0x04, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x04, 0x74, 0x69, 0x6d, - 0x65, 0x22, 0x0d, 0x0a, 0x0b, 0x53, 0x74, 0x6f, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x2a, 0x42, 0x0a, 0x0a, 0x43, 0x6f, 0x72, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x73, 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, 0xe2, 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, 0x12, 0x13, 0x0a, 0x0f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x45, 0x58, - 0x54, 0x45, 0x4e, 0x53, 0x49, 0x4f, 0x4e, 0x10, 0x0e, 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, 0x42, 0x2a, 0x5a, 0x28, 0x67, - 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, - 0x79, 0x2f, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x2d, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, - 0x32, 0x2f, 0x68, 0x63, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x69, 0x70, 0x69, 0x6e, 0x66, + 0x6f, 0x42, 0x1a, 0x0a, 0x18, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x73, 0x65, 0x6c, 0x65, + 0x63, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x22, 0xe8, 0x01, + 0x0a, 0x06, 0x49, 0x70, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x70, 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x72, 0x79, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x16, 0x0a, 0x06, + 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, + 0x67, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x69, 0x74, 0x79, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x63, 0x69, 0x74, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x61, 0x73, 0x6e, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x61, 0x73, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x6f, 0x72, + 0x67, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6f, 0x72, 0x67, 0x12, 0x1a, 0x0a, 0x08, + 0x6c, 0x61, 0x74, 0x69, 0x74, 0x75, 0x64, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x01, 0x52, 0x08, + 0x6c, 0x61, 0x74, 0x69, 0x74, 0x75, 0x64, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6c, 0x6f, 0x6e, 0x67, + 0x69, 0x74, 0x75, 0x64, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x01, 0x52, 0x09, 0x6c, 0x6f, 0x6e, + 0x67, 0x69, 0x74, 0x75, 0x64, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x70, 0x6f, 0x73, 0x74, 0x61, 0x6c, + 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x6f, 0x73, + 0x74, 0x61, 0x6c, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x22, 0xce, 0x01, 0x0a, 0x0d, 0x4f, 0x75, 0x74, + 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x61, + 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x74, 0x61, 0x67, 0x12, 0x12, 0x0a, 0x04, + 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, + 0x12, 0x2f, 0x0a, 0x08, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x68, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x4f, 0x75, 0x74, 0x62, 0x6f, + 0x75, 0x6e, 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x65, + 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x61, 0x62, 0x6c, + 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x49, 0x73, 0x5f, 0x65, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x49, 0x73, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x12, 0x29, + 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, + 0x68, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x49, 0x6e, + 0x66, 0x6f, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x22, 0x3f, 0x0a, 0x11, 0x4f, 0x75, 0x74, + 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x2a, + 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, + 0x68, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x47, 0x72, + 0x6f, 0x75, 0x70, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x22, 0x4f, 0x0a, 0x0b, 0x57, 0x61, + 0x72, 0x70, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x63, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 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, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, + 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0xdf, 0x01, 0x0a, 0x13, + 0x57, 0x61, 0x72, 0x70, 0x57, 0x69, 0x72, 0x65, 0x67, 0x75, 0x61, 0x72, 0x64, 0x43, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x12, 0x20, 0x0a, 0x0b, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x5f, 0x6b, + 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, + 0x65, 0x2d, 0x6b, 0x65, 0x79, 0x12, 0x2e, 0x0a, 0x12, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x5f, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x5f, 0x69, 0x70, 0x76, 0x34, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x12, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x2d, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x2d, 0x69, 0x70, 0x76, 0x34, 0x12, 0x2e, 0x0a, 0x12, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x5f, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x5f, 0x69, 0x70, 0x76, 0x36, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x12, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x2d, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x2d, 0x69, 0x70, 0x76, 0x36, 0x12, 0x28, 0x0a, 0x0f, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x70, 0x75, + 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, + 0x70, 0x65, 0x65, 0x72, 0x2d, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2d, 0x6b, 0x65, 0x79, 0x12, + 0x1c, 0x0a, 0x09, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x09, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2d, 0x69, 0x64, 0x22, 0x8c, 0x01, + 0x0a, 0x16, 0x57, 0x61, 0x72, 0x70, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2c, 0x0a, 0x07, 0x61, 0x63, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x68, 0x63, 0x6f, 0x72, + 0x65, 0x2e, 0x57, 0x61, 0x72, 0x70, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x07, 0x61, + 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6c, 0x6f, 0x67, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x03, 0x6c, 0x6f, 0x67, 0x12, 0x32, 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x68, 0x63, 0x6f, 0x72, 0x65, + 0x2e, 0x57, 0x61, 0x72, 0x70, 0x57, 0x69, 0x72, 0x65, 0x67, 0x75, 0x61, 0x72, 0x64, 0x43, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x22, 0x4b, 0x0a, 0x11, + 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x12, + 0x18, 0x0a, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x22, 0x7c, 0x0a, 0x0c, 0x50, 0x61, 0x72, + 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, + 0x74, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, + 0x65, 0x6e, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x70, 0x61, + 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x50, 0x61, 0x74, 0x68, 0x12, 0x1b, 0x0a, 0x09, 0x74, 0x65, 0x6d, 0x70, 0x5f, 0x70, 0x61, 0x74, + 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x65, 0x6d, 0x70, 0x50, 0x61, 0x74, + 0x68, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x65, 0x62, 0x75, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x05, 0x64, 0x65, 0x62, 0x75, 0x67, 0x22, 0x7f, 0x0a, 0x0d, 0x50, 0x61, 0x72, 0x73, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3a, 0x0a, 0x0d, 0x72, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x15, 0x2e, 0x68, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x0c, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 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, 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, 0xa1, 0x01, 0x0a, 0x0a, 0x4c, 0x6f, 0x67, 0x4d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x12, 0x25, 0x0a, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x0f, 0x2e, 0x68, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x4c, 0x6f, 0x67, 0x4c, 0x65, + 0x76, 0x65, 0x6c, 0x52, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x22, 0x0a, 0x04, 0x74, 0x79, + 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0e, 0x2e, 0x68, 0x63, 0x6f, 0x72, 0x65, + 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, 0x12, 0x2e, 0x0a, 0x04, 0x74, 0x69, 0x6d, 0x65, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, + 0x6d, 0x70, 0x52, 0x04, 0x74, 0x69, 0x6d, 0x65, 0x22, 0x0d, 0x0a, 0x0b, 0x53, 0x74, 0x6f, 0x70, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2a, 0x42, 0x0a, 0x0a, 0x43, 0x6f, 0x72, 0x65, 0x53, + 0x74, 0x61, 0x74, 0x65, 0x73, 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, 0xe2, 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, 0x12, 0x13, 0x0a, 0x0f, 0x45, + 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x45, 0x58, 0x54, 0x45, 0x4e, 0x53, 0x49, 0x4f, 0x4e, 0x10, 0x0e, + 0x2a, 0x72, 0x0a, 0x09, 0x53, 0x65, 0x74, 0x75, 0x70, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x07, 0x0a, + 0x03, 0x4f, 0x4c, 0x44, 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x47, 0x52, 0x50, 0x43, 0x5f, 0x4e, + 0x4f, 0x52, 0x4d, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x13, 0x0a, 0x0f, 0x47, 0x52, 0x50, 0x43, 0x5f, + 0x42, 0x41, 0x43, 0x4b, 0x47, 0x52, 0x4f, 0x55, 0x4e, 0x44, 0x10, 0x02, 0x12, 0x18, 0x0a, 0x14, + 0x47, 0x52, 0x50, 0x43, 0x5f, 0x4e, 0x4f, 0x52, 0x4d, 0x41, 0x4c, 0x5f, 0x49, 0x4e, 0x53, 0x45, + 0x43, 0x55, 0x52, 0x45, 0x10, 0x03, 0x12, 0x1c, 0x0a, 0x18, 0x47, 0x52, 0x50, 0x43, 0x5f, 0x42, + 0x41, 0x43, 0x4b, 0x47, 0x52, 0x4f, 0x55, 0x4e, 0x44, 0x5f, 0x49, 0x4e, 0x53, 0x45, 0x43, 0x55, + 0x52, 0x45, 0x10, 0x04, 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, 0x42, 0x2a, 0x5a, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x69, 0x64, 0x64, 0x69, 0x66, 0x79, 0x2f, 0x68, 0x69, 0x64, + 0x64, 0x69, 0x66, 0x79, 0x2d, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x32, 0x2f, 0x68, 0x63, 0x6f, + 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -2096,58 +2225,61 @@ func file_v2_hcore_hcore_proto_rawDescGZIP() []byte { return file_v2_hcore_hcore_proto_rawDescData } -var file_v2_hcore_hcore_proto_enumTypes = make([]protoimpl.EnumInfo, 4) +var file_v2_hcore_hcore_proto_enumTypes = make([]protoimpl.EnumInfo, 5) var file_v2_hcore_hcore_proto_msgTypes = make([]protoimpl.MessageInfo, 23) var file_v2_hcore_hcore_proto_goTypes = []any{ (CoreStates)(0), // 0: hcore.CoreStates (MessageType)(0), // 1: hcore.MessageType - (LogLevel)(0), // 2: hcore.LogLevel - (LogType)(0), // 3: hcore.LogType - (*CoreInfoResponse)(nil), // 4: hcore.CoreInfoResponse - (*StartRequest)(nil), // 5: hcore.StartRequest - (*SetupRequest)(nil), // 6: hcore.SetupRequest - (*SystemInfo)(nil), // 7: hcore.SystemInfo - (*OutboundInfo)(nil), // 8: hcore.OutboundInfo - (*IpInfo)(nil), // 9: hcore.IpInfo - (*OutboundGroup)(nil), // 10: hcore.OutboundGroup - (*OutboundGroupList)(nil), // 11: hcore.OutboundGroupList - (*WarpAccount)(nil), // 12: hcore.WarpAccount - (*WarpWireguardConfig)(nil), // 13: hcore.WarpWireguardConfig - (*WarpGenerationResponse)(nil), // 14: hcore.WarpGenerationResponse - (*SystemProxyStatus)(nil), // 15: hcore.SystemProxyStatus - (*ParseRequest)(nil), // 16: hcore.ParseRequest - (*ParseResponse)(nil), // 17: hcore.ParseResponse - (*ChangeHiddifySettingsRequest)(nil), // 18: hcore.ChangeHiddifySettingsRequest - (*GenerateConfigRequest)(nil), // 19: hcore.GenerateConfigRequest - (*GenerateConfigResponse)(nil), // 20: hcore.GenerateConfigResponse - (*SelectOutboundRequest)(nil), // 21: hcore.SelectOutboundRequest - (*UrlTestRequest)(nil), // 22: hcore.UrlTestRequest - (*GenerateWarpConfigRequest)(nil), // 23: hcore.GenerateWarpConfigRequest - (*SetSystemProxyEnabledRequest)(nil), // 24: hcore.SetSystemProxyEnabledRequest - (*LogMessage)(nil), // 25: hcore.LogMessage - (*StopRequest)(nil), // 26: hcore.StopRequest - (*timestamppb.Timestamp)(nil), // 27: google.protobuf.Timestamp - (hcommon.ResponseCode)(0), // 28: hcommon.ResponseCode + (SetupMode)(0), // 2: hcore.SetupMode + (LogLevel)(0), // 3: hcore.LogLevel + (LogType)(0), // 4: hcore.LogType + (*CoreInfoResponse)(nil), // 5: hcore.CoreInfoResponse + (*StartRequest)(nil), // 6: hcore.StartRequest + (*SetupRequest)(nil), // 7: hcore.SetupRequest + (*SystemInfo)(nil), // 8: hcore.SystemInfo + (*OutboundInfo)(nil), // 9: hcore.OutboundInfo + (*IpInfo)(nil), // 10: hcore.IpInfo + (*OutboundGroup)(nil), // 11: hcore.OutboundGroup + (*OutboundGroupList)(nil), // 12: hcore.OutboundGroupList + (*WarpAccount)(nil), // 13: hcore.WarpAccount + (*WarpWireguardConfig)(nil), // 14: hcore.WarpWireguardConfig + (*WarpGenerationResponse)(nil), // 15: hcore.WarpGenerationResponse + (*SystemProxyStatus)(nil), // 16: hcore.SystemProxyStatus + (*ParseRequest)(nil), // 17: hcore.ParseRequest + (*ParseResponse)(nil), // 18: hcore.ParseResponse + (*ChangeHiddifySettingsRequest)(nil), // 19: hcore.ChangeHiddifySettingsRequest + (*GenerateConfigRequest)(nil), // 20: hcore.GenerateConfigRequest + (*GenerateConfigResponse)(nil), // 21: hcore.GenerateConfigResponse + (*SelectOutboundRequest)(nil), // 22: hcore.SelectOutboundRequest + (*UrlTestRequest)(nil), // 23: hcore.UrlTestRequest + (*GenerateWarpConfigRequest)(nil), // 24: hcore.GenerateWarpConfigRequest + (*SetSystemProxyEnabledRequest)(nil), // 25: hcore.SetSystemProxyEnabledRequest + (*LogMessage)(nil), // 26: hcore.LogMessage + (*StopRequest)(nil), // 27: hcore.StopRequest + (*timestamppb.Timestamp)(nil), // 28: google.protobuf.Timestamp + (hcommon.ResponseCode)(0), // 29: hcommon.ResponseCode } var file_v2_hcore_hcore_proto_depIdxs = []int32{ 0, // 0: hcore.CoreInfoResponse.core_state:type_name -> hcore.CoreStates 1, // 1: hcore.CoreInfoResponse.message_type:type_name -> hcore.MessageType - 27, // 2: hcore.OutboundInfo.url_test_time:type_name -> google.protobuf.Timestamp - 9, // 3: hcore.OutboundInfo.ipinfo:type_name -> hcore.IpInfo - 8, // 4: hcore.OutboundGroup.selected:type_name -> hcore.OutboundInfo - 8, // 5: hcore.OutboundGroup.items:type_name -> hcore.OutboundInfo - 10, // 6: hcore.OutboundGroupList.items:type_name -> hcore.OutboundGroup - 12, // 7: hcore.WarpGenerationResponse.account:type_name -> hcore.WarpAccount - 13, // 8: hcore.WarpGenerationResponse.config:type_name -> hcore.WarpWireguardConfig - 28, // 9: hcore.ParseResponse.response_code:type_name -> hcommon.ResponseCode - 2, // 10: hcore.LogMessage.level:type_name -> hcore.LogLevel - 3, // 11: hcore.LogMessage.type:type_name -> hcore.LogType - 27, // 12: hcore.LogMessage.time:type_name -> google.protobuf.Timestamp - 13, // [13:13] is the sub-list for method output_type - 13, // [13:13] is the sub-list for method input_type - 13, // [13:13] is the sub-list for extension type_name - 13, // [13:13] is the sub-list for extension extendee - 0, // [0:13] is the sub-list for field type_name + 2, // 2: hcore.SetupRequest.mode:type_name -> hcore.SetupMode + 28, // 3: hcore.OutboundInfo.url_test_time:type_name -> google.protobuf.Timestamp + 10, // 4: hcore.OutboundInfo.ipinfo:type_name -> hcore.IpInfo + 9, // 5: hcore.OutboundInfo.group_selected_outbound:type_name -> hcore.OutboundInfo + 9, // 6: hcore.OutboundGroup.selected:type_name -> hcore.OutboundInfo + 9, // 7: hcore.OutboundGroup.items:type_name -> hcore.OutboundInfo + 11, // 8: hcore.OutboundGroupList.items:type_name -> hcore.OutboundGroup + 13, // 9: hcore.WarpGenerationResponse.account:type_name -> hcore.WarpAccount + 14, // 10: hcore.WarpGenerationResponse.config:type_name -> hcore.WarpWireguardConfig + 29, // 11: hcore.ParseResponse.response_code:type_name -> hcommon.ResponseCode + 3, // 12: hcore.LogMessage.level:type_name -> hcore.LogLevel + 4, // 13: hcore.LogMessage.type:type_name -> hcore.LogType + 28, // 14: hcore.LogMessage.time:type_name -> google.protobuf.Timestamp + 15, // [15:15] is the sub-list for method output_type + 15, // [15:15] is the sub-list for method input_type + 15, // [15:15] is the sub-list for extension type_name + 15, // [15:15] is the sub-list for extension extendee + 0, // [0:15] is the sub-list for field type_name } func init() { file_v2_hcore_hcore_proto_init() } @@ -2433,12 +2565,13 @@ func file_v2_hcore_hcore_proto_init() { } } } + file_v2_hcore_hcore_proto_msgTypes[4].OneofWrappers = []any{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_v2_hcore_hcore_proto_rawDesc, - NumEnums: 4, + NumEnums: 5, NumMessages: 23, NumExtensions: 0, NumServices: 0, diff --git a/v2/hcore/hcore.proto b/v2/hcore/hcore.proto index 020a2348..3592fc5a 100644 --- a/v2/hcore/hcore.proto +++ b/v2/hcore/hcore.proto @@ -46,12 +46,26 @@ message StartRequest { bool enable_raw_config = 6; } -message SetupRequest { - string base_path = 1; - string working_path = 2; - string temp_path = 3; + +enum SetupMode { + OLD = 0; + GRPC_NORMAL = 1; + GRPC_BACKGROUND = 2; + GRPC_NORMAL_INSECURE = 3; + GRPC_BACKGROUND_INSECURE = 4; } +// Define the message equivalent of SetupParameters +message SetupRequest { + string base_path = 1; + string working_dir = 2; + string temp_dir = 3; + int64 flutter_status_port = 4; + string listen = 5; + string secret = 6; + bool debug = 7; + SetupMode mode = 8; +} message SystemInfo { int64 memory = 1; @@ -70,9 +84,10 @@ message OutboundInfo { string type = 2; google.protobuf.Timestamp url_test_time = 3; int32 url_test_delay = 4; - IpInfo ipinfo = 5; + optional IpInfo ipinfo = 5; bool is_selected = 6; bool is_group = 7; + optional OutboundInfo group_selected_outbound=13; bool is_secure = 8; bool is_visible = 9; uint32 port = 10; diff --git a/v2/hcore/logproto.go b/v2/hcore/logproto.go index 95249386..f66f528d 100644 --- a/v2/hcore/logproto.go +++ b/v2/hcore/logproto.go @@ -5,6 +5,7 @@ import ( "time" hcommon "github.com/hiddify/hiddify-core/v2/hcommon" + "github.com/sagernet/sing-box/log" "github.com/sagernet/sing/common/observable" "google.golang.org/grpc" "google.golang.org/protobuf/types/known/timestamppb" @@ -14,13 +15,12 @@ func NewObserver[T any](listenerBufferSize int) *observable.Observer[T] { return observable.NewObserver(observable.NewSubscriber[T](listenerBufferSize), listenerBufferSize) } -var logObserver = NewObserver[*LogMessage](1) - func Log(level LogLevel, typ LogType, message ...any) { - if level != LogLevel_DEBUG { - fmt.Printf("%s %s %s\n", level, typ, message) + if true || level != LogLevel_DEBUG { + log.Debug(level, typ, fmt.Sprint(message...)) + fmt.Printf("%v %v %v\n", level, typ, fmt.Sprint(message...)) } - logObserver.Emit(&LogMessage{ + static.logObserver.Emit(&LogMessage{ Level: level, Type: typ, Time: timestamppb.New(time.Now()), @@ -29,8 +29,8 @@ func Log(level LogLevel, typ LogType, message ...any) { } func (s *CoreService) LogListener(req *hcommon.Empty, stream grpc.ServerStreamingServer[LogMessage]) error { - logSub, stopch, _ := logObserver.Subscribe() - defer logObserver.UnSubscribe(logSub) + logSub, stopch, _ := static.logObserver.Subscribe() + defer static.logObserver.UnSubscribe(logSub) for { select { diff --git a/v2/hcore/proxy_info.go b/v2/hcore/proxy_info.go index dbb3344a..6bd9a027 100644 --- a/v2/hcore/proxy_info.go +++ b/v2/hcore/proxy_info.go @@ -13,14 +13,14 @@ import ( ) func GetProxyInfo(detour adapter.Outbound) *OutboundInfo { - if Box == nil { + if static.Box == nil { return nil } out := &OutboundInfo{ Tag: detour.Tag(), Type: detour.Type(), } - url_test_history := Box.UrlTestHistory().LoadURLTestHistory(adapter.OutboundTag(detour)) + url_test_history := static.Box.UrlTestHistory().LoadURLTestHistory(adapter.OutboundTag(detour)) if url_test_history != nil { out.UrlTestTime = timestamppb.New(url_test_history.Time) out.UrlTestDelay = int32(url_test_history.Delay) @@ -37,32 +37,41 @@ func GetProxyInfo(detour adapter.Outbound) *OutboundInfo { PostalCode: url_test_history.IpInfo.PostalCode, } } + if _, isGroup := detour.(adapter.OutboundGroup); isGroup { + out.IsGroup = true + } + } return out } func GetAllProxiesInfo(onlyGroupitems bool) *OutboundGroupList { - if Box == nil { + if static.Box == nil { return nil } - cacheFile := service.FromContext[adapter.CacheFile](Box.Context()) - outbounds := Box.GetInstance().Router().Outbounds() + cacheFile := service.FromContext[adapter.CacheFile](static.Box.Context()) + outbounds := static.Box.GetInstance().Router().Outbounds() + outbounds_converted := make(map[string]*OutboundInfo, 0) var iGroups []adapter.OutboundGroup for _, it := range outbounds { if group, isGroup := it.(adapter.OutboundGroup); isGroup { iGroups = append(iGroups, group) } + + outbounds_converted[it.Tag()] = GetProxyInfo(it) } + var groups OutboundGroupList for _, iGroup := range iGroups { var group OutboundGroup group.Tag = iGroup.Tag() group.Type = iGroup.Type() _, group.Selectable = iGroup.(*outbound.Selector) - // group.Selected = iGroup.Now() selectedTag := iGroup.Now() + group.Selected = outbounds_converted[selectedTag] + outbounds_converted[iGroup.Tag()].GroupSelectedOutbound = group.Selected if cacheFile != nil { if isExpand, loaded := cacheFile.LoadGroupExpand(group.Tag); loaded { group.IsExpand = isExpand @@ -70,21 +79,15 @@ func GetAllProxiesInfo(onlyGroupitems bool) *OutboundGroupList { } for _, itemTag := range iGroup.All() { - itemOutbound, isLoaded := Box.GetInstance().Router().Outbound(itemTag) - if !isLoaded { - continue - } if onlyGroupitems && itemTag != selectedTag { continue } - pinfo := GetProxyInfo(itemOutbound) + pinfo := outbounds_converted[itemTag] pinfo.IsSelected = itemTag == selectedTag - if pinfo.IsSelected { - group.Selected = pinfo - } + group.Items = append(group.Items, pinfo) pinfo.IsVisible = !strings.Contains(itemTag, "§hide§") - pinfo.TagDisplay = strings.Split(itemTag, "§")[0] + pinfo.TagDisplay = strings.Trim(strings.Split(itemTag, "§")[0], " ") } if len(group.Items) == 0 { continue @@ -104,8 +107,8 @@ func (s *CoreService) MainOutboundsInfo(req *hcommon.Empty, stream grpc.ServerSt } func AllProxiesInfoStream(stream grpc.ServerStreamingServer[OutboundGroupList], onlyMain bool) error { - urltestch, done, err := Box.UrlTestHistory().Observer().Subscribe() - defer Box.UrlTestHistory().Observer().UnSubscribe(urltestch) + urltestch, done, err := static.Box.UrlTestHistory().Observer().Subscribe() + defer static.Box.UrlTestHistory().Observer().UnSubscribe(urltestch) if err != nil { return err } diff --git a/v2/hcore/restart.go b/v2/hcore/restart.go index 0f54b538..8f022eca 100644 --- a/v2/hcore/restart.go +++ b/v2/hcore/restart.go @@ -19,10 +19,10 @@ func Restart(in *StartRequest) (coreResponse *CoreInfoResponse, err error) { }) log.Debug("[Service] Restarting") - if CoreState != CoreStates_STARTED { + if static.CoreState != CoreStates_STARTED { return errorWrapper(MessageType_INSTANCE_NOT_STARTED, fmt.Errorf("instance not started")) } - if Box == nil { + if static.Box == nil { return errorWrapper(MessageType_INSTANCE_NOT_FOUND, fmt.Errorf("instance not found")) } diff --git a/v2/hcore/service.go b/v2/hcore/service.go index f70e8dcf..01af493c 100644 --- a/v2/hcore/service.go +++ b/v2/hcore/service.go @@ -37,33 +37,29 @@ func InitHiddifyService() error { return service_manager.StartServices() } -type SetupMode int - -const ( - OLD SetupMode = 0 - GRPC_NORMAL SetupMode = 1 - GRPC_BACKGROUND SetupMode = 2 - GRPC_NORMAL_INSECURE SetupMode = 3 - GRPC_BACKGROUND_INSECURE SetupMode = 4 -) - -type SetupParameters struct { - BasePath string - WorkingDir string - TempDir string - FlutterStatusPort int64 - Listen string - Secret string - Debug bool - Mode SetupMode +func (s *CoreService) Setup(ctx context.Context, req *SetupRequest) (*hcommon.Response, error) { + if grpcServer[req.Mode] != nil { + return &hcommon.Response{Code: hcommon.ResponseCode_OK, Message: ""}, nil + } + err := Setup(req) + code := hcommon.ResponseCode_OK + if err != nil { + code = hcommon.ResponseCode_FAILED + } + return &hcommon.Response{Code: code, Message: err.Error()}, err } -func Setup(params SetupParameters) error { +func Setup(params *SetupRequest) error { defer config.DeferPanicToError("setup", func(err error) { Log(LogLevel_FATAL, LogType_CORE, err.Error()) }) + if grpcServer[params.Mode] != nil { + Log(LogLevel_WARNING, LogType_CORE, "grpcServer already started") + return nil + } tcpConn := runtime.GOOS == "windows" // TODO add TVOS libbox.Setup(params.BasePath, params.WorkingDir, params.TempDir, tcpConn) + libbox.RedirectStderr(fmt.Sprint(params.WorkingDir, "/data/stderr.log")) Log(LogLevel_DEBUG, LogType_CORE, fmt.Sprintf("libbox.Setup success %s %s %s %v", params.BasePath, params.WorkingDir, params.TempDir, tcpConn)) sWorkingPath = params.WorkingDir @@ -87,7 +83,7 @@ func Setup(params SetupParameters) error { // Output: "stdout", // }, }) - coreLogFactory = factory + static.CoreLogFactory = factory if err != nil { return E.Cause(err, "create logger") @@ -95,7 +91,7 @@ func Setup(params SetupParameters) error { Log(LogLevel_DEBUG, LogType_CORE, fmt.Sprintf("StartGrpcServerByMode %s %d\n", params.Listen, params.Mode)) switch params.Mode { - case OLD: + case SetupMode_OLD: statusPropagationPort = int64(params.FlutterStatusPort) default: _, err := StartGrpcServerByMode(params.Listen, params.Mode) diff --git a/v2/hcore/standalone.go b/v2/hcore/standalone.go index 39c2d502..216859e3 100644 --- a/v2/hcore/standalone.go +++ b/v2/hcore/standalone.go @@ -26,7 +26,7 @@ func RunStandalone(hiddifySettingPath string, configPath string, defaultConfig c return err } - go StartService(&StartRequest{ + StartService(&StartRequest{ ConfigContent: current.Config, EnableOldCommandServer: false, DelayStart: false, @@ -165,22 +165,29 @@ func buildConfig(configContent string, options config.HiddifyOptions) (string, e } finalconfig.Log.Output = "" - finalconfig.Experimental.ClashAPI.ExternalUI = "webui" + finalconfig.Experimental = &option.ExperimentalOptions{ + ClashAPI: &option.ClashAPIOptions{ + ExternalUI: "webui", + }, + } + // finalconfig.Experimental.ClashAPI.ExternalUI = "webui" if options.AllowConnectionFromLAN { - finalconfig.Experimental.ClashAPI.ExternalController = "0.0.0.0:6756" + finalconfig.Experimental.ClashAPI.ExternalController = "0.0.0.0:16756" } else { - finalconfig.Experimental.ClashAPI.ExternalController = "127.0.0.1:6756" + finalconfig.Experimental.ClashAPI.ExternalController = "127.0.0.1:16756" } fmt.Printf("Open http://localhost:6756/ui/?secret=%s in your browser\n", finalconfig.Experimental.ClashAPI.Secret) if err := Setup( - SetupParameters{ + &SetupRequest{ BasePath: "./", WorkingDir: "./", TempDir: "./tmp", FlutterStatusPort: 0, Debug: false, + Listen: "127.0.0.1:17078", + Mode: SetupMode_GRPC_NORMAL_INSECURE, }); err != nil { return "", fmt.Errorf("failed to set up global configuration: %w", err) } @@ -205,8 +212,8 @@ func updateConfigInterval(current ConfigResult, hiddifySettingPath string, confi continue } if new.Config != current.Config { - go Stop() - go StartService(&StartRequest{ + Stop() + StartService(&StartRequest{ ConfigContent: new.Config, DelayStart: false, EnableOldCommandServer: false, diff --git a/v2/hcore/start.go b/v2/hcore/start.go index 12969390..84e273a4 100644 --- a/v2/hcore/start.go +++ b/v2/hcore/start.go @@ -37,8 +37,8 @@ func StartService(in *StartRequest, platformInterface libbox.PlatformInterface) if err := service_manager.OnMainServicePreStart(options); err != nil { return errorWrapper(MessageType_ERROR_EXTENSION, err) } - Log(LogLevel_DEBUG, LogType_CORE, "Saving config") currentBuildConfigPath := filepath.Join(sWorkingPath, "data/current-config.json") + Log(LogLevel_DEBUG, LogType_CORE, "Saving config to ", currentBuildConfigPath) config.SaveCurrentConfig(currentBuildConfigPath, *options) pout, err := json.MarshalIndent(options, "", " ") @@ -66,14 +66,14 @@ func StartService(in *StartRequest, platformInterface libbox.PlatformInterface) instance.GetInstance().AddPostService("hiddifyMainServiceManager", &hiddifyMainServiceManager{}) - if err := startCommandServer(instance); err != nil { - return errorWrapper(MessageType_START_COMMAND_SERVER, err) - } + // if err := startCommandServer(instance); err != nil { + // return errorWrapper(MessageType_START_COMMAND_SERVER, err) + // } if err := instance.Start(); err != nil { return errorWrapper(MessageType_START_SERVICE, err) } - Box = instance + static.Box = instance return SetCoreStatus(CoreStates_STARTED, MessageType_EMPTY, ""), nil } diff --git a/v2/hcore/static_data.go b/v2/hcore/static_data.go new file mode 100644 index 00000000..45e34e72 --- /dev/null +++ b/v2/hcore/static_data.go @@ -0,0 +1,30 @@ +package hcore + +import ( + "github.com/hiddify/hiddify-core/v2/config" + "github.com/sagernet/sing-box/experimental/libbox" + "github.com/sagernet/sing-box/log" + "github.com/sagernet/sing/common/observable" +) + +type HiddifyInstance struct { + Box *libbox.BoxService + HiddifyOptions *config.HiddifyOptions + // activeConfigPath string + CoreLogFactory log.Factory + coreInfoObserver *observable.Observer[*CoreInfoResponse] + CoreState CoreStates + logObserver *observable.Observer[*LogMessage] + systemInfoObserver *observable.Observer[*SystemInfo] + outboundsInfoObserver *observable.Observer[*OutboundGroupList] + mainOutboundsInfoObserver *observable.Observer[*OutboundGroupList] +} + +var static = &HiddifyInstance{ + coreInfoObserver: NewObserver[*CoreInfoResponse](1), + CoreState: CoreStates_STOPPED, + logObserver: NewObserver[*LogMessage](1), + systemInfoObserver: NewObserver[*SystemInfo](1), + outboundsInfoObserver: NewObserver[*OutboundGroupList](1), + mainOutboundsInfoObserver: NewObserver[*OutboundGroupList](1), +} diff --git a/v2/hcore/stop.go b/v2/hcore/stop.go index f4206d93..3fd761c5 100644 --- a/v2/hcore/stop.go +++ b/v2/hcore/stop.go @@ -17,18 +17,18 @@ func Stop() (coreResponse *CoreInfoResponse, err error) { coreResponse, err = errorWrapper(MessageType_UNEXPECTED_ERROR, recovered_err) }) - if CoreState != CoreStates_STARTED { + if static.CoreState != CoreStates_STARTED { return errorWrapper(MessageType_INSTANCE_NOT_STARTED, fmt.Errorf("instance not started")) } - if Box == nil { + if static.Box == nil { return errorWrapper(MessageType_INSTANCE_NOT_FOUND, fmt.Errorf("instance not found")) } SetCoreStatus(CoreStates_STOPPING, MessageType_EMPTY, "") - err = Box.Close() + err = static.Box.Close() if err != nil { return errorWrapper(MessageType_UNEXPECTED_ERROR, err) } - Box = nil + static.Box = nil return SetCoreStatus(CoreStates_STOPPED, MessageType_EMPTY, ""), nil }