diff --git a/README.md b/README.md index 3d46a44..c18088a 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,6 @@ requests accordingly. The current implementation is a usage example to demonstra ## How To Use The project exposes NixOS modules, which aim to be used with the [Ghaf Framework](https://github.com/tiiuae/ghaf). -An example configuration can be found [here](https://github.com/mbssrc/ghaf/tree/givc). ### Include the project @@ -121,7 +120,7 @@ The `admin` module is configured similar to the `host` module, with exception of ### Example: Appvm module usage -The `appvm` module runs as user service in an active user session, not as a system service. Currently, a single appvm in Ghaf is expected to run a single application, but this implementation allows to specify and run multiple applications. +The `appvm` module runs as user service in an active user session, not as a system service. The implementation allows to specify and run multiple applications. To use the agent as application controller, include the `appvm` module as follows: diff --git a/api/protoc.sh b/api/protoc.sh deleted file mode 100755 index 28adfe4..0000000 --- a/api/protoc.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env bash - -gen_protoc() { - protoc --proto_path="$1" \ - --go_out="$1" --go_opt=paths=source_relative \ - --go-grpc_out="$1" --go-grpc_opt=paths=source_relative \ - "$1"/"$2" -} - -if [ $# -eq 0 ]; then - set -- admin hwid locale systemd wifi -fi - -for protob in "$@"; do - gen_protoc api/"$protob" "$protob".proto -done diff --git a/devshell.nix b/devshell.nix index 629662a..63b9d96 100644 --- a/devshell.nix +++ b/devshell.nix @@ -45,7 +45,7 @@ { help = "Generate go files from protobuffers. Examples: '$ protogen systemd'"; name = "protogen"; - command = "./api/protoc.sh $@"; + command = "./modules/api/protoc.sh $@"; } { help = "Like cURL, but for gRPC: Command-line tool for interacting with gRPC servers"; diff --git a/flake.lock b/flake.lock index 9fdb5fb..a0cb3f6 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "crane": { "locked": { - "lastModified": 1730652660, - "narHash": "sha256-+XVYfmVXAiYA0FZT7ijHf555dxCe+AoAT5A6RU+6vSo=", + "lastModified": 1736101677, + "narHash": "sha256-iKOPq86AOWCohuzxwFy/MtC8PcSVGnrxBOvxpjpzrAY=", "owner": "ipetkov", "repo": "crane", - "rev": "a4ca93905455c07cb7e3aca95d4faf7601cba458", + "rev": "61ba163d85e5adeddc7b3a69bb174034965965b2", "type": "github" }, "original": { @@ -22,11 +22,11 @@ ] }, "locked": { - "lastModified": 1728330715, - "narHash": "sha256-xRJ2nPOXb//u1jaBnDP56M7v5ldavjbtR6lfGqSvcKg=", + "lastModified": 1735644329, + "narHash": "sha256-tO3HrHriyLvipc4xr+Ewtdlo7wM1OjXNjlWRgmM7peY=", "owner": "numtide", "repo": "devshell", - "rev": "dd6b80932022cea34a019e2bb32f6fa9e494dfef", + "rev": "f7795ede5b02664b57035b3b757876703e2c3eac", "type": "github" }, "original": { @@ -58,11 +58,11 @@ ] }, "locked": { - "lastModified": 1730504689, - "narHash": "sha256-hgmguH29K2fvs9szpq2r3pz2/8cJd2LPS+b4tfNFCwE=", + "lastModified": 1736143030, + "narHash": "sha256-+hu54pAoLDEZT9pjHlqL9DNzWz0NbUn8NEAHP7PQPzU=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "506278e768c2a08bec68eb62932193e341f55c90", + "rev": "b905f6fc23a9051a6e1b741e1438dbfc0634c6de", "type": "github" }, "original": { @@ -109,11 +109,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1730785428, - "narHash": "sha256-Zwl8YgTVJTEum+L+0zVAWvXAGbWAuXHax3KzuejaDyo=", + "lastModified": 1736012469, + "narHash": "sha256-/qlNWm/IEVVH7GfgAIyP6EsVZI6zjAx1cV5zNyrs+rI=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "4aa36568d413aca0ea84a1684d2d46f55dbabad7", + "rev": "8f3e1f807051e32d8c95cd12b9b421623850a34d", "type": "github" }, "original": { @@ -128,17 +128,14 @@ "gitignore": "gitignore", "nixpkgs": [ "nixpkgs" - ], - "nixpkgs-stable": [ - "nixpkgs" ] }, "locked": { - "lastModified": 1730814269, - "narHash": "sha256-fWPHyhYE6xvMI1eGY3pwBTq85wcy1YXqdzTZF+06nOg=", + "lastModified": 1735882644, + "narHash": "sha256-3FZAG+pGt3OElQjesCAWeMkQ7C/nB1oTHLRQ8ceP110=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "d70155fdc00df4628446352fc58adc640cd705c2", + "rev": "a5a961387e75ae44cc20f0a57ae463da5e959656", "type": "github" }, "original": { @@ -165,11 +162,11 @@ ] }, "locked": { - "lastModified": 1730321837, - "narHash": "sha256-vK+a09qq19QNu2MlLcvN4qcRctJbqWkX7ahgPZ/+maI=", + "lastModified": 1736154270, + "narHash": "sha256-p2r8xhQZ3TYIEKBoiEhllKWQqWNJNoT9v64Vmg4q8Zw=", "owner": "numtide", "repo": "treefmt-nix", - "rev": "746901bb8dba96d154b66492a29f5db0693dbfcc", + "rev": "13c913f5deb3a5c08bb810efd89dc8cb24dd968b", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index bf7b41b..58c4b51 100644 --- a/flake.nix +++ b/flake.nix @@ -1,7 +1,7 @@ # Copyright 2024 TII (SSRC) and the Ghaf contributors # SPDX-License-Identifier: Apache-2.0 { - description = "Go modules for inter-vm communication with gRPC."; + description = "Inter-vm communication framework with gRPC."; # Inputs inputs = { @@ -27,7 +27,6 @@ pre-commit-hooks-nix = { url = "github:cachix/pre-commit-hooks.nix"; inputs.nixpkgs.follows = "nixpkgs"; - inputs.nixpkgs-stable.follows = "nixpkgs"; }; }; @@ -61,19 +60,18 @@ fileset = lib.fileset.unions [ ./go.mod ./go.sum - ./api - ./internal + ./modules ]; }; - givc-admin-rs = pkgs.callPackage ./nixos/packages/givc-admin-rs.nix { + givc-admin = pkgs.callPackage ./nixos/packages/givc-admin.nix { inherit crane; src = ./.; }; in { - inherit givc-admin-rs; + inherit givc-admin; givc-agent = pkgs.callPackage ./nixos/packages/givc-agent.nix { inherit src; }; - givc-cli = givc-admin-rs.cli; + givc-cli = givc-admin.cli; }; }; flake = { @@ -88,7 +86,7 @@ # Overlays overlays.default = _final: prev: { - givc-cli = self.packages.${prev.stdenv.hostPlatform.system}.givc-admin-rs.cli; + givc-cli = self.packages.${prev.stdenv.hostPlatform.system}.givc-admin.cli; }; }; }; diff --git a/go.mod b/go.mod index 158f8f7..565f015 100644 --- a/go.mod +++ b/go.mod @@ -1,19 +1,21 @@ module givc -go 1.21.4 +go 1.22 + +toolchain go1.23.4 require ( github.com/coreos/go-systemd/v22 v22.5.0 github.com/go-ozzo/ozzo-validation/v4 v4.3.0 github.com/godbus/dbus/v5 v5.1.0 github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 - github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.1.0 + github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.2.0 github.com/shirou/gopsutil v3.21.11+incompatible github.com/sirupsen/logrus v1.9.3 - golang.org/x/net v0.29.0 - golang.org/x/sync v0.8.0 - google.golang.org/grpc v1.66.2 - google.golang.org/protobuf v1.34.2 + golang.org/x/net v0.34.0 + golang.org/x/sync v0.10.0 + google.golang.org/grpc v1.69.2 + google.golang.org/protobuf v1.36.1 ) require ( @@ -21,9 +23,9 @@ require ( github.com/go-ole/go-ole v1.3.0 // indirect github.com/golang/protobuf v1.5.4 // indirect github.com/tklauser/go-sysconf v0.3.14 // indirect - github.com/tklauser/numcpus v0.8.0 // indirect + github.com/tklauser/numcpus v0.9.0 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect + golang.org/x/sys v0.29.0 // indirect + golang.org/x/text v0.21.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20250106144421-5f5ef82da422 // indirect ) diff --git a/go.sum b/go.sum index 0b3758a..8fe8c4d 100644 --- a/go.sum +++ b/go.sum @@ -18,6 +18,10 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= +github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE= github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78= @@ -39,10 +43,12 @@ github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6 github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 h1:UH//fgunKIs4JdUbpDl1VZCDaL56wXCB/5+wF6uHfaI= github.com/grpc-ecosystem/go-grpc-middleware v1.4.0/go.mod h1:g5qyo/la0ALbONm6Vbp88Yd8NsDy6rZz+RcrMPxvld8= -github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.1.0 h1:pRhl55Yx1eC7BZ1N+BBWwnKaMyD8uC+34TLdndZMAKk= -github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.1.0/go.mod h1:XKMd7iuf/RGPSMJ/U4HP0zS2Z9Fh8Ps9a+6X26m/tmI= +github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.2.0 h1:kQ0NI7W1B3HwiN5gAYtY+XFItDPbLBwYRxAqbFTyDes= +github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.2.0/go.mod h1:zrT2dxOAjNFPRGjTUe2Xmb4q4YdUwVvQFV6xiCSf+z0= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= @@ -69,12 +75,22 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/tklauser/go-sysconf v0.3.14 h1:g5vzr9iPFFz24v2KZXs/pvpvh8/V9Fw6vQK5ZZb78yU= github.com/tklauser/go-sysconf v0.3.14/go.mod h1:1ym4lWMLUOhuBOPGtRcJm7tEGX4SCYNEEEtghGG/8uY= -github.com/tklauser/numcpus v0.8.0 h1:Mx4Wwe/FjZLeQsK/6kt2EOepwwSl7SmJrK5bV/dXYgY= -github.com/tklauser/numcpus v0.8.0/go.mod h1:ZJZlAY+dmR4eut8epnzf0u/VwodKmryxR8txiloSqBE= +github.com/tklauser/numcpus v0.9.0 h1:lmyCHtANi8aRUgkckBgoDk1nHCux3n2cgkJLXdQGPDo= +github.com/tklauser/numcpus v0.9.0/go.mod h1:SN6Nq1O3VychhC1npsWostA+oW+VOQTxZrS604NSRyI= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0= github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= +go.opentelemetry.io/otel v1.31.0 h1:NsJcKPIW0D0H3NgzPDHmo0WW6SptzPdqg/L1zsIm2hY= +go.opentelemetry.io/otel v1.31.0/go.mod h1:O0C14Yl9FgkjqcCZAsE053C13OaddMYr/hz6clDkEJE= +go.opentelemetry.io/otel/metric v1.31.0 h1:FSErL0ATQAmYHUIzSezZibnyVlft1ybhy4ozRPcF2fE= +go.opentelemetry.io/otel/metric v1.31.0/go.mod h1:C3dEloVbLuYoX41KpmAhOqNriGbA+qqH6PQ5E5mUfnY= +go.opentelemetry.io/otel/sdk v1.31.0 h1:xLY3abVHYZ5HSfOg3l2E5LUj2Cwva5Y7yGxnSW9H5Gk= +go.opentelemetry.io/otel/sdk v1.31.0/go.mod h1:TfRbMdhvxIIr/B2N2LQW2S5v9m3gOQ/08KsbbO5BPT0= +go.opentelemetry.io/otel/sdk/metric v1.31.0 h1:i9hxxLJF/9kkvfHppyLL55aW7iIJz4JjxTeYusH7zMc= +go.opentelemetry.io/otel/sdk/metric v1.31.0/go.mod h1:CRInTMVvNhUKgSAMbKyTMxqOBC0zgyxzW55lZzX43Y8= +go.opentelemetry.io/otel/trace v1.31.0 h1:ffjsj1aRouKewfr85U2aGagJ46+MvodynlQ1HYdmJys= +go.opentelemetry.io/otel/trace v1.31.0/go.mod h1:TXZkRk7SM2ZQLtR6eoAWQFIHPvzQ06FJAsO1tJg480A= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= @@ -97,16 +113,16 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -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.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0= +golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= -golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= +golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -116,12 +132,12 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -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.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= +golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -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.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= +golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= @@ -140,17 +156,17 @@ google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7 google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 h1:pPJltXNxVzT4pK9yD8vR9X75DaWYYmLGMsEvBfFQZzQ= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250106144421-5f5ef82da422 h1:3UsHvIr4Wc2aW4brOaSCmcxh9ksica6fHEr8P1XhkYw= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250106144421-5f5ef82da422/go.mod h1:3ENsm/5D1mzDyhpzeRi1NR784I0BcofWBoSc5QqqMK4= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= 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.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= -google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= -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/grpc v1.69.2 h1:U3S9QEtbXC0bYNvRtcoklF3xGtLViumSYxWykJS+7AU= +google.golang.org/grpc v1.69.2/go.mod h1:vyjdE6jLBI76dgpDojsFGNaHlxdjXN9ghpnd2o7JGZ4= +google.golang.org/protobuf v1.36.1 h1:yBPeRvTftaleIgM3PZ/WBIZ7XM/eEYAaEyCwvyjq/gk= +google.golang.org/protobuf v1.36.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/api/admin/admin.pb.go b/modules/api/admin/admin.pb.go similarity index 60% rename from api/admin/admin.pb.go rename to modules/api/admin/admin.pb.go index d99d0a4..08f8867 100644 --- a/api/admin/admin.pb.go +++ b/modules/api/admin/admin.pb.go @@ -3,8 +3,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 -// protoc v4.24.4 +// protoc-gen-go v1.36.1 +// protoc v5.29.1 // source: admin.proto package admin @@ -24,24 +24,21 @@ const ( ) type UnitStatus struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=Name,proto3" json:"Name,omitempty"` + Description string `protobuf:"bytes,2,opt,name=Description,proto3" json:"Description,omitempty"` + LoadState string `protobuf:"bytes,3,opt,name=LoadState,proto3" json:"LoadState,omitempty"` + ActiveState string `protobuf:"bytes,4,opt,name=ActiveState,proto3" json:"ActiveState,omitempty"` + Path string `protobuf:"bytes,5,opt,name=Path,proto3" json:"Path,omitempty"` unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=Name,proto3" json:"Name,omitempty"` - Description string `protobuf:"bytes,2,opt,name=Description,proto3" json:"Description,omitempty"` - LoadState string `protobuf:"bytes,3,opt,name=LoadState,proto3" json:"LoadState,omitempty"` - ActiveState string `protobuf:"bytes,4,opt,name=ActiveState,proto3" json:"ActiveState,omitempty"` - Path string `protobuf:"bytes,5,opt,name=Path,proto3" json:"Path,omitempty"` + sizeCache protoimpl.SizeCache } func (x *UnitStatus) Reset() { *x = UnitStatus{} - if protoimpl.UnsafeEnabled { - mi := &file_admin_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_admin_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *UnitStatus) String() string { @@ -52,7 +49,7 @@ func (*UnitStatus) ProtoMessage() {} func (x *UnitStatus) ProtoReflect() protoreflect.Message { mi := &file_admin_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -103,23 +100,20 @@ func (x *UnitStatus) GetPath() string { } type TransportConfig struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Protocol string `protobuf:"bytes,1,opt,name=Protocol,proto3" json:"Protocol,omitempty"` + Address string `protobuf:"bytes,2,opt,name=Address,proto3" json:"Address,omitempty"` + Port string `protobuf:"bytes,3,opt,name=Port,proto3" json:"Port,omitempty"` + Name string `protobuf:"bytes,4,opt,name=Name,proto3" json:"Name,omitempty"` unknownFields protoimpl.UnknownFields - - Protocol string `protobuf:"bytes,1,opt,name=Protocol,proto3" json:"Protocol,omitempty"` - Address string `protobuf:"bytes,2,opt,name=Address,proto3" json:"Address,omitempty"` - Port string `protobuf:"bytes,3,opt,name=Port,proto3" json:"Port,omitempty"` - Name string `protobuf:"bytes,4,opt,name=Name,proto3" json:"Name,omitempty"` + sizeCache protoimpl.SizeCache } func (x *TransportConfig) Reset() { *x = TransportConfig{} - if protoimpl.UnsafeEnabled { - mi := &file_admin_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_admin_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *TransportConfig) String() string { @@ -130,7 +124,7 @@ func (*TransportConfig) ProtoMessage() {} func (x *TransportConfig) ProtoReflect() protoreflect.Message { mi := &file_admin_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -174,24 +168,21 @@ func (x *TransportConfig) GetName() string { } type RegistryRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=Name,proto3" json:"Name,omitempty"` + Parent string `protobuf:"bytes,2,opt,name=Parent,proto3" json:"Parent,omitempty"` + Type uint32 `protobuf:"varint,3,opt,name=Type,proto3" json:"Type,omitempty"` + Transport *TransportConfig `protobuf:"bytes,4,opt,name=Transport,proto3" json:"Transport,omitempty"` + State *UnitStatus `protobuf:"bytes,5,opt,name=State,proto3" json:"State,omitempty"` unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=Name,proto3" json:"Name,omitempty"` - Parent string `protobuf:"bytes,2,opt,name=Parent,proto3" json:"Parent,omitempty"` - Type uint32 `protobuf:"varint,3,opt,name=Type,proto3" json:"Type,omitempty"` - Transport *TransportConfig `protobuf:"bytes,4,opt,name=Transport,proto3" json:"Transport,omitempty"` - State *UnitStatus `protobuf:"bytes,5,opt,name=State,proto3" json:"State,omitempty"` + sizeCache protoimpl.SizeCache } func (x *RegistryRequest) Reset() { *x = RegistryRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_admin_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_admin_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *RegistryRequest) String() string { @@ -202,7 +193,7 @@ func (*RegistryRequest) ProtoMessage() {} func (x *RegistryRequest) ProtoReflect() protoreflect.Message { mi := &file_admin_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -253,20 +244,17 @@ func (x *RegistryRequest) GetState() *UnitStatus { } type RegistryResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Error *string `protobuf:"bytes,1,opt,name=Error,proto3,oneof" json:"Error,omitempty"` unknownFields protoimpl.UnknownFields - - Error *string `protobuf:"bytes,1,opt,name=Error,proto3,oneof" json:"Error,omitempty"` + sizeCache protoimpl.SizeCache } func (x *RegistryResponse) Reset() { *x = RegistryResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_admin_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_admin_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *RegistryResponse) String() string { @@ -277,7 +265,7 @@ func (*RegistryResponse) ProtoMessage() {} func (x *RegistryResponse) ProtoReflect() protoreflect.Message { mi := &file_admin_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -300,22 +288,19 @@ func (x *RegistryResponse) GetError() string { } type ApplicationRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + AppName string `protobuf:"bytes,1,opt,name=AppName,proto3" json:"AppName,omitempty"` + VmName *string `protobuf:"bytes,2,opt,name=VmName,proto3,oneof" json:"VmName,omitempty"` + Args []string `protobuf:"bytes,3,rep,name=Args,proto3" json:"Args,omitempty"` unknownFields protoimpl.UnknownFields - - AppName string `protobuf:"bytes,1,opt,name=AppName,proto3" json:"AppName,omitempty"` - VmName *string `protobuf:"bytes,2,opt,name=VmName,proto3,oneof" json:"VmName,omitempty"` - Args []string `protobuf:"bytes,3,rep,name=Args,proto3" json:"Args,omitempty"` + sizeCache protoimpl.SizeCache } func (x *ApplicationRequest) Reset() { *x = ApplicationRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_admin_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_admin_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ApplicationRequest) String() string { @@ -326,7 +311,7 @@ func (*ApplicationRequest) ProtoMessage() {} func (x *ApplicationRequest) ProtoReflect() protoreflect.Message { mi := &file_admin_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -363,21 +348,18 @@ func (x *ApplicationRequest) GetArgs() []string { } type ApplicationResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + CmdStatus string `protobuf:"bytes,1,opt,name=CmdStatus,proto3" json:"CmdStatus,omitempty"` + AppStatus string `protobuf:"bytes,2,opt,name=AppStatus,proto3" json:"AppStatus,omitempty"` unknownFields protoimpl.UnknownFields - - CmdStatus string `protobuf:"bytes,1,opt,name=CmdStatus,proto3" json:"CmdStatus,omitempty"` - AppStatus string `protobuf:"bytes,2,opt,name=AppStatus,proto3" json:"AppStatus,omitempty"` + sizeCache protoimpl.SizeCache } func (x *ApplicationResponse) Reset() { *x = ApplicationResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_admin_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_admin_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ApplicationResponse) String() string { @@ -388,7 +370,7 @@ func (*ApplicationResponse) ProtoMessage() {} func (x *ApplicationResponse) ProtoReflect() protoreflect.Message { mi := &file_admin_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -418,18 +400,16 @@ func (x *ApplicationResponse) GetAppStatus() string { } type Empty struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *Empty) Reset() { *x = Empty{} - if protoimpl.UnsafeEnabled { - mi := &file_admin_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_admin_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Empty) String() string { @@ -440,7 +420,7 @@ func (*Empty) ProtoMessage() {} func (x *Empty) ProtoReflect() protoreflect.Message { mi := &file_admin_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -456,23 +436,24 @@ func (*Empty) Descriptor() ([]byte, []int) { } type QueryListItem struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=Name,proto3" json:"Name,omitempty"` + Description string `protobuf:"bytes,2,opt,name=Description,proto3" json:"Description,omitempty"` + VmStatus string `protobuf:"bytes,3,opt,name=VmStatus,proto3" json:"VmStatus,omitempty"` + TrustLevel string `protobuf:"bytes,4,opt,name=TrustLevel,proto3" json:"TrustLevel,omitempty"` + VmType string `protobuf:"bytes,5,opt,name=VmType,proto3" json:"VmType,omitempty"` + ServiceType string `protobuf:"bytes,6,opt,name=ServiceType,proto3" json:"ServiceType,omitempty"` + VmName *string `protobuf:"bytes,7,opt,name=VmName,proto3,oneof" json:"VmName,omitempty"` // None for host running services + AgentName *string `protobuf:"bytes,8,opt,name=AgentName,proto3,oneof" json:"AgentName,omitempty"` // None for agents unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=Name,proto3" json:"Name,omitempty"` - Description string `protobuf:"bytes,2,opt,name=Description,proto3" json:"Description,omitempty"` - VmStatus string `protobuf:"bytes,3,opt,name=VmStatus,proto3" json:"VmStatus,omitempty"` - TrustLevel string `protobuf:"bytes,4,opt,name=TrustLevel,proto3" json:"TrustLevel,omitempty"` + sizeCache protoimpl.SizeCache } func (x *QueryListItem) Reset() { *x = QueryListItem{} - if protoimpl.UnsafeEnabled { - mi := &file_admin_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_admin_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *QueryListItem) String() string { @@ -483,7 +464,7 @@ func (*QueryListItem) ProtoMessage() {} func (x *QueryListItem) ProtoReflect() protoreflect.Message { mi := &file_admin_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -526,21 +507,46 @@ func (x *QueryListItem) GetTrustLevel() string { return "" } +func (x *QueryListItem) GetVmType() string { + if x != nil { + return x.VmType + } + return "" +} + +func (x *QueryListItem) GetServiceType() string { + if x != nil { + return x.ServiceType + } + return "" +} + +func (x *QueryListItem) GetVmName() string { + if x != nil && x.VmName != nil { + return *x.VmName + } + return "" +} + +func (x *QueryListItem) GetAgentName() string { + if x != nil && x.AgentName != nil { + return *x.AgentName + } + return "" +} + type QueryListResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + List []*QueryListItem `protobuf:"bytes,1,rep,name=List,proto3" json:"List,omitempty"` unknownFields protoimpl.UnknownFields - - List []*QueryListItem `protobuf:"bytes,1,rep,name=List,proto3" json:"List,omitempty"` + sizeCache protoimpl.SizeCache } func (x *QueryListResponse) Reset() { *x = QueryListResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_admin_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_admin_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *QueryListResponse) String() string { @@ -551,7 +557,7 @@ func (*QueryListResponse) ProtoMessage() {} func (x *QueryListResponse) ProtoReflect() protoreflect.Message { mi := &file_admin_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -574,26 +580,23 @@ func (x *QueryListResponse) GetList() []*QueryListItem { } type WatchItem struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Status: + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to Status: // // *WatchItem_Initial // *WatchItem_Added // *WatchItem_Updated // *WatchItem_Removed - Status isWatchItem_Status `protobuf_oneof:"Status"` + Status isWatchItem_Status `protobuf_oneof:"Status"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *WatchItem) Reset() { *x = WatchItem{} - if protoimpl.UnsafeEnabled { - mi := &file_admin_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_admin_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *WatchItem) String() string { @@ -604,7 +607,7 @@ func (*WatchItem) ProtoMessage() {} func (x *WatchItem) ProtoReflect() protoreflect.Message { mi := &file_admin_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -619,37 +622,45 @@ func (*WatchItem) Descriptor() ([]byte, []int) { return file_admin_proto_rawDescGZIP(), []int{9} } -func (m *WatchItem) GetStatus() isWatchItem_Status { - if m != nil { - return m.Status +func (x *WatchItem) GetStatus() isWatchItem_Status { + if x != nil { + return x.Status } return nil } func (x *WatchItem) GetInitial() *QueryListResponse { - if x, ok := x.GetStatus().(*WatchItem_Initial); ok { - return x.Initial + if x != nil { + if x, ok := x.Status.(*WatchItem_Initial); ok { + return x.Initial + } } return nil } func (x *WatchItem) GetAdded() *QueryListItem { - if x, ok := x.GetStatus().(*WatchItem_Added); ok { - return x.Added + if x != nil { + if x, ok := x.Status.(*WatchItem_Added); ok { + return x.Added + } } return nil } func (x *WatchItem) GetUpdated() *QueryListItem { - if x, ok := x.GetStatus().(*WatchItem_Updated); ok { - return x.Updated + if x != nil { + if x, ok := x.Status.(*WatchItem_Updated); ok { + return x.Updated + } } return nil } func (x *WatchItem) GetRemoved() *QueryListItem { - if x, ok := x.GetStatus().(*WatchItem_Removed); ok { - return x.Removed + if x != nil { + if x, ok := x.Status.(*WatchItem_Removed); ok { + return x.Removed + } } return nil } @@ -683,20 +694,17 @@ func (*WatchItem_Updated) isWatchItem_Status() {} func (*WatchItem_Removed) isWatchItem_Status() {} type LocaleRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Locale string `protobuf:"bytes,1,opt,name=Locale,proto3" json:"Locale,omitempty"` unknownFields protoimpl.UnknownFields - - Locale string `protobuf:"bytes,1,opt,name=Locale,proto3" json:"Locale,omitempty"` + sizeCache protoimpl.SizeCache } func (x *LocaleRequest) Reset() { *x = LocaleRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_admin_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_admin_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *LocaleRequest) String() string { @@ -707,7 +715,7 @@ func (*LocaleRequest) ProtoMessage() {} func (x *LocaleRequest) ProtoReflect() protoreflect.Message { mi := &file_admin_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -730,20 +738,17 @@ func (x *LocaleRequest) GetLocale() string { } type TimezoneRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Timezone string `protobuf:"bytes,1,opt,name=Timezone,proto3" json:"Timezone,omitempty"` unknownFields protoimpl.UnknownFields - - Timezone string `protobuf:"bytes,1,opt,name=Timezone,proto3" json:"Timezone,omitempty"` + sizeCache protoimpl.SizeCache } func (x *TimezoneRequest) Reset() { *x = TimezoneRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_admin_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_admin_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *TimezoneRequest) String() string { @@ -754,7 +759,7 @@ func (*TimezoneRequest) ProtoMessage() {} func (x *TimezoneRequest) ProtoReflect() protoreflect.Message { mi := &file_admin_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -824,7 +829,7 @@ var file_admin_proto_rawDesc = []byte{ 0x52, 0x09, 0x43, 0x6d, 0x64, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x41, 0x70, 0x70, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x41, 0x70, 0x70, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x07, 0x0a, 0x05, 0x45, 0x6d, 0x70, - 0x74, 0x79, 0x22, 0x81, 0x01, 0x0a, 0x0d, 0x51, 0x75, 0x65, 0x72, 0x79, 0x4c, 0x69, 0x73, 0x74, + 0x74, 0x79, 0x22, 0x94, 0x02, 0x0a, 0x0d, 0x51, 0x75, 0x65, 0x72, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x44, @@ -832,79 +837,88 @@ var file_admin_proto_rawDesc = []byte{ 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x56, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x54, 0x72, 0x75, 0x73, 0x74, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x54, 0x72, 0x75, 0x73, - 0x74, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x22, 0x3d, 0x0a, 0x11, 0x51, 0x75, 0x65, 0x72, 0x79, 0x4c, - 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x28, 0x0a, 0x04, 0x4c, - 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x61, 0x64, 0x6d, 0x69, - 0x6e, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x74, 0x65, 0x6d, 0x52, - 0x04, 0x4c, 0x69, 0x73, 0x74, 0x22, 0xdd, 0x01, 0x0a, 0x09, 0x57, 0x61, 0x74, 0x63, 0x68, 0x49, - 0x74, 0x65, 0x6d, 0x12, 0x34, 0x0a, 0x07, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x51, 0x75, 0x65, - 0x72, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x00, - 0x52, 0x07, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x12, 0x2c, 0x0a, 0x05, 0x41, 0x64, 0x64, - 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, - 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x74, 0x65, 0x6d, 0x48, 0x00, - 0x52, 0x05, 0x41, 0x64, 0x64, 0x65, 0x64, 0x12, 0x30, 0x0a, 0x07, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, - 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x74, 0x65, 0x6d, 0x48, 0x00, - 0x52, 0x07, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x12, 0x30, 0x0a, 0x07, 0x52, 0x65, 0x6d, - 0x6f, 0x76, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x61, 0x64, 0x6d, - 0x69, 0x6e, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x74, 0x65, 0x6d, - 0x48, 0x00, 0x52, 0x07, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x42, 0x08, 0x0a, 0x06, 0x53, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x27, 0x0a, 0x0d, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x22, 0x2d, - 0x0a, 0x0f, 0x54, 0x69, 0x6d, 0x65, 0x7a, 0x6f, 0x6e, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x54, 0x69, 0x6d, 0x65, 0x7a, 0x6f, 0x6e, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x08, 0x54, 0x69, 0x6d, 0x65, 0x7a, 0x6f, 0x6e, 0x65, 0x32, 0xf9, 0x05, - 0x0a, 0x0c, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x44, - 0x0a, 0x0f, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x12, 0x16, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, - 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x61, 0x64, 0x6d, 0x69, - 0x6e, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x00, 0x12, 0x4b, 0x0a, 0x10, 0x53, 0x74, 0x61, 0x72, 0x74, 0x41, 0x70, 0x70, + 0x74, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x56, 0x6d, 0x54, 0x79, 0x70, 0x65, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x56, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x12, 0x20, + 0x0a, 0x0b, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0b, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, + 0x12, 0x1b, 0x0a, 0x06, 0x56, 0x6d, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, + 0x48, 0x00, 0x52, 0x06, 0x56, 0x6d, 0x4e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x21, 0x0a, + 0x09, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, + 0x48, 0x01, 0x52, 0x09, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, + 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x56, 0x6d, 0x4e, 0x61, 0x6d, 0x65, 0x42, 0x0c, 0x0a, 0x0a, 0x5f, + 0x41, 0x67, 0x65, 0x6e, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x3d, 0x0a, 0x11, 0x51, 0x75, 0x65, + 0x72, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x28, + 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x61, + 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x74, + 0x65, 0x6d, 0x52, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x22, 0xdd, 0x01, 0x0a, 0x09, 0x57, 0x61, 0x74, + 0x63, 0x68, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x34, 0x0a, 0x07, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, + 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, + 0x51, 0x75, 0x65, 0x72, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x48, 0x00, 0x52, 0x07, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x12, 0x2c, 0x0a, 0x05, + 0x41, 0x64, 0x64, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x61, 0x64, + 0x6d, 0x69, 0x6e, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x74, 0x65, + 0x6d, 0x48, 0x00, 0x52, 0x05, 0x41, 0x64, 0x64, 0x65, 0x64, 0x12, 0x30, 0x0a, 0x07, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x61, 0x64, + 0x6d, 0x69, 0x6e, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x74, 0x65, + 0x6d, 0x48, 0x00, 0x52, 0x07, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x12, 0x30, 0x0a, 0x07, + 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, + 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x49, + 0x74, 0x65, 0x6d, 0x48, 0x00, 0x52, 0x07, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x42, 0x08, + 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x27, 0x0a, 0x0d, 0x4c, 0x6f, 0x63, 0x61, + 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x4c, 0x6f, 0x63, + 0x61, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x4c, 0x6f, 0x63, 0x61, 0x6c, + 0x65, 0x22, 0x2d, 0x0a, 0x0f, 0x54, 0x69, 0x6d, 0x65, 0x7a, 0x6f, 0x6e, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x54, 0x69, 0x6d, 0x65, 0x7a, 0x6f, 0x6e, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x54, 0x69, 0x6d, 0x65, 0x7a, 0x6f, 0x6e, 0x65, + 0x32, 0xf9, 0x05, 0x0a, 0x0c, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x12, 0x44, 0x0a, 0x0f, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x12, 0x16, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x52, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x61, + 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4b, 0x0a, 0x10, 0x53, 0x74, 0x61, 0x72, 0x74, + 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x2e, 0x61, 0x64, + 0x6d, 0x69, 0x6e, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x41, + 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x00, 0x12, 0x4b, 0x0a, 0x10, 0x50, 0x61, 0x75, 0x73, 0x65, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x00, 0x12, 0x4b, 0x0a, 0x10, 0x50, 0x61, 0x75, 0x73, 0x65, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x41, 0x70, - 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x1a, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4c, - 0x0a, 0x11, 0x52, 0x65, 0x73, 0x75, 0x6d, 0x65, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x41, 0x70, 0x70, 0x6c, - 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, - 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4a, 0x0a, 0x0f, - 0x53, 0x74, 0x6f, 0x70, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, - 0x19, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x61, 0x64, 0x6d, - 0x69, 0x6e, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x31, 0x0a, 0x09, 0x53, 0x65, 0x74, 0x4c, - 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x12, 0x14, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x4c, 0x6f, - 0x63, 0x61, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0c, 0x2e, 0x61, 0x64, - 0x6d, 0x69, 0x6e, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x35, 0x0a, 0x0b, 0x53, - 0x65, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x7a, 0x6f, 0x6e, 0x65, 0x12, 0x16, 0x2e, 0x61, 0x64, 0x6d, - 0x69, 0x6e, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x7a, 0x6f, 0x6e, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x0c, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, - 0x22, 0x00, 0x12, 0x28, 0x0a, 0x08, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x6f, 0x66, 0x66, 0x12, 0x0c, - 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x0c, 0x2e, 0x61, - 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x26, 0x0a, 0x06, - 0x52, 0x65, 0x62, 0x6f, 0x6f, 0x74, 0x12, 0x0c, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x45, - 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x0c, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x45, 0x6d, 0x70, - 0x74, 0x79, 0x22, 0x00, 0x12, 0x27, 0x0a, 0x07, 0x53, 0x75, 0x73, 0x70, 0x65, 0x6e, 0x64, 0x12, - 0x0c, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x0c, 0x2e, - 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x26, 0x0a, - 0x06, 0x57, 0x61, 0x6b, 0x65, 0x75, 0x70, 0x12, 0x0c, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, - 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x0c, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x45, 0x6d, - 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x35, 0x0a, 0x09, 0x51, 0x75, 0x65, 0x72, 0x79, 0x4c, 0x69, - 0x73, 0x74, 0x12, 0x0c, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, - 0x1a, 0x18, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x4c, 0x69, - 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x2b, 0x0a, 0x05, - 0x57, 0x61, 0x74, 0x63, 0x68, 0x12, 0x0c, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x45, 0x6d, - 0x70, 0x74, 0x79, 0x1a, 0x10, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x57, 0x61, 0x74, 0x63, - 0x68, 0x49, 0x74, 0x65, 0x6d, 0x22, 0x00, 0x30, 0x01, 0x42, 0x09, 0x5a, 0x07, 0x2e, 0x2f, 0x61, - 0x64, 0x6d, 0x69, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x00, 0x12, 0x4c, 0x0a, 0x11, 0x52, 0x65, 0x73, 0x75, 0x6d, 0x65, 0x41, 0x70, 0x70, 0x6c, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x41, + 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x1a, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, + 0x4a, 0x0a, 0x0f, 0x53, 0x74, 0x6f, 0x70, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x12, 0x19, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, + 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x31, 0x0a, 0x09, 0x53, + 0x65, 0x74, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x12, 0x14, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, + 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0c, + 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x35, + 0x0a, 0x0b, 0x53, 0x65, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x7a, 0x6f, 0x6e, 0x65, 0x12, 0x16, 0x2e, + 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x7a, 0x6f, 0x6e, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0c, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x45, 0x6d, + 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x28, 0x0a, 0x08, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x6f, 0x66, + 0x66, 0x12, 0x0c, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, + 0x0c, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, + 0x26, 0x0a, 0x06, 0x52, 0x65, 0x62, 0x6f, 0x6f, 0x74, 0x12, 0x0c, 0x2e, 0x61, 0x64, 0x6d, 0x69, + 0x6e, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x0c, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, + 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x27, 0x0a, 0x07, 0x53, 0x75, 0x73, 0x70, 0x65, + 0x6e, 0x64, 0x12, 0x0c, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, + 0x1a, 0x0c, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, + 0x12, 0x26, 0x0a, 0x06, 0x57, 0x61, 0x6b, 0x65, 0x75, 0x70, 0x12, 0x0c, 0x2e, 0x61, 0x64, 0x6d, + 0x69, 0x6e, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x0c, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, + 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x35, 0x0a, 0x09, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x0c, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x45, 0x6d, + 0x70, 0x74, 0x79, 0x1a, 0x18, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, + 0x2b, 0x0a, 0x05, 0x57, 0x61, 0x74, 0x63, 0x68, 0x12, 0x0c, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, + 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x10, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x57, + 0x61, 0x74, 0x63, 0x68, 0x49, 0x74, 0x65, 0x6d, 0x22, 0x00, 0x30, 0x01, 0x42, 0x09, 0x5a, 0x07, + 0x2e, 0x2f, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -920,7 +934,7 @@ func file_admin_proto_rawDescGZIP() []byte { } var file_admin_proto_msgTypes = make([]protoimpl.MessageInfo, 12) -var file_admin_proto_goTypes = []interface{}{ +var file_admin_proto_goTypes = []any{ (*UnitStatus)(nil), // 0: admin.UnitStatus (*TransportConfig)(nil), // 1: admin.TransportConfig (*RegistryRequest)(nil), // 2: admin.RegistryRequest @@ -980,155 +994,10 @@ func file_admin_proto_init() { if File_admin_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_admin_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UnitStatus); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_admin_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TransportConfig); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_admin_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RegistryRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_admin_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RegistryResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_admin_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ApplicationRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_admin_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ApplicationResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_admin_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Empty); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_admin_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QueryListItem); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_admin_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QueryListResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_admin_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*WatchItem); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_admin_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LocaleRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_admin_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TimezoneRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_admin_proto_msgTypes[3].OneofWrappers = []interface{}{} - file_admin_proto_msgTypes[4].OneofWrappers = []interface{}{} - file_admin_proto_msgTypes[9].OneofWrappers = []interface{}{ + file_admin_proto_msgTypes[3].OneofWrappers = []any{} + file_admin_proto_msgTypes[4].OneofWrappers = []any{} + file_admin_proto_msgTypes[7].OneofWrappers = []any{} + file_admin_proto_msgTypes[9].OneofWrappers = []any{ (*WatchItem_Initial)(nil), (*WatchItem_Added)(nil), (*WatchItem_Updated)(nil), diff --git a/api/admin/admin_grpc.pb.go b/modules/api/admin/admin_grpc.pb.go similarity index 87% rename from api/admin/admin_grpc.pb.go rename to modules/api/admin/admin_grpc.pb.go index a37c0ff..8b901cd 100644 --- a/api/admin/admin_grpc.pb.go +++ b/modules/api/admin/admin_grpc.pb.go @@ -3,8 +3,8 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc v4.24.4 +// - protoc-gen-go-grpc v1.5.1 +// - protoc v5.29.1 // source: admin.proto package admin @@ -18,8 +18,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( AdminService_RegisterService_FullMethodName = "/admin.AdminService/RegisterService" @@ -53,7 +53,7 @@ type AdminServiceClient interface { Suspend(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error) Wakeup(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error) QueryList(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*QueryListResponse, error) - Watch(ctx context.Context, in *Empty, opts ...grpc.CallOption) (AdminService_WatchClient, error) + Watch(ctx context.Context, in *Empty, opts ...grpc.CallOption) (grpc.ServerStreamingClient[WatchItem], error) } type adminServiceClient struct { @@ -65,8 +65,9 @@ func NewAdminServiceClient(cc grpc.ClientConnInterface) AdminServiceClient { } func (c *adminServiceClient) RegisterService(ctx context.Context, in *RegistryRequest, opts ...grpc.CallOption) (*RegistryResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(RegistryResponse) - err := c.cc.Invoke(ctx, AdminService_RegisterService_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, AdminService_RegisterService_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -74,8 +75,9 @@ func (c *adminServiceClient) RegisterService(ctx context.Context, in *RegistryRe } func (c *adminServiceClient) StartApplication(ctx context.Context, in *ApplicationRequest, opts ...grpc.CallOption) (*ApplicationResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(ApplicationResponse) - err := c.cc.Invoke(ctx, AdminService_StartApplication_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, AdminService_StartApplication_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -83,8 +85,9 @@ func (c *adminServiceClient) StartApplication(ctx context.Context, in *Applicati } func (c *adminServiceClient) PauseApplication(ctx context.Context, in *ApplicationRequest, opts ...grpc.CallOption) (*ApplicationResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(ApplicationResponse) - err := c.cc.Invoke(ctx, AdminService_PauseApplication_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, AdminService_PauseApplication_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -92,8 +95,9 @@ func (c *adminServiceClient) PauseApplication(ctx context.Context, in *Applicati } func (c *adminServiceClient) ResumeApplication(ctx context.Context, in *ApplicationRequest, opts ...grpc.CallOption) (*ApplicationResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(ApplicationResponse) - err := c.cc.Invoke(ctx, AdminService_ResumeApplication_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, AdminService_ResumeApplication_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -101,8 +105,9 @@ func (c *adminServiceClient) ResumeApplication(ctx context.Context, in *Applicat } func (c *adminServiceClient) StopApplication(ctx context.Context, in *ApplicationRequest, opts ...grpc.CallOption) (*ApplicationResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(ApplicationResponse) - err := c.cc.Invoke(ctx, AdminService_StopApplication_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, AdminService_StopApplication_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -110,8 +115,9 @@ func (c *adminServiceClient) StopApplication(ctx context.Context, in *Applicatio } func (c *adminServiceClient) SetLocale(ctx context.Context, in *LocaleRequest, opts ...grpc.CallOption) (*Empty, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(Empty) - err := c.cc.Invoke(ctx, AdminService_SetLocale_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, AdminService_SetLocale_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -119,8 +125,9 @@ func (c *adminServiceClient) SetLocale(ctx context.Context, in *LocaleRequest, o } func (c *adminServiceClient) SetTimezone(ctx context.Context, in *TimezoneRequest, opts ...grpc.CallOption) (*Empty, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(Empty) - err := c.cc.Invoke(ctx, AdminService_SetTimezone_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, AdminService_SetTimezone_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -128,8 +135,9 @@ func (c *adminServiceClient) SetTimezone(ctx context.Context, in *TimezoneReques } func (c *adminServiceClient) Poweroff(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(Empty) - err := c.cc.Invoke(ctx, AdminService_Poweroff_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, AdminService_Poweroff_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -137,8 +145,9 @@ func (c *adminServiceClient) Poweroff(ctx context.Context, in *Empty, opts ...gr } func (c *adminServiceClient) Reboot(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(Empty) - err := c.cc.Invoke(ctx, AdminService_Reboot_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, AdminService_Reboot_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -146,8 +155,9 @@ func (c *adminServiceClient) Reboot(ctx context.Context, in *Empty, opts ...grpc } func (c *adminServiceClient) Suspend(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(Empty) - err := c.cc.Invoke(ctx, AdminService_Suspend_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, AdminService_Suspend_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -155,8 +165,9 @@ func (c *adminServiceClient) Suspend(ctx context.Context, in *Empty, opts ...grp } func (c *adminServiceClient) Wakeup(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(Empty) - err := c.cc.Invoke(ctx, AdminService_Wakeup_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, AdminService_Wakeup_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -164,20 +175,22 @@ func (c *adminServiceClient) Wakeup(ctx context.Context, in *Empty, opts ...grpc } func (c *adminServiceClient) QueryList(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*QueryListResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(QueryListResponse) - err := c.cc.Invoke(ctx, AdminService_QueryList_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, AdminService_QueryList_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -func (c *adminServiceClient) Watch(ctx context.Context, in *Empty, opts ...grpc.CallOption) (AdminService_WatchClient, error) { - stream, err := c.cc.NewStream(ctx, &AdminService_ServiceDesc.Streams[0], AdminService_Watch_FullMethodName, opts...) +func (c *adminServiceClient) Watch(ctx context.Context, in *Empty, opts ...grpc.CallOption) (grpc.ServerStreamingClient[WatchItem], error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &AdminService_ServiceDesc.Streams[0], AdminService_Watch_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &adminServiceWatchClient{stream} + x := &grpc.GenericClientStream[Empty, WatchItem]{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -187,26 +200,12 @@ func (c *adminServiceClient) Watch(ctx context.Context, in *Empty, opts ...grpc. return x, nil } -type AdminService_WatchClient interface { - Recv() (*WatchItem, error) - grpc.ClientStream -} - -type adminServiceWatchClient struct { - grpc.ClientStream -} - -func (x *adminServiceWatchClient) Recv() (*WatchItem, error) { - m := new(WatchItem) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type AdminService_WatchClient = grpc.ServerStreamingClient[WatchItem] // AdminServiceServer is the server API for AdminService service. // All implementations must embed UnimplementedAdminServiceServer -// for forward compatibility +// for forward compatibility. type AdminServiceServer interface { RegisterService(context.Context, *RegistryRequest) (*RegistryResponse, error) StartApplication(context.Context, *ApplicationRequest) (*ApplicationResponse, error) @@ -220,13 +219,16 @@ type AdminServiceServer interface { Suspend(context.Context, *Empty) (*Empty, error) Wakeup(context.Context, *Empty) (*Empty, error) QueryList(context.Context, *Empty) (*QueryListResponse, error) - Watch(*Empty, AdminService_WatchServer) error + Watch(*Empty, grpc.ServerStreamingServer[WatchItem]) error mustEmbedUnimplementedAdminServiceServer() } -// UnimplementedAdminServiceServer must be embedded to have forward compatible implementations. -type UnimplementedAdminServiceServer struct { -} +// UnimplementedAdminServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedAdminServiceServer struct{} func (UnimplementedAdminServiceServer) RegisterService(context.Context, *RegistryRequest) (*RegistryResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method RegisterService not implemented") @@ -264,10 +266,11 @@ func (UnimplementedAdminServiceServer) Wakeup(context.Context, *Empty) (*Empty, func (UnimplementedAdminServiceServer) QueryList(context.Context, *Empty) (*QueryListResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method QueryList not implemented") } -func (UnimplementedAdminServiceServer) Watch(*Empty, AdminService_WatchServer) error { +func (UnimplementedAdminServiceServer) Watch(*Empty, grpc.ServerStreamingServer[WatchItem]) error { return status.Errorf(codes.Unimplemented, "method Watch not implemented") } func (UnimplementedAdminServiceServer) mustEmbedUnimplementedAdminServiceServer() {} +func (UnimplementedAdminServiceServer) testEmbeddedByValue() {} // UnsafeAdminServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to AdminServiceServer will @@ -277,6 +280,13 @@ type UnsafeAdminServiceServer interface { } func RegisterAdminServiceServer(s grpc.ServiceRegistrar, srv AdminServiceServer) { + // If the following call pancis, it indicates UnimplementedAdminServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(&AdminService_ServiceDesc, srv) } @@ -501,21 +511,11 @@ func _AdminService_Watch_Handler(srv interface{}, stream grpc.ServerStream) erro if err := stream.RecvMsg(m); err != nil { return err } - return srv.(AdminServiceServer).Watch(m, &adminServiceWatchServer{stream}) -} - -type AdminService_WatchServer interface { - Send(*WatchItem) error - grpc.ServerStream + return srv.(AdminServiceServer).Watch(m, &grpc.GenericServerStream[Empty, WatchItem]{ServerStream: stream}) } -type adminServiceWatchServer struct { - grpc.ServerStream -} - -func (x *adminServiceWatchServer) Send(m *WatchItem) error { - return x.ServerStream.SendMsg(m) -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type AdminService_WatchServer = grpc.ServerStreamingServer[WatchItem] // AdminService_ServiceDesc is the grpc.ServiceDesc for AdminService service. // It's only intended for direct use with grpc.RegisterService, diff --git a/api/hwid/hwid.pb.go b/modules/api/hwid/hwid.pb.go similarity index 79% rename from api/hwid/hwid.pb.go rename to modules/api/hwid/hwid.pb.go index ac069c8..229f753 100644 --- a/api/hwid/hwid.pb.go +++ b/modules/api/hwid/hwid.pb.go @@ -3,8 +3,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 -// protoc v4.24.4 +// protoc-gen-go v1.36.1 +// protoc v5.29.1 // source: hwid.proto package hwid @@ -24,18 +24,16 @@ const ( ) type HwIdRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *HwIdRequest) Reset() { *x = HwIdRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_hwid_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_hwid_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *HwIdRequest) String() string { @@ -46,7 +44,7 @@ func (*HwIdRequest) ProtoMessage() {} func (x *HwIdRequest) ProtoReflect() protoreflect.Message { mi := &file_hwid_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -62,20 +60,17 @@ func (*HwIdRequest) Descriptor() ([]byte, []int) { } type HwIdResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Identifier string `protobuf:"bytes,1,opt,name=Identifier,proto3" json:"Identifier,omitempty"` unknownFields protoimpl.UnknownFields - - Identifier string `protobuf:"bytes,1,opt,name=Identifier,proto3" json:"Identifier,omitempty"` + sizeCache protoimpl.SizeCache } func (x *HwIdResponse) Reset() { *x = HwIdResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_hwid_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_hwid_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *HwIdResponse) String() string { @@ -86,7 +81,7 @@ func (*HwIdResponse) ProtoMessage() {} func (x *HwIdResponse) ProtoReflect() protoreflect.Message { mi := &file_hwid_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -137,7 +132,7 @@ func file_hwid_proto_rawDescGZIP() []byte { } var file_hwid_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_hwid_proto_goTypes = []interface{}{ +var file_hwid_proto_goTypes = []any{ (*HwIdRequest)(nil), // 0: hwid.HwIdRequest (*HwIdResponse)(nil), // 1: hwid.HwIdResponse } @@ -156,32 +151,6 @@ func file_hwid_proto_init() { if File_hwid_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_hwid_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HwIdRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_hwid_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HwIdResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/api/hwid/hwid_grpc.pb.go b/modules/api/hwid/hwid_grpc.pb.go similarity index 77% rename from api/hwid/hwid_grpc.pb.go rename to modules/api/hwid/hwid_grpc.pb.go index d3099a5..d8edb52 100644 --- a/api/hwid/hwid_grpc.pb.go +++ b/modules/api/hwid/hwid_grpc.pb.go @@ -3,8 +3,8 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc v4.24.4 +// - protoc-gen-go-grpc v1.5.1 +// - protoc v5.29.1 // source: hwid.proto package hwid @@ -18,8 +18,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( HwidService_GetHwId_FullMethodName = "/hwid.HwidService/GetHwId" @@ -41,8 +41,9 @@ func NewHwidServiceClient(cc grpc.ClientConnInterface) HwidServiceClient { } func (c *hwidServiceClient) GetHwId(ctx context.Context, in *HwIdRequest, opts ...grpc.CallOption) (*HwIdResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(HwIdResponse) - err := c.cc.Invoke(ctx, HwidService_GetHwId_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, HwidService_GetHwId_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -51,20 +52,24 @@ func (c *hwidServiceClient) GetHwId(ctx context.Context, in *HwIdRequest, opts . // HwidServiceServer is the server API for HwidService service. // All implementations must embed UnimplementedHwidServiceServer -// for forward compatibility +// for forward compatibility. type HwidServiceServer interface { GetHwId(context.Context, *HwIdRequest) (*HwIdResponse, error) mustEmbedUnimplementedHwidServiceServer() } -// UnimplementedHwidServiceServer must be embedded to have forward compatible implementations. -type UnimplementedHwidServiceServer struct { -} +// UnimplementedHwidServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedHwidServiceServer struct{} func (UnimplementedHwidServiceServer) GetHwId(context.Context, *HwIdRequest) (*HwIdResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetHwId not implemented") } func (UnimplementedHwidServiceServer) mustEmbedUnimplementedHwidServiceServer() {} +func (UnimplementedHwidServiceServer) testEmbeddedByValue() {} // UnsafeHwidServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to HwidServiceServer will @@ -74,6 +79,13 @@ type UnsafeHwidServiceServer interface { } func RegisterHwidServiceServer(s grpc.ServiceRegistrar, srv HwidServiceServer) { + // If the following call pancis, it indicates UnimplementedHwidServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(&HwidService_ServiceDesc, srv) } diff --git a/api/locale/locale.pb.go b/modules/api/locale/locale.pb.go similarity index 78% rename from api/locale/locale.pb.go rename to modules/api/locale/locale.pb.go index ef198e9..1df8d30 100644 --- a/api/locale/locale.pb.go +++ b/modules/api/locale/locale.pb.go @@ -3,8 +3,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 -// protoc v4.24.4 +// protoc-gen-go v1.36.1 +// protoc v5.29.1 // source: locale.proto package locale @@ -24,20 +24,17 @@ const ( ) type LocaleMessage struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Locale string `protobuf:"bytes,1,opt,name=Locale,proto3" json:"Locale,omitempty"` unknownFields protoimpl.UnknownFields - - Locale string `protobuf:"bytes,1,opt,name=Locale,proto3" json:"Locale,omitempty"` + sizeCache protoimpl.SizeCache } func (x *LocaleMessage) Reset() { *x = LocaleMessage{} - if protoimpl.UnsafeEnabled { - mi := &file_locale_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_locale_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *LocaleMessage) String() string { @@ -48,7 +45,7 @@ func (*LocaleMessage) ProtoMessage() {} func (x *LocaleMessage) ProtoReflect() protoreflect.Message { mi := &file_locale_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -71,20 +68,17 @@ func (x *LocaleMessage) GetLocale() string { } type TimezoneMessage struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Timezone string `protobuf:"bytes,1,opt,name=Timezone,proto3" json:"Timezone,omitempty"` unknownFields protoimpl.UnknownFields - - Timezone string `protobuf:"bytes,1,opt,name=Timezone,proto3" json:"Timezone,omitempty"` + sizeCache protoimpl.SizeCache } func (x *TimezoneMessage) Reset() { *x = TimezoneMessage{} - if protoimpl.UnsafeEnabled { - mi := &file_locale_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_locale_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *TimezoneMessage) String() string { @@ -95,7 +89,7 @@ func (*TimezoneMessage) ProtoMessage() {} func (x *TimezoneMessage) ProtoReflect() protoreflect.Message { mi := &file_locale_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -118,18 +112,16 @@ func (x *TimezoneMessage) GetTimezone() string { } type Empty struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *Empty) Reset() { *x = Empty{} - if protoimpl.UnsafeEnabled { - mi := &file_locale_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_locale_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Empty) String() string { @@ -140,7 +132,7 @@ func (*Empty) ProtoMessage() {} func (x *Empty) ProtoReflect() protoreflect.Message { mi := &file_locale_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -190,7 +182,7 @@ func file_locale_proto_rawDescGZIP() []byte { } var file_locale_proto_msgTypes = make([]protoimpl.MessageInfo, 3) -var file_locale_proto_goTypes = []interface{}{ +var file_locale_proto_goTypes = []any{ (*LocaleMessage)(nil), // 0: locale.LocaleMessage (*TimezoneMessage)(nil), // 1: locale.TimezoneMessage (*Empty)(nil), // 2: locale.Empty @@ -212,44 +204,6 @@ func file_locale_proto_init() { if File_locale_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_locale_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LocaleMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_locale_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TimezoneMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_locale_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Empty); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/api/locale/locale_grpc.pb.go b/modules/api/locale/locale_grpc.pb.go similarity index 82% rename from api/locale/locale_grpc.pb.go rename to modules/api/locale/locale_grpc.pb.go index f281560..3cfdef3 100644 --- a/api/locale/locale_grpc.pb.go +++ b/modules/api/locale/locale_grpc.pb.go @@ -3,8 +3,8 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc v4.24.4 +// - protoc-gen-go-grpc v1.5.1 +// - protoc v5.29.1 // source: locale.proto package locale @@ -18,8 +18,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( LocaleClient_LocaleSet_FullMethodName = "/locale.LocaleClient/LocaleSet" @@ -43,8 +43,9 @@ func NewLocaleClientClient(cc grpc.ClientConnInterface) LocaleClientClient { } func (c *localeClientClient) LocaleSet(ctx context.Context, in *LocaleMessage, opts ...grpc.CallOption) (*Empty, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(Empty) - err := c.cc.Invoke(ctx, LocaleClient_LocaleSet_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, LocaleClient_LocaleSet_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -52,8 +53,9 @@ func (c *localeClientClient) LocaleSet(ctx context.Context, in *LocaleMessage, o } func (c *localeClientClient) TimezoneSet(ctx context.Context, in *TimezoneMessage, opts ...grpc.CallOption) (*Empty, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(Empty) - err := c.cc.Invoke(ctx, LocaleClient_TimezoneSet_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, LocaleClient_TimezoneSet_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -62,16 +64,19 @@ func (c *localeClientClient) TimezoneSet(ctx context.Context, in *TimezoneMessag // LocaleClientServer is the server API for LocaleClient service. // All implementations must embed UnimplementedLocaleClientServer -// for forward compatibility +// for forward compatibility. type LocaleClientServer interface { LocaleSet(context.Context, *LocaleMessage) (*Empty, error) TimezoneSet(context.Context, *TimezoneMessage) (*Empty, error) mustEmbedUnimplementedLocaleClientServer() } -// UnimplementedLocaleClientServer must be embedded to have forward compatible implementations. -type UnimplementedLocaleClientServer struct { -} +// UnimplementedLocaleClientServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedLocaleClientServer struct{} func (UnimplementedLocaleClientServer) LocaleSet(context.Context, *LocaleMessage) (*Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method LocaleSet not implemented") @@ -80,6 +85,7 @@ func (UnimplementedLocaleClientServer) TimezoneSet(context.Context, *TimezoneMes return nil, status.Errorf(codes.Unimplemented, "method TimezoneSet not implemented") } func (UnimplementedLocaleClientServer) mustEmbedUnimplementedLocaleClientServer() {} +func (UnimplementedLocaleClientServer) testEmbeddedByValue() {} // UnsafeLocaleClientServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to LocaleClientServer will @@ -89,6 +95,13 @@ type UnsafeLocaleClientServer interface { } func RegisterLocaleClientServer(s grpc.ServiceRegistrar, srv LocaleClientServer) { + // If the following call pancis, it indicates UnimplementedLocaleClientServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(&LocaleClient_ServiceDesc, srv) } diff --git a/modules/api/protoc.sh b/modules/api/protoc.sh new file mode 100755 index 0000000..37dae23 --- /dev/null +++ b/modules/api/protoc.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +gen_protoc() { + protoc --proto_path="$1" \ + --go_out="$2" --go_opt=paths=source_relative \ + --go-grpc_out="$2" --go-grpc_opt=paths=source_relative \ + "$1"/"$3" +} + +if [ $# -eq 0 ]; then + set -- admin systemd socket hwid locale wifi +fi + +for protob in "$@"; do + gen_protoc api/"$protob" modules/api/"$protob" "$protob".proto +done diff --git a/api/socket/socket.pb.go b/modules/api/socket/socket.pb.go similarity index 95% rename from api/socket/socket.pb.go rename to modules/api/socket/socket.pb.go index 30f673f..1c2dffe 100644 --- a/api/socket/socket.pb.go +++ b/modules/api/socket/socket.pb.go @@ -3,8 +3,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.35.1 -// protoc v5.28.2 +// protoc-gen-go v1.36.1 +// protoc v5.29.1 // source: socket.proto package socketproxy @@ -24,11 +24,10 @@ const ( ) type BytePacket struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Data []byte `protobuf:"bytes,1,opt,name=Data,proto3" json:"Data,omitempty"` unknownFields protoimpl.UnknownFields - - Data []byte `protobuf:"bytes,1,opt,name=Data,proto3" json:"Data,omitempty"` + sizeCache protoimpl.SizeCache } func (x *BytePacket) Reset() { diff --git a/api/socket/socket_grpc.pb.go b/modules/api/socket/socket_grpc.pb.go similarity index 56% rename from api/socket/socket_grpc.pb.go rename to modules/api/socket/socket_grpc.pb.go index b656d3c..e556498 100644 --- a/api/socket/socket_grpc.pb.go +++ b/modules/api/socket/socket_grpc.pb.go @@ -3,8 +3,8 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc v5.28.2 +// - protoc-gen-go-grpc v1.5.1 +// - protoc v5.29.1 // source: socket.proto package socketproxy @@ -18,8 +18,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( SocketStream_TransferData_FullMethodName = "/socketproxy.SocketStream/TransferData" @@ -29,7 +29,7 @@ const ( // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type SocketStreamClient interface { - TransferData(ctx context.Context, opts ...grpc.CallOption) (SocketStream_TransferDataClient, error) + TransferData(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[BytePacket, BytePacket], error) } type socketStreamClient struct { @@ -40,53 +40,39 @@ func NewSocketStreamClient(cc grpc.ClientConnInterface) SocketStreamClient { return &socketStreamClient{cc} } -func (c *socketStreamClient) TransferData(ctx context.Context, opts ...grpc.CallOption) (SocketStream_TransferDataClient, error) { - stream, err := c.cc.NewStream(ctx, &SocketStream_ServiceDesc.Streams[0], SocketStream_TransferData_FullMethodName, opts...) +func (c *socketStreamClient) TransferData(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[BytePacket, BytePacket], error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &SocketStream_ServiceDesc.Streams[0], SocketStream_TransferData_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &socketStreamTransferDataClient{stream} + x := &grpc.GenericClientStream[BytePacket, BytePacket]{ClientStream: stream} return x, nil } -type SocketStream_TransferDataClient interface { - Send(*BytePacket) error - Recv() (*BytePacket, error) - grpc.ClientStream -} - -type socketStreamTransferDataClient struct { - grpc.ClientStream -} - -func (x *socketStreamTransferDataClient) Send(m *BytePacket) error { - return x.ClientStream.SendMsg(m) -} - -func (x *socketStreamTransferDataClient) Recv() (*BytePacket, error) { - m := new(BytePacket) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type SocketStream_TransferDataClient = grpc.BidiStreamingClient[BytePacket, BytePacket] // SocketStreamServer is the server API for SocketStream service. // All implementations must embed UnimplementedSocketStreamServer -// for forward compatibility +// for forward compatibility. type SocketStreamServer interface { - TransferData(SocketStream_TransferDataServer) error + TransferData(grpc.BidiStreamingServer[BytePacket, BytePacket]) error mustEmbedUnimplementedSocketStreamServer() } -// UnimplementedSocketStreamServer must be embedded to have forward compatible implementations. -type UnimplementedSocketStreamServer struct { -} +// UnimplementedSocketStreamServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedSocketStreamServer struct{} -func (UnimplementedSocketStreamServer) TransferData(SocketStream_TransferDataServer) error { +func (UnimplementedSocketStreamServer) TransferData(grpc.BidiStreamingServer[BytePacket, BytePacket]) error { return status.Errorf(codes.Unimplemented, "method TransferData not implemented") } func (UnimplementedSocketStreamServer) mustEmbedUnimplementedSocketStreamServer() {} +func (UnimplementedSocketStreamServer) testEmbeddedByValue() {} // UnsafeSocketStreamServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to SocketStreamServer will @@ -96,34 +82,22 @@ type UnsafeSocketStreamServer interface { } func RegisterSocketStreamServer(s grpc.ServiceRegistrar, srv SocketStreamServer) { + // If the following call pancis, it indicates UnimplementedSocketStreamServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(&SocketStream_ServiceDesc, srv) } func _SocketStream_TransferData_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(SocketStreamServer).TransferData(&socketStreamTransferDataServer{stream}) -} - -type SocketStream_TransferDataServer interface { - Send(*BytePacket) error - Recv() (*BytePacket, error) - grpc.ServerStream -} - -type socketStreamTransferDataServer struct { - grpc.ServerStream + return srv.(SocketStreamServer).TransferData(&grpc.GenericServerStream[BytePacket, BytePacket]{ServerStream: stream}) } -func (x *socketStreamTransferDataServer) Send(m *BytePacket) error { - return x.ServerStream.SendMsg(m) -} - -func (x *socketStreamTransferDataServer) Recv() (*BytePacket, error) { - m := new(BytePacket) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type SocketStream_TransferDataServer = grpc.BidiStreamingServer[BytePacket, BytePacket] // SocketStream_ServiceDesc is the grpc.ServiceDesc for SocketStream service. // It's only intended for direct use with grpc.RegisterService, diff --git a/api/systemd/systemd.pb.go b/modules/api/systemd/systemd.pb.go similarity index 78% rename from api/systemd/systemd.pb.go rename to modules/api/systemd/systemd.pb.go index 10d01a4..9929730 100644 --- a/api/systemd/systemd.pb.go +++ b/modules/api/systemd/systemd.pb.go @@ -3,8 +3,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 -// protoc v4.25.4 +// protoc-gen-go v1.36.1 +// protoc v5.29.1 // source: systemd.proto package systemd @@ -24,20 +24,17 @@ const ( ) type UnitRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + UnitName string `protobuf:"bytes,1,opt,name=UnitName,proto3" json:"UnitName,omitempty"` unknownFields protoimpl.UnknownFields - - UnitName string `protobuf:"bytes,1,opt,name=UnitName,proto3" json:"UnitName,omitempty"` + sizeCache protoimpl.SizeCache } func (x *UnitRequest) Reset() { *x = UnitRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_systemd_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_systemd_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *UnitRequest) String() string { @@ -48,7 +45,7 @@ func (*UnitRequest) ProtoMessage() {} func (x *UnitRequest) ProtoReflect() protoreflect.Message { mi := &file_systemd_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -71,20 +68,17 @@ func (x *UnitRequest) GetUnitName() string { } type UnitResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + CmdStatus string `protobuf:"bytes,1,opt,name=CmdStatus,proto3" json:"CmdStatus,omitempty"` unknownFields protoimpl.UnknownFields - - CmdStatus string `protobuf:"bytes,1,opt,name=CmdStatus,proto3" json:"CmdStatus,omitempty"` + sizeCache protoimpl.SizeCache } func (x *UnitResponse) Reset() { *x = UnitResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_systemd_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_systemd_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *UnitResponse) String() string { @@ -95,7 +89,7 @@ func (*UnitResponse) ProtoMessage() {} func (x *UnitResponse) ProtoReflect() protoreflect.Message { mi := &file_systemd_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -118,21 +112,18 @@ func (x *UnitResponse) GetCmdStatus() string { } type AppUnitRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + UnitName string `protobuf:"bytes,1,opt,name=UnitName,proto3" json:"UnitName,omitempty"` + Args []string `protobuf:"bytes,2,rep,name=Args,proto3" json:"Args,omitempty"` unknownFields protoimpl.UnknownFields - - UnitName string `protobuf:"bytes,1,opt,name=UnitName,proto3" json:"UnitName,omitempty"` - Args []string `protobuf:"bytes,2,rep,name=Args,proto3" json:"Args,omitempty"` + sizeCache protoimpl.SizeCache } func (x *AppUnitRequest) Reset() { *x = AppUnitRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_systemd_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_systemd_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *AppUnitRequest) String() string { @@ -143,7 +134,7 @@ func (*AppUnitRequest) ProtoMessage() {} func (x *AppUnitRequest) ProtoReflect() protoreflect.Message { mi := &file_systemd_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -173,26 +164,23 @@ func (x *AppUnitRequest) GetArgs() []string { } type UnitStatus struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=Name,proto3" json:"Name,omitempty"` + Description string `protobuf:"bytes,2,opt,name=Description,proto3" json:"Description,omitempty"` + LoadState string `protobuf:"bytes,3,opt,name=LoadState,proto3" json:"LoadState,omitempty"` + ActiveState string `protobuf:"bytes,4,opt,name=ActiveState,proto3" json:"ActiveState,omitempty"` + SubState string `protobuf:"bytes,5,opt,name=SubState,proto3" json:"SubState,omitempty"` + Path string `protobuf:"bytes,6,opt,name=Path,proto3" json:"Path,omitempty"` + FreezerState string `protobuf:"bytes,7,opt,name=FreezerState,proto3" json:"FreezerState,omitempty"` unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=Name,proto3" json:"Name,omitempty"` - Description string `protobuf:"bytes,2,opt,name=Description,proto3" json:"Description,omitempty"` - LoadState string `protobuf:"bytes,3,opt,name=LoadState,proto3" json:"LoadState,omitempty"` - ActiveState string `protobuf:"bytes,4,opt,name=ActiveState,proto3" json:"ActiveState,omitempty"` - SubState string `protobuf:"bytes,5,opt,name=SubState,proto3" json:"SubState,omitempty"` - Path string `protobuf:"bytes,6,opt,name=Path,proto3" json:"Path,omitempty"` - FreezerState string `protobuf:"bytes,7,opt,name=FreezerState,proto3" json:"FreezerState,omitempty"` + sizeCache protoimpl.SizeCache } func (x *UnitStatus) Reset() { *x = UnitStatus{} - if protoimpl.UnsafeEnabled { - mi := &file_systemd_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_systemd_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *UnitStatus) String() string { @@ -203,7 +191,7 @@ func (*UnitStatus) ProtoMessage() {} func (x *UnitStatus) ProtoReflect() protoreflect.Message { mi := &file_systemd_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -268,21 +256,18 @@ func (x *UnitStatus) GetFreezerState() string { } type UnitStatusResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + CmdStatus string `protobuf:"bytes,1,opt,name=CmdStatus,proto3" json:"CmdStatus,omitempty"` + UnitStatus *UnitStatus `protobuf:"bytes,2,opt,name=UnitStatus,proto3" json:"UnitStatus,omitempty"` unknownFields protoimpl.UnknownFields - - CmdStatus string `protobuf:"bytes,1,opt,name=CmdStatus,proto3" json:"CmdStatus,omitempty"` - UnitStatus *UnitStatus `protobuf:"bytes,2,opt,name=UnitStatus,proto3" json:"UnitStatus,omitempty"` + sizeCache protoimpl.SizeCache } func (x *UnitStatusResponse) Reset() { *x = UnitStatusResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_systemd_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_systemd_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *UnitStatusResponse) String() string { @@ -293,7 +278,7 @@ func (*UnitStatusResponse) ProtoMessage() {} func (x *UnitStatusResponse) ProtoReflect() protoreflect.Message { mi := &file_systemd_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -323,20 +308,17 @@ func (x *UnitStatusResponse) GetUnitStatus() *UnitStatus { } type UnitResourceRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + UnitName string `protobuf:"bytes,1,opt,name=UnitName,proto3" json:"UnitName,omitempty"` unknownFields protoimpl.UnknownFields - - UnitName string `protobuf:"bytes,1,opt,name=UnitName,proto3" json:"UnitName,omitempty"` + sizeCache protoimpl.SizeCache } func (x *UnitResourceRequest) Reset() { *x = UnitResourceRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_systemd_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_systemd_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *UnitResourceRequest) String() string { @@ -347,7 +329,7 @@ func (*UnitResourceRequest) ProtoMessage() {} func (x *UnitResourceRequest) ProtoReflect() protoreflect.Message { mi := &file_systemd_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -370,21 +352,18 @@ func (x *UnitResourceRequest) GetUnitName() string { } type UnitResourceResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + CpuUsage float64 `protobuf:"fixed64,1,opt,name=CpuUsage,proto3" json:"CpuUsage,omitempty"` + MemoryUsage float32 `protobuf:"fixed32,2,opt,name=MemoryUsage,proto3" json:"MemoryUsage,omitempty"` unknownFields protoimpl.UnknownFields - - CpuUsage float64 `protobuf:"fixed64,1,opt,name=CpuUsage,proto3" json:"CpuUsage,omitempty"` - MemoryUsage float32 `protobuf:"fixed32,2,opt,name=MemoryUsage,proto3" json:"MemoryUsage,omitempty"` + sizeCache protoimpl.SizeCache } func (x *UnitResourceResponse) Reset() { *x = UnitResourceResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_systemd_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_systemd_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *UnitResourceResponse) String() string { @@ -395,7 +374,7 @@ func (*UnitResourceResponse) ProtoMessage() {} func (x *UnitResourceResponse) ProtoReflect() protoreflect.Message { mi := &file_systemd_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -557,92 +536,6 @@ func file_systemd_proto_init() { if File_systemd_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_systemd_proto_msgTypes[0].Exporter = func(v any, i int) any { - switch v := v.(*UnitRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_systemd_proto_msgTypes[1].Exporter = func(v any, i int) any { - switch v := v.(*UnitResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_systemd_proto_msgTypes[2].Exporter = func(v any, i int) any { - switch v := v.(*AppUnitRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_systemd_proto_msgTypes[3].Exporter = func(v any, i int) any { - switch v := v.(*UnitStatus); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_systemd_proto_msgTypes[4].Exporter = func(v any, i int) any { - switch v := v.(*UnitStatusResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_systemd_proto_msgTypes[5].Exporter = func(v any, i int) any { - switch v := v.(*UnitResourceRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_systemd_proto_msgTypes[6].Exporter = func(v any, i int) any { - switch v := v.(*UnitResourceResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/api/systemd/systemd_grpc.pb.go b/modules/api/systemd/systemd_grpc.pb.go similarity index 83% rename from api/systemd/systemd_grpc.pb.go rename to modules/api/systemd/systemd_grpc.pb.go index 60fea3f..e9d27cd 100644 --- a/api/systemd/systemd_grpc.pb.go +++ b/modules/api/systemd/systemd_grpc.pb.go @@ -3,8 +3,8 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc v4.25.4 +// - protoc-gen-go-grpc v1.5.1 +// - protoc v5.29.1 // source: systemd.proto package systemd @@ -18,8 +18,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( UnitControlService_GetUnitStatus_FullMethodName = "/systemd.UnitControlService/GetUnitStatus" @@ -42,7 +42,7 @@ type UnitControlServiceClient interface { KillUnit(ctx context.Context, in *UnitRequest, opts ...grpc.CallOption) (*UnitResponse, error) FreezeUnit(ctx context.Context, in *UnitRequest, opts ...grpc.CallOption) (*UnitResponse, error) UnfreezeUnit(ctx context.Context, in *UnitRequest, opts ...grpc.CallOption) (*UnitResponse, error) - MonitorUnit(ctx context.Context, in *UnitResourceRequest, opts ...grpc.CallOption) (UnitControlService_MonitorUnitClient, error) + MonitorUnit(ctx context.Context, in *UnitResourceRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[UnitResourceResponse], error) StartApplication(ctx context.Context, in *AppUnitRequest, opts ...grpc.CallOption) (*UnitResponse, error) } @@ -55,8 +55,9 @@ func NewUnitControlServiceClient(cc grpc.ClientConnInterface) UnitControlService } func (c *unitControlServiceClient) GetUnitStatus(ctx context.Context, in *UnitRequest, opts ...grpc.CallOption) (*UnitStatusResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(UnitStatusResponse) - err := c.cc.Invoke(ctx, UnitControlService_GetUnitStatus_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, UnitControlService_GetUnitStatus_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -64,8 +65,9 @@ func (c *unitControlServiceClient) GetUnitStatus(ctx context.Context, in *UnitRe } func (c *unitControlServiceClient) StartUnit(ctx context.Context, in *UnitRequest, opts ...grpc.CallOption) (*UnitResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(UnitResponse) - err := c.cc.Invoke(ctx, UnitControlService_StartUnit_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, UnitControlService_StartUnit_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -73,8 +75,9 @@ func (c *unitControlServiceClient) StartUnit(ctx context.Context, in *UnitReques } func (c *unitControlServiceClient) StopUnit(ctx context.Context, in *UnitRequest, opts ...grpc.CallOption) (*UnitResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(UnitResponse) - err := c.cc.Invoke(ctx, UnitControlService_StopUnit_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, UnitControlService_StopUnit_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -82,8 +85,9 @@ func (c *unitControlServiceClient) StopUnit(ctx context.Context, in *UnitRequest } func (c *unitControlServiceClient) KillUnit(ctx context.Context, in *UnitRequest, opts ...grpc.CallOption) (*UnitResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(UnitResponse) - err := c.cc.Invoke(ctx, UnitControlService_KillUnit_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, UnitControlService_KillUnit_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -91,8 +95,9 @@ func (c *unitControlServiceClient) KillUnit(ctx context.Context, in *UnitRequest } func (c *unitControlServiceClient) FreezeUnit(ctx context.Context, in *UnitRequest, opts ...grpc.CallOption) (*UnitResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(UnitResponse) - err := c.cc.Invoke(ctx, UnitControlService_FreezeUnit_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, UnitControlService_FreezeUnit_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -100,20 +105,22 @@ func (c *unitControlServiceClient) FreezeUnit(ctx context.Context, in *UnitReque } func (c *unitControlServiceClient) UnfreezeUnit(ctx context.Context, in *UnitRequest, opts ...grpc.CallOption) (*UnitResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(UnitResponse) - err := c.cc.Invoke(ctx, UnitControlService_UnfreezeUnit_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, UnitControlService_UnfreezeUnit_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -func (c *unitControlServiceClient) MonitorUnit(ctx context.Context, in *UnitResourceRequest, opts ...grpc.CallOption) (UnitControlService_MonitorUnitClient, error) { - stream, err := c.cc.NewStream(ctx, &UnitControlService_ServiceDesc.Streams[0], UnitControlService_MonitorUnit_FullMethodName, opts...) +func (c *unitControlServiceClient) MonitorUnit(ctx context.Context, in *UnitResourceRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[UnitResourceResponse], error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &UnitControlService_ServiceDesc.Streams[0], UnitControlService_MonitorUnit_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &unitControlServiceMonitorUnitClient{stream} + x := &grpc.GenericClientStream[UnitResourceRequest, UnitResourceResponse]{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -123,26 +130,13 @@ func (c *unitControlServiceClient) MonitorUnit(ctx context.Context, in *UnitReso return x, nil } -type UnitControlService_MonitorUnitClient interface { - Recv() (*UnitResourceResponse, error) - grpc.ClientStream -} - -type unitControlServiceMonitorUnitClient struct { - grpc.ClientStream -} - -func (x *unitControlServiceMonitorUnitClient) Recv() (*UnitResourceResponse, error) { - m := new(UnitResourceResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type UnitControlService_MonitorUnitClient = grpc.ServerStreamingClient[UnitResourceResponse] func (c *unitControlServiceClient) StartApplication(ctx context.Context, in *AppUnitRequest, opts ...grpc.CallOption) (*UnitResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(UnitResponse) - err := c.cc.Invoke(ctx, UnitControlService_StartApplication_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, UnitControlService_StartApplication_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -151,7 +145,7 @@ func (c *unitControlServiceClient) StartApplication(ctx context.Context, in *App // UnitControlServiceServer is the server API for UnitControlService service. // All implementations must embed UnimplementedUnitControlServiceServer -// for forward compatibility +// for forward compatibility. type UnitControlServiceServer interface { GetUnitStatus(context.Context, *UnitRequest) (*UnitStatusResponse, error) StartUnit(context.Context, *UnitRequest) (*UnitResponse, error) @@ -159,14 +153,17 @@ type UnitControlServiceServer interface { KillUnit(context.Context, *UnitRequest) (*UnitResponse, error) FreezeUnit(context.Context, *UnitRequest) (*UnitResponse, error) UnfreezeUnit(context.Context, *UnitRequest) (*UnitResponse, error) - MonitorUnit(*UnitResourceRequest, UnitControlService_MonitorUnitServer) error + MonitorUnit(*UnitResourceRequest, grpc.ServerStreamingServer[UnitResourceResponse]) error StartApplication(context.Context, *AppUnitRequest) (*UnitResponse, error) mustEmbedUnimplementedUnitControlServiceServer() } -// UnimplementedUnitControlServiceServer must be embedded to have forward compatible implementations. -type UnimplementedUnitControlServiceServer struct { -} +// UnimplementedUnitControlServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedUnitControlServiceServer struct{} func (UnimplementedUnitControlServiceServer) GetUnitStatus(context.Context, *UnitRequest) (*UnitStatusResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetUnitStatus not implemented") @@ -186,13 +183,14 @@ func (UnimplementedUnitControlServiceServer) FreezeUnit(context.Context, *UnitRe func (UnimplementedUnitControlServiceServer) UnfreezeUnit(context.Context, *UnitRequest) (*UnitResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UnfreezeUnit not implemented") } -func (UnimplementedUnitControlServiceServer) MonitorUnit(*UnitResourceRequest, UnitControlService_MonitorUnitServer) error { +func (UnimplementedUnitControlServiceServer) MonitorUnit(*UnitResourceRequest, grpc.ServerStreamingServer[UnitResourceResponse]) error { return status.Errorf(codes.Unimplemented, "method MonitorUnit not implemented") } func (UnimplementedUnitControlServiceServer) StartApplication(context.Context, *AppUnitRequest) (*UnitResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method StartApplication not implemented") } func (UnimplementedUnitControlServiceServer) mustEmbedUnimplementedUnitControlServiceServer() {} +func (UnimplementedUnitControlServiceServer) testEmbeddedByValue() {} // UnsafeUnitControlServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to UnitControlServiceServer will @@ -202,6 +200,13 @@ type UnsafeUnitControlServiceServer interface { } func RegisterUnitControlServiceServer(s grpc.ServiceRegistrar, srv UnitControlServiceServer) { + // If the following call pancis, it indicates UnimplementedUnitControlServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(&UnitControlService_ServiceDesc, srv) } @@ -318,21 +323,11 @@ func _UnitControlService_MonitorUnit_Handler(srv interface{}, stream grpc.Server if err := stream.RecvMsg(m); err != nil { return err } - return srv.(UnitControlServiceServer).MonitorUnit(m, &unitControlServiceMonitorUnitServer{stream}) -} - -type UnitControlService_MonitorUnitServer interface { - Send(*UnitResourceResponse) error - grpc.ServerStream + return srv.(UnitControlServiceServer).MonitorUnit(m, &grpc.GenericServerStream[UnitResourceRequest, UnitResourceResponse]{ServerStream: stream}) } -type unitControlServiceMonitorUnitServer struct { - grpc.ServerStream -} - -func (x *unitControlServiceMonitorUnitServer) Send(m *UnitResourceResponse) error { - return x.ServerStream.SendMsg(m) -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type UnitControlService_MonitorUnitServer = grpc.ServerStreamingServer[UnitResourceResponse] func _UnitControlService_StartApplication_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(AppUnitRequest) diff --git a/api/wifi/wifi.pb.go b/modules/api/wifi/wifi.pb.go similarity index 78% rename from api/wifi/wifi.pb.go rename to modules/api/wifi/wifi.pb.go index 849bd34..75721a1 100644 --- a/api/wifi/wifi.pb.go +++ b/modules/api/wifi/wifi.pb.go @@ -3,8 +3,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 -// protoc v4.24.4 +// protoc-gen-go v1.36.1 +// protoc v5.29.1 // source: wifi.proto package wifi @@ -24,18 +24,16 @@ const ( ) type EmptyRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *EmptyRequest) Reset() { *x = EmptyRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_wifi_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_wifi_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *EmptyRequest) String() string { @@ -46,7 +44,7 @@ func (*EmptyRequest) ProtoMessage() {} func (x *EmptyRequest) ProtoReflect() protoreflect.Message { mi := &file_wifi_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -62,20 +60,17 @@ func (*EmptyRequest) Descriptor() ([]byte, []int) { } type WifiNetworkRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + NetworkName string `protobuf:"bytes,1,opt,name=NetworkName,proto3" json:"NetworkName,omitempty"` unknownFields protoimpl.UnknownFields - - NetworkName string `protobuf:"bytes,1,opt,name=NetworkName,proto3" json:"NetworkName,omitempty"` + sizeCache protoimpl.SizeCache } func (x *WifiNetworkRequest) Reset() { *x = WifiNetworkRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_wifi_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_wifi_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *WifiNetworkRequest) String() string { @@ -86,7 +81,7 @@ func (*WifiNetworkRequest) ProtoMessage() {} func (x *WifiNetworkRequest) ProtoReflect() protoreflect.Message { mi := &file_wifi_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -109,22 +104,19 @@ func (x *WifiNetworkRequest) GetNetworkName() string { } type WifiConnectionRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + SSID string `protobuf:"bytes,1,opt,name=SSID,proto3" json:"SSID,omitempty"` + Password string `protobuf:"bytes,2,opt,name=Password,proto3" json:"Password,omitempty"` + Settings string `protobuf:"bytes,3,opt,name=Settings,proto3" json:"Settings,omitempty"` unknownFields protoimpl.UnknownFields - - SSID string `protobuf:"bytes,1,opt,name=SSID,proto3" json:"SSID,omitempty"` - Password string `protobuf:"bytes,2,opt,name=Password,proto3" json:"Password,omitempty"` - Settings string `protobuf:"bytes,3,opt,name=Settings,proto3" json:"Settings,omitempty"` + sizeCache protoimpl.SizeCache } func (x *WifiConnectionRequest) Reset() { *x = WifiConnectionRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_wifi_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_wifi_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *WifiConnectionRequest) String() string { @@ -135,7 +127,7 @@ func (*WifiConnectionRequest) ProtoMessage() {} func (x *WifiConnectionRequest) ProtoReflect() protoreflect.Message { mi := &file_wifi_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -172,23 +164,20 @@ func (x *WifiConnectionRequest) GetSettings() string { } type AccessPoint struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Connection bool `protobuf:"varint,1,opt,name=Connection,proto3" json:"Connection,omitempty"` + SSID string `protobuf:"bytes,2,opt,name=SSID,proto3" json:"SSID,omitempty"` + Signal uint32 `protobuf:"varint,3,opt,name=Signal,proto3" json:"Signal,omitempty"` + Security string `protobuf:"bytes,4,opt,name=Security,proto3" json:"Security,omitempty"` unknownFields protoimpl.UnknownFields - - Connection bool `protobuf:"varint,1,opt,name=Connection,proto3" json:"Connection,omitempty"` - SSID string `protobuf:"bytes,2,opt,name=SSID,proto3" json:"SSID,omitempty"` - Signal uint32 `protobuf:"varint,3,opt,name=Signal,proto3" json:"Signal,omitempty"` - Security string `protobuf:"bytes,4,opt,name=Security,proto3" json:"Security,omitempty"` + sizeCache protoimpl.SizeCache } func (x *AccessPoint) Reset() { *x = AccessPoint{} - if protoimpl.UnsafeEnabled { - mi := &file_wifi_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_wifi_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *AccessPoint) String() string { @@ -199,7 +188,7 @@ func (*AccessPoint) ProtoMessage() {} func (x *AccessPoint) ProtoReflect() protoreflect.Message { mi := &file_wifi_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -243,20 +232,17 @@ func (x *AccessPoint) GetSecurity() string { } type WifiNetworkResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Networks []*AccessPoint `protobuf:"bytes,1,rep,name=networks,proto3" json:"networks,omitempty"` unknownFields protoimpl.UnknownFields - - Networks []*AccessPoint `protobuf:"bytes,1,rep,name=networks,proto3" json:"networks,omitempty"` + sizeCache protoimpl.SizeCache } func (x *WifiNetworkResponse) Reset() { *x = WifiNetworkResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_wifi_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_wifi_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *WifiNetworkResponse) String() string { @@ -267,7 +253,7 @@ func (*WifiNetworkResponse) ProtoMessage() {} func (x *WifiNetworkResponse) ProtoReflect() protoreflect.Message { mi := &file_wifi_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -290,20 +276,17 @@ func (x *WifiNetworkResponse) GetNetworks() []*AccessPoint { } type WifiConnectionResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Response string `protobuf:"bytes,1,opt,name=Response,proto3" json:"Response,omitempty"` unknownFields protoimpl.UnknownFields - - Response string `protobuf:"bytes,1,opt,name=Response,proto3" json:"Response,omitempty"` + sizeCache protoimpl.SizeCache } func (x *WifiConnectionResponse) Reset() { *x = WifiConnectionResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_wifi_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_wifi_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *WifiConnectionResponse) String() string { @@ -314,7 +297,7 @@ func (*WifiConnectionResponse) ProtoMessage() {} func (x *WifiConnectionResponse) ProtoReflect() protoreflect.Message { mi := &file_wifi_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -416,7 +399,7 @@ func file_wifi_proto_rawDescGZIP() []byte { } var file_wifi_proto_msgTypes = make([]protoimpl.MessageInfo, 6) -var file_wifi_proto_goTypes = []interface{}{ +var file_wifi_proto_goTypes = []any{ (*EmptyRequest)(nil), // 0: wifimanager.EmptyRequest (*WifiNetworkRequest)(nil), // 1: wifimanager.WifiNetworkRequest (*WifiConnectionRequest)(nil), // 2: wifimanager.WifiConnectionRequest @@ -450,80 +433,6 @@ func file_wifi_proto_init() { if File_wifi_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_wifi_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EmptyRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_wifi_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*WifiNetworkRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_wifi_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*WifiConnectionRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_wifi_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AccessPoint); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_wifi_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*WifiNetworkResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_wifi_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*WifiConnectionResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/api/wifi/wifi_grpc.pb.go b/modules/api/wifi/wifi_grpc.pb.go similarity index 88% rename from api/wifi/wifi_grpc.pb.go rename to modules/api/wifi/wifi_grpc.pb.go index 6656cfb..b6e0f9e 100644 --- a/api/wifi/wifi_grpc.pb.go +++ b/modules/api/wifi/wifi_grpc.pb.go @@ -3,8 +3,8 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc v4.24.4 +// - protoc-gen-go-grpc v1.5.1 +// - protoc v5.29.1 // source: wifi.proto package wifi @@ -18,8 +18,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( WifiService_ListNetwork_FullMethodName = "/wifimanager.WifiService/ListNetwork" @@ -51,8 +51,9 @@ func NewWifiServiceClient(cc grpc.ClientConnInterface) WifiServiceClient { } func (c *wifiServiceClient) ListNetwork(ctx context.Context, in *WifiNetworkRequest, opts ...grpc.CallOption) (*WifiNetworkResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(WifiNetworkResponse) - err := c.cc.Invoke(ctx, WifiService_ListNetwork_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, WifiService_ListNetwork_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -60,8 +61,9 @@ func (c *wifiServiceClient) ListNetwork(ctx context.Context, in *WifiNetworkRequ } func (c *wifiServiceClient) GetActiveConnection(ctx context.Context, in *EmptyRequest, opts ...grpc.CallOption) (*AccessPoint, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(AccessPoint) - err := c.cc.Invoke(ctx, WifiService_GetActiveConnection_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, WifiService_GetActiveConnection_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -69,8 +71,9 @@ func (c *wifiServiceClient) GetActiveConnection(ctx context.Context, in *EmptyRe } func (c *wifiServiceClient) ConnectNetwork(ctx context.Context, in *WifiConnectionRequest, opts ...grpc.CallOption) (*WifiConnectionResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(WifiConnectionResponse) - err := c.cc.Invoke(ctx, WifiService_ConnectNetwork_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, WifiService_ConnectNetwork_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -78,8 +81,9 @@ func (c *wifiServiceClient) ConnectNetwork(ctx context.Context, in *WifiConnecti } func (c *wifiServiceClient) DisconnectNetwork(ctx context.Context, in *EmptyRequest, opts ...grpc.CallOption) (*WifiConnectionResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(WifiConnectionResponse) - err := c.cc.Invoke(ctx, WifiService_DisconnectNetwork_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, WifiService_DisconnectNetwork_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -87,8 +91,9 @@ func (c *wifiServiceClient) DisconnectNetwork(ctx context.Context, in *EmptyRequ } func (c *wifiServiceClient) TurnOn(ctx context.Context, in *EmptyRequest, opts ...grpc.CallOption) (*WifiConnectionResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(WifiConnectionResponse) - err := c.cc.Invoke(ctx, WifiService_TurnOn_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, WifiService_TurnOn_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -96,8 +101,9 @@ func (c *wifiServiceClient) TurnOn(ctx context.Context, in *EmptyRequest, opts . } func (c *wifiServiceClient) TurnOff(ctx context.Context, in *EmptyRequest, opts ...grpc.CallOption) (*WifiConnectionResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(WifiConnectionResponse) - err := c.cc.Invoke(ctx, WifiService_TurnOff_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, WifiService_TurnOff_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -106,7 +112,7 @@ func (c *wifiServiceClient) TurnOff(ctx context.Context, in *EmptyRequest, opts // WifiServiceServer is the server API for WifiService service. // All implementations must embed UnimplementedWifiServiceServer -// for forward compatibility +// for forward compatibility. type WifiServiceServer interface { ListNetwork(context.Context, *WifiNetworkRequest) (*WifiNetworkResponse, error) GetActiveConnection(context.Context, *EmptyRequest) (*AccessPoint, error) @@ -117,9 +123,12 @@ type WifiServiceServer interface { mustEmbedUnimplementedWifiServiceServer() } -// UnimplementedWifiServiceServer must be embedded to have forward compatible implementations. -type UnimplementedWifiServiceServer struct { -} +// UnimplementedWifiServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedWifiServiceServer struct{} func (UnimplementedWifiServiceServer) ListNetwork(context.Context, *WifiNetworkRequest) (*WifiNetworkResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ListNetwork not implemented") @@ -140,6 +149,7 @@ func (UnimplementedWifiServiceServer) TurnOff(context.Context, *EmptyRequest) (* return nil, status.Errorf(codes.Unimplemented, "method TurnOff not implemented") } func (UnimplementedWifiServiceServer) mustEmbedUnimplementedWifiServiceServer() {} +func (UnimplementedWifiServiceServer) testEmbeddedByValue() {} // UnsafeWifiServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to WifiServiceServer will @@ -149,6 +159,13 @@ type UnsafeWifiServiceServer interface { } func RegisterWifiServiceServer(s grpc.ServiceRegistrar, srv WifiServiceServer) { + // If the following call pancis, it indicates UnimplementedWifiServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(&WifiService_ServiceDesc, srv) } diff --git a/internal/cmd/givc-agent/main.go b/modules/cmd/givc-agent/main.go similarity index 91% rename from internal/cmd/givc-agent/main.go rename to modules/cmd/givc-agent/main.go index 2d41db7..17ceb56 100644 --- a/internal/cmd/givc-agent/main.go +++ b/modules/cmd/givc-agent/main.go @@ -12,17 +12,17 @@ import ( "strings" "time" - givc_admin "givc/api/admin" - givc_app "givc/internal/pkgs/applications" - givc_grpc "givc/internal/pkgs/grpc" - givc_hwidmanager "givc/internal/pkgs/hwidmanager" - givc_localelistener "givc/internal/pkgs/localelistener" - givc_serviceclient "givc/internal/pkgs/serviceclient" - givc_servicemanager "givc/internal/pkgs/servicemanager" - givc_socketproxy "givc/internal/pkgs/socketproxy" - givc_types "givc/internal/pkgs/types" - givc_util "givc/internal/pkgs/utility" - givc_wifimanager "givc/internal/pkgs/wifimanager" + givc_admin "givc/modules/api/admin" + givc_app "givc/modules/pkgs/applications" + givc_grpc "givc/modules/pkgs/grpc" + givc_hwidmanager "givc/modules/pkgs/hwidmanager" + givc_localelistener "givc/modules/pkgs/localelistener" + givc_serviceclient "givc/modules/pkgs/serviceclient" + givc_servicemanager "givc/modules/pkgs/servicemanager" + givc_socketproxy "givc/modules/pkgs/socketproxy" + givc_types "givc/modules/pkgs/types" + givc_util "givc/modules/pkgs/utility" + givc_wifimanager "givc/modules/pkgs/wifimanager" log "github.com/sirupsen/logrus" ) @@ -53,14 +53,16 @@ func main() { parentName := os.Getenv("PARENT") - agentType, err := strconv.ParseUint(os.Getenv("TYPE"), 10, 32) - if err != nil || agentType > 14 { + parsedType, err := strconv.ParseUint(os.Getenv("TYPE"), 10, 32) + if err != nil || parsedType > 14 { log.Fatalf("No or wrong 'TYPE' environment variable present.") } - agentSubType, err := strconv.ParseUint(os.Getenv("SUBTYPE"), 10, 32) - if err != nil || agentSubType > 14 { + agentType := uint32(parsedType) + parsedType, err = strconv.ParseUint(os.Getenv("SUBTYPE"), 10, 32) + if err != nil || parsedType > 14 { log.Fatalf("No or wrong 'SUBTYPE' environment variable present.") } + agentSubType := uint32(parsedType) // Configure system services/units to be administrated by this agent var services []string diff --git a/internal/pkgs/applications/applications.go b/modules/pkgs/applications/applications.go similarity index 98% rename from internal/pkgs/applications/applications.go rename to modules/pkgs/applications/applications.go index 13b49a2..ad1bcd2 100644 --- a/internal/pkgs/applications/applications.go +++ b/modules/pkgs/applications/applications.go @@ -5,8 +5,8 @@ package applications import ( "encoding/json" "fmt" - "givc/internal/pkgs/types" - "givc/internal/pkgs/utility" + "givc/modules/pkgs/types" + "givc/modules/pkgs/utility" "net/url" "regexp" "strings" diff --git a/internal/pkgs/applications/applications_test.go b/modules/pkgs/applications/applications_test.go similarity index 99% rename from internal/pkgs/applications/applications_test.go rename to modules/pkgs/applications/applications_test.go index d94d3a0..f1e0b55 100644 --- a/internal/pkgs/applications/applications_test.go +++ b/modules/pkgs/applications/applications_test.go @@ -3,7 +3,7 @@ package applications import ( - "givc/internal/pkgs/types" + "givc/modules/pkgs/types" "reflect" "testing" ) diff --git a/internal/pkgs/grpc/grpcclient.go b/modules/pkgs/grpc/grpcclient.go similarity index 97% rename from internal/pkgs/grpc/grpcclient.go rename to modules/pkgs/grpc/grpcclient.go index a5a95b0..a0d09c5 100644 --- a/internal/pkgs/grpc/grpcclient.go +++ b/modules/pkgs/grpc/grpcclient.go @@ -7,8 +7,8 @@ import ( "fmt" "time" - "givc/internal/pkgs/types" - givc_util "givc/internal/pkgs/utility" + "givc/modules/pkgs/types" + givc_util "givc/modules/pkgs/utility" "github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/retry" diff --git a/internal/pkgs/grpc/grpcserver.go b/modules/pkgs/grpc/grpcserver.go similarity index 99% rename from internal/pkgs/grpc/grpcserver.go rename to modules/pkgs/grpc/grpcserver.go index ad63631..9816590 100644 --- a/internal/pkgs/grpc/grpcserver.go +++ b/modules/pkgs/grpc/grpcserver.go @@ -6,7 +6,7 @@ import ( "context" "crypto/tls" "fmt" - "givc/internal/pkgs/types" + "givc/modules/pkgs/types" "net" "time" diff --git a/internal/pkgs/hwidmanager/controller.go b/modules/pkgs/hwidmanager/controller.go similarity index 88% rename from internal/pkgs/hwidmanager/controller.go rename to modules/pkgs/hwidmanager/controller.go index 54cd2f9..526d89f 100644 --- a/internal/pkgs/hwidmanager/controller.go +++ b/modules/pkgs/hwidmanager/controller.go @@ -18,7 +18,7 @@ func NewController(iface string) (*HwIdController, error) { if iface == "" { paths, err := filepath.Glob("/sys/class/net/wl*") if err != nil || paths == nil || len(paths) > 1 { - return nil, fmt.Errorf("Could not find device") + return nil, fmt.Errorf("could not find device") } iface = filepath.Base(paths[0]) } @@ -35,7 +35,7 @@ func (c *HwIdController) GetIdentifier(ctx context.Context) (string, error) { addr, err := os.ReadFile(fmt.Sprintf("/sys/class/net/%s/address", c.iface)) if err != nil { - return "", fmt.Errorf("Could not get identifier") + return "", fmt.Errorf("could not get identifier") } return strings.TrimSpace(string(addr)), nil diff --git a/internal/pkgs/hwidmanager/transport.go b/modules/pkgs/hwidmanager/transport.go similarity index 77% rename from internal/pkgs/hwidmanager/transport.go rename to modules/pkgs/hwidmanager/transport.go index 7856953..e7644d8 100644 --- a/internal/pkgs/hwidmanager/transport.go +++ b/modules/pkgs/hwidmanager/transport.go @@ -6,7 +6,7 @@ import ( "context" "fmt" - hwid_api "givc/api/hwid" + hwid "givc/modules/api/hwid" log "github.com/sirupsen/logrus" "google.golang.org/grpc" @@ -14,7 +14,7 @@ import ( type HwIdServer struct { Controller *HwIdController - hwid_api.UnimplementedHwidServiceServer + hwid.UnimplementedHwidServiceServer } func (s *HwIdServer) Name() string { @@ -22,7 +22,7 @@ func (s *HwIdServer) Name() string { } func (s *HwIdServer) RegisterGrpcService(srv *grpc.Server) { - hwid_api.RegisterHwidServiceServer(srv, s) + hwid.RegisterHwidServiceServer(srv, s) } func NewHwIdServer(iface string) (*HwIdServer, error) { @@ -40,7 +40,7 @@ func NewHwIdServer(iface string) (*HwIdServer, error) { return &hwidServer, nil } -func (s *HwIdServer) GetHwId(ctx context.Context, req *hwid_api.HwIdRequest) (*hwid_api.HwIdResponse, error) { +func (s *HwIdServer) GetHwId(ctx context.Context, req *hwid.HwIdRequest) (*hwid.HwIdResponse, error) { log.Infof("Incoming request to get hardware identifier\n") identifier, err := s.Controller.GetIdentifier(context.Background()) @@ -49,5 +49,5 @@ func (s *HwIdServer) GetHwId(ctx context.Context, req *hwid_api.HwIdRequest) (*h return nil, fmt.Errorf("cannot get hardware id") } - return &hwid_api.HwIdResponse{Identifier: identifier}, nil + return &hwid.HwIdResponse{Identifier: identifier}, nil } diff --git a/internal/pkgs/localelistener/controller.go b/modules/pkgs/localelistener/controller.go similarity index 97% rename from internal/pkgs/localelistener/controller.go rename to modules/pkgs/localelistener/controller.go index 66b61a4..b11703f 100644 --- a/internal/pkgs/localelistener/controller.go +++ b/modules/pkgs/localelistener/controller.go @@ -5,7 +5,7 @@ package localelistener import ( "context" "fmt" - givc_util "givc/internal/pkgs/utility" + givc_util "givc/modules/pkgs/utility" "os/exec" log "github.com/sirupsen/logrus" diff --git a/internal/pkgs/localelistener/transport.go b/modules/pkgs/localelistener/transport.go similarity index 67% rename from internal/pkgs/localelistener/transport.go rename to modules/pkgs/localelistener/transport.go index 6a8533a..9633f34 100644 --- a/internal/pkgs/localelistener/transport.go +++ b/modules/pkgs/localelistener/transport.go @@ -6,7 +6,7 @@ import ( "context" "fmt" - locale_api "givc/api/locale" + givc_locale "givc/modules/api/locale" log "github.com/sirupsen/logrus" "google.golang.org/grpc" @@ -14,7 +14,7 @@ import ( type LocaleServer struct { Controller *LocaleController - locale_api.UnimplementedLocaleClientServer + givc_locale.UnimplementedLocaleClientServer } func (s *LocaleServer) Name() string { @@ -22,7 +22,7 @@ func (s *LocaleServer) Name() string { } func (s *LocaleServer) RegisterGrpcService(srv *grpc.Server) { - locale_api.RegisterLocaleClientServer(srv, s) + givc_locale.RegisterLocaleClientServer(srv, s) } func NewLocaleServer() (*LocaleServer, error) { @@ -40,26 +40,26 @@ func NewLocaleServer() (*LocaleServer, error) { return &localeServer, nil } -func (s *LocaleServer) LocaleSet(ctx context.Context, req *locale_api.LocaleMessage) (*locale_api.Empty, error) { +func (s *LocaleServer) LocaleSet(ctx context.Context, req *givc_locale.LocaleMessage) (*givc_locale.Empty, error) { log.Infof("Incoming notification of changes locale\n") err := s.Controller.SetLocale(context.Background(), req.Locale) if err != nil { log.Infof("[SetLocale] Error setting locale: %v\n", err) - return nil, fmt.Errorf("Cannot set locale") + return nil, fmt.Errorf("cannot set locale") } - return &locale_api.Empty{}, nil + return &givc_locale.Empty{}, nil } -func (s *LocaleServer) TimezoneSet(ctx context.Context, req *locale_api.TimezoneMessage) (*locale_api.Empty, error) { +func (s *LocaleServer) TimezoneSet(ctx context.Context, req *givc_locale.TimezoneMessage) (*givc_locale.Empty, error) { log.Infof("Incoming notification of set timezone\n") err := s.Controller.SetTimezone(context.Background(), req.Timezone) if err != nil { log.Infof("[SetLocale] Error setting timezone: %v\n", err) - return nil, fmt.Errorf("Cannot set timezone") + return nil, fmt.Errorf("cannot set timezone") } - return &locale_api.Empty{}, nil + return &givc_locale.Empty{}, nil } diff --git a/internal/pkgs/serviceclient/transport.go b/modules/pkgs/serviceclient/transport.go similarity index 82% rename from internal/pkgs/serviceclient/transport.go rename to modules/pkgs/serviceclient/transport.go index b47e5b1..2c004e7 100644 --- a/internal/pkgs/serviceclient/transport.go +++ b/modules/pkgs/serviceclient/transport.go @@ -4,10 +4,10 @@ package serviceclient import ( "context" - "givc/api/admin" - systemd_api "givc/api/systemd" - givc_grpc "givc/internal/pkgs/grpc" - "givc/internal/pkgs/types" + givc_admin "givc/modules/api/admin" + givc_systemd "givc/modules/api/systemd" + givc_grpc "givc/modules/pkgs/grpc" + "givc/modules/pkgs/types" log "github.com/sirupsen/logrus" "google.golang.org/grpc" @@ -25,14 +25,14 @@ func GetRemoteStatus(cfg *types.EndpointConfig, unitName string) (*types.UnitSta defer conn.Close() // Create client - client := systemd_api.NewUnitControlServiceClient(conn) + client := givc_systemd.NewUnitControlServiceClient(conn) if client == nil { log.Errorf("Failed to create 'NewUnitControlServiceClient'") return nil, err } // Get unit status - request := systemd_api.UnitRequest{ + request := givc_systemd.UnitRequest{ UnitName: unitName, } ctx := context.Background() @@ -55,7 +55,7 @@ func GetRemoteStatus(cfg *types.EndpointConfig, unitName string) (*types.UnitSta return response, nil } -func RegisterRemoteService(cfg *types.EndpointConfig, reg *admin.RegistryRequest) (*admin.RegistryResponse, error) { +func RegisterRemoteService(cfg *types.EndpointConfig, reg *givc_admin.RegistryRequest) (*givc_admin.RegistryResponse, error) { // Setup and dial GRPC client var conn *grpc.ClientConn @@ -67,7 +67,7 @@ func RegisterRemoteService(cfg *types.EndpointConfig, reg *admin.RegistryRequest defer conn.Close() // Create admin client - client := admin.NewAdminServiceClient(conn) + client := givc_admin.NewAdminServiceClient(conn) if client == nil { log.Errorf("Failed to create new admin client") return nil, err @@ -86,7 +86,7 @@ func RegisterRemoteService(cfg *types.EndpointConfig, reg *admin.RegistryRequest return resp, nil } -func StartRemoteService(cfg *types.EndpointConfig, unitName string) (*systemd_api.UnitResponse, error) { +func StartRemoteService(cfg *types.EndpointConfig, unitName string) (*givc_systemd.UnitResponse, error) { // Setup and dial GRPC client var conn *grpc.ClientConn @@ -98,14 +98,14 @@ func StartRemoteService(cfg *types.EndpointConfig, unitName string) (*systemd_ap defer conn.Close() // Create client - client := systemd_api.NewUnitControlServiceClient(conn) + client := givc_systemd.NewUnitControlServiceClient(conn) if client == nil { log.Errorf("Failed to create 'NewUnitControlServiceClient'") return nil, err } // Start unit - request := systemd_api.UnitRequest{ + request := givc_systemd.UnitRequest{ UnitName: unitName, } ctx := context.Background() @@ -119,7 +119,7 @@ func StartRemoteService(cfg *types.EndpointConfig, unitName string) (*systemd_ap return resp, nil } -func PauseRemoteService(cfg *types.EndpointConfig, unitName string) (*systemd_api.UnitResponse, error) { +func PauseRemoteService(cfg *types.EndpointConfig, unitName string) (*givc_systemd.UnitResponse, error) { // Setup and dial GRPC client var conn *grpc.ClientConn @@ -131,14 +131,14 @@ func PauseRemoteService(cfg *types.EndpointConfig, unitName string) (*systemd_ap defer conn.Close() // Create client - client := systemd_api.NewUnitControlServiceClient(conn) + client := givc_systemd.NewUnitControlServiceClient(conn) if client == nil { log.Errorf("Failed to create 'NewUnitControlServiceClient'") return nil, err } // Start unit - request := systemd_api.UnitRequest{ + request := givc_systemd.UnitRequest{ UnitName: unitName, } ctx := context.Background() @@ -152,7 +152,7 @@ func PauseRemoteService(cfg *types.EndpointConfig, unitName string) (*systemd_ap return resp, nil } -func ResumeRemoteService(cfg *types.EndpointConfig, unitName string) (*systemd_api.UnitResponse, error) { +func ResumeRemoteService(cfg *types.EndpointConfig, unitName string) (*givc_systemd.UnitResponse, error) { // Setup and dial GRPC client var conn *grpc.ClientConn @@ -164,14 +164,14 @@ func ResumeRemoteService(cfg *types.EndpointConfig, unitName string) (*systemd_a defer conn.Close() // Create client - client := systemd_api.NewUnitControlServiceClient(conn) + client := givc_systemd.NewUnitControlServiceClient(conn) if client == nil { log.Errorf("Failed to create 'NewUnitControlServiceClient'") return nil, err } // Start unit - request := systemd_api.UnitRequest{ + request := givc_systemd.UnitRequest{ UnitName: unitName, } ctx := context.Background() @@ -185,7 +185,7 @@ func ResumeRemoteService(cfg *types.EndpointConfig, unitName string) (*systemd_a return resp, nil } -func StopRemoteService(cfg *types.EndpointConfig, unitName string) (*systemd_api.UnitResponse, error) { +func StopRemoteService(cfg *types.EndpointConfig, unitName string) (*givc_systemd.UnitResponse, error) { // Setup and dial GRPC client var conn *grpc.ClientConn @@ -197,14 +197,14 @@ func StopRemoteService(cfg *types.EndpointConfig, unitName string) (*systemd_api defer conn.Close() // Create client - client := systemd_api.NewUnitControlServiceClient(conn) + client := givc_systemd.NewUnitControlServiceClient(conn) if client == nil { log.Errorf("Failed to create 'NewUnitControlServiceClient'") return nil, err } // Start unit - request := systemd_api.UnitRequest{ + request := givc_systemd.UnitRequest{ UnitName: unitName, } ctx := context.Background() diff --git a/internal/pkgs/servicemanager/controller.go b/modules/pkgs/servicemanager/controller.go similarity index 98% rename from internal/pkgs/servicemanager/controller.go rename to modules/pkgs/servicemanager/controller.go index df01f62..37f77c3 100644 --- a/internal/pkgs/servicemanager/controller.go +++ b/modules/pkgs/servicemanager/controller.go @@ -8,9 +8,9 @@ import ( "strings" "syscall" - givc_app "givc/internal/pkgs/applications" - types "givc/internal/pkgs/types" - util "givc/internal/pkgs/utility" + givc_app "givc/modules/pkgs/applications" + types "givc/modules/pkgs/types" + util "givc/modules/pkgs/utility" "github.com/coreos/go-systemd/v22/dbus" godbus "github.com/godbus/dbus/v5" diff --git a/internal/pkgs/servicemanager/transport.go b/modules/pkgs/servicemanager/transport.go similarity index 79% rename from internal/pkgs/servicemanager/transport.go rename to modules/pkgs/servicemanager/transport.go index 0ebed88..ea9fb02 100644 --- a/internal/pkgs/servicemanager/transport.go +++ b/modules/pkgs/servicemanager/transport.go @@ -8,8 +8,8 @@ import ( "time" - systemd_api "givc/api/systemd" - "givc/internal/pkgs/types" + givc_systemd "givc/modules/api/systemd" + "givc/modules/pkgs/types" log "github.com/sirupsen/logrus" "google.golang.org/grpc" @@ -23,7 +23,7 @@ const ( type SystemdControlServer struct { Controller *SystemdController - systemd_api.UnimplementedUnitControlServiceServer + givc_systemd.UnimplementedUnitControlServiceServer } func (s *SystemdControlServer) Name() string { @@ -31,7 +31,7 @@ func (s *SystemdControlServer) Name() string { } func (s *SystemdControlServer) RegisterGrpcService(srv *grpc.Server) { - systemd_api.RegisterUnitControlServiceServer(srv, s) + givc_systemd.RegisterUnitControlServiceServer(srv, s) } func NewSystemdControlServer(whitelist []string, applications []types.ApplicationManifest) (*SystemdControlServer, error) { @@ -53,7 +53,7 @@ func (s *SystemdControlServer) Close() { s.Controller.Close() } -func (s *SystemdControlServer) GetUnitStatus(ctx context.Context, req *systemd_api.UnitRequest) (*systemd_api.UnitStatusResponse, error) { +func (s *SystemdControlServer) GetUnitStatus(ctx context.Context, req *givc_systemd.UnitRequest) (*givc_systemd.UnitStatusResponse, error) { log.Infof("Incoming request to fetch unit status: %v\n", req) unitStatus, err := s.Controller.FindUnit(req.UnitName) @@ -72,9 +72,9 @@ func (s *SystemdControlServer) GetUnitStatus(ctx context.Context, req *systemd_a freezerState = "error" } - resp := &systemd_api.UnitStatusResponse{ + resp := &givc_systemd.UnitStatusResponse{ CmdStatus: "Command successful", - UnitStatus: &systemd_api.UnitStatus{ + UnitStatus: &givc_systemd.UnitStatus{ Name: unitStatus[0].Name, Description: unitStatus[0].Description, LoadState: unitStatus[0].LoadState, @@ -88,7 +88,7 @@ func (s *SystemdControlServer) GetUnitStatus(ctx context.Context, req *systemd_a return resp, nil } -func (s *SystemdControlServer) StartUnit(ctx context.Context, req *systemd_api.UnitRequest) (*systemd_api.UnitResponse, error) { +func (s *SystemdControlServer) StartUnit(ctx context.Context, req *givc_systemd.UnitRequest) (*givc_systemd.UnitResponse, error) { log.Infof("Incoming request to (re)start %v\n", req) err := s.Controller.StartUnit(context.Background(), req.UnitName) @@ -96,10 +96,10 @@ func (s *SystemdControlServer) StartUnit(ctx context.Context, req *systemd_api.U log.Infof("[StartUnit] Error starting unit: %v", err) return nil, grpc_status.Error(grpc_codes.Unknown, "cannot start unit") } - return &systemd_api.UnitResponse{CmdStatus: "Command successful"}, nil + return &givc_systemd.UnitResponse{CmdStatus: "Command successful"}, nil } -func (s *SystemdControlServer) StopUnit(ctx context.Context, req *systemd_api.UnitRequest) (*systemd_api.UnitResponse, error) { +func (s *SystemdControlServer) StopUnit(ctx context.Context, req *givc_systemd.UnitRequest) (*givc_systemd.UnitResponse, error) { log.Infof("Incoming request to stop %v\n", req) err := s.Controller.StopUnit(context.Background(), req.UnitName) @@ -107,10 +107,10 @@ func (s *SystemdControlServer) StopUnit(ctx context.Context, req *systemd_api.Un log.Infof("[StopUnit] Error stopping unit: %v\n", err) return nil, grpc_status.Error(grpc_codes.Unknown, "cannot stop unit") } - return &systemd_api.UnitResponse{CmdStatus: "Command successful"}, nil + return &givc_systemd.UnitResponse{CmdStatus: "Command successful"}, nil } -func (s *SystemdControlServer) KillUnit(ctx context.Context, req *systemd_api.UnitRequest) (*systemd_api.UnitResponse, error) { +func (s *SystemdControlServer) KillUnit(ctx context.Context, req *givc_systemd.UnitRequest) (*givc_systemd.UnitResponse, error) { log.Infof("Incoming request to kill %v\n", req) err := s.Controller.KillUnit(context.Background(), req.UnitName) @@ -118,10 +118,10 @@ func (s *SystemdControlServer) KillUnit(ctx context.Context, req *systemd_api.Un log.Infof("[KillUnit] Error starting unit: %v\n", err) return nil, grpc_status.Error(grpc_codes.Unknown, "cannot kill unit") } - return &systemd_api.UnitResponse{CmdStatus: "Command successful"}, nil + return &givc_systemd.UnitResponse{CmdStatus: "Command successful"}, nil } -func (s *SystemdControlServer) FreezeUnit(ctx context.Context, req *systemd_api.UnitRequest) (*systemd_api.UnitResponse, error) { +func (s *SystemdControlServer) FreezeUnit(ctx context.Context, req *givc_systemd.UnitRequest) (*givc_systemd.UnitResponse, error) { log.Infof("Incoming request to freeze %v", req) err := s.Controller.FreezeUnit(context.Background(), req.UnitName) @@ -129,10 +129,10 @@ func (s *SystemdControlServer) FreezeUnit(ctx context.Context, req *systemd_api. log.Infof("[FreezeUnit] Error freezing unit: %v\n", err) return nil, grpc_status.Error(grpc_codes.Unknown, "cannot freeze unit") } - return &systemd_api.UnitResponse{CmdStatus: "Command successful"}, nil + return &givc_systemd.UnitResponse{CmdStatus: "Command successful"}, nil } -func (s *SystemdControlServer) UnfreezeUnit(ctx context.Context, req *systemd_api.UnitRequest) (*systemd_api.UnitResponse, error) { +func (s *SystemdControlServer) UnfreezeUnit(ctx context.Context, req *givc_systemd.UnitRequest) (*givc_systemd.UnitResponse, error) { log.Infof("Incoming request to unfreeze %v\n", req) err := s.Controller.UnfreezeUnit(context.Background(), req.UnitName) @@ -140,10 +140,10 @@ func (s *SystemdControlServer) UnfreezeUnit(ctx context.Context, req *systemd_ap log.Infof("[StartUnit] Error un-freezing unit: %v\n", err) return nil, grpc_status.Error(grpc_codes.Unknown, "cannot unfreeze unit") } - return &systemd_api.UnitResponse{CmdStatus: "Command successful"}, nil + return &givc_systemd.UnitResponse{CmdStatus: "Command successful"}, nil } -func (s *SystemdControlServer) MonitorUnit(req *systemd_api.UnitResourceRequest, stream systemd_api.UnitControlService_MonitorUnitServer) error { +func (s *SystemdControlServer) MonitorUnit(req *givc_systemd.UnitResourceRequest, stream givc_systemd.UnitControlService_MonitorUnitServer) error { log.Infof("Incoming resource monitor request for %v\n", req) // Find unit @@ -177,7 +177,7 @@ func (s *SystemdControlServer) MonitorUnit(req *systemd_api.UnitResourceRequest, log.Infof("[MonitorUnit] Error fetching unit properties: %v\n", err) return fmt.Errorf("cannot fetch unit properties") } - resp := &systemd_api.UnitResourceResponse{ + resp := &givc_systemd.UnitResourceResponse{ CpuUsage: cpuUsage, MemoryUsage: memoryUsage, } @@ -189,11 +189,11 @@ func (s *SystemdControlServer) MonitorUnit(req *systemd_api.UnitResourceRequest, return nil } -func (s *SystemdControlServer) StartApplication(ctx context.Context, req *systemd_api.AppUnitRequest) (*systemd_api.UnitResponse, error) { +func (s *SystemdControlServer) StartApplication(ctx context.Context, req *givc_systemd.AppUnitRequest) (*givc_systemd.UnitResponse, error) { log.Infof("Executing application start method for: %s\n", req.UnitName) resp, err := s.Controller.StartApplication(ctx, req.UnitName, req.Args) if err != nil { return nil, err } - return &systemd_api.UnitResponse{CmdStatus: resp}, nil + return &givc_systemd.UnitResponse{CmdStatus: resp}, nil } diff --git a/internal/pkgs/socketproxy/controller.go b/modules/pkgs/socketproxy/controller.go similarity index 95% rename from internal/pkgs/socketproxy/controller.go rename to modules/pkgs/socketproxy/controller.go index de0144c..cdec157 100644 --- a/internal/pkgs/socketproxy/controller.go +++ b/modules/pkgs/socketproxy/controller.go @@ -23,7 +23,10 @@ func NewSocketProxyController(socket string, runAsServer bool) (*SocketProxyCont var err error if !runAsServer { // Remove socket file if it exists - os.Remove(socket) + err := os.Remove(socket) + if err != nil { + log.Warnf("Error removing socket: %v", err) + } // Listen on unix socket listener, err = net.Listen("unix", socket) diff --git a/internal/pkgs/socketproxy/transport.go b/modules/pkgs/socketproxy/transport.go similarity index 86% rename from internal/pkgs/socketproxy/transport.go rename to modules/pkgs/socketproxy/transport.go index 833098f..877ce4f 100644 --- a/internal/pkgs/socketproxy/transport.go +++ b/modules/pkgs/socketproxy/transport.go @@ -26,13 +26,13 @@ package socketproxy import ( "bytes" "fmt" - socket_api "givc/api/socket" "io" "net" "time" - givc_grpc "givc/internal/pkgs/grpc" - givc_types "givc/internal/pkgs/types" + givc_socket "givc/modules/api/socket" + givc_grpc "givc/modules/pkgs/grpc" + givc_types "givc/modules/pkgs/types" "golang.org/x/net/context" "golang.org/x/sync/errgroup" @@ -43,12 +43,12 @@ import ( type SocketProxyServer struct { socketController *SocketProxyController - socket_api.UnimplementedSocketStreamServer + givc_socket.UnimplementedSocketStreamServer } type DataStream interface { - Recv() (*socket_api.BytePacket, error) - Send(*socket_api.BytePacket) error + Recv() (*givc_socket.BytePacket, error) + Send(*givc_socket.BytePacket) error Context() context.Context } @@ -57,7 +57,7 @@ func (s *SocketProxyServer) Name() string { } func (s *SocketProxyServer) RegisterGrpcService(srv *grpc.Server) { - socket_api.RegisterSocketStreamServer(srv, s) + givc_socket.RegisterSocketStreamServer(srv, s) } func NewSocketProxyServer(socket string, runAsServer bool) (*SocketProxyServer, error) { @@ -90,7 +90,7 @@ func (s *SocketProxyServer) StreamToRemote(ctx context.Context, cfg *givc_types. defer grpcClientConn.Close() // Create streaming client - socketStreamClient := socket_api.NewSocketStreamClient(grpcClientConn) + socketStreamClient := givc_socket.NewSocketStreamClient(grpcClientConn) if socketStreamClient == nil { return fmt.Errorf("failed to create 'NewSocketStreamClient'") } @@ -128,7 +128,10 @@ func (s *SocketProxyServer) StreamToRemote(ctx context.Context, cfg *givc_types. // Close stream connection if stream != nil { - stream.CloseSend() + err := stream.CloseSend() + if err != nil { + log.Warnf("Error closing stream: %v", err) + } } }(conn) @@ -137,7 +140,7 @@ func (s *SocketProxyServer) StreamToRemote(ctx context.Context, cfg *givc_types. } -func (s *SocketProxyServer) TransferData(stream socket_api.SocketStream_TransferDataServer) error { +func (s *SocketProxyServer) TransferData(stream givc_socket.SocketStream_TransferDataServer) error { if !s.socketController.runAsServer { return fmt.Errorf("socket proxy runs as client") @@ -177,7 +180,10 @@ func (s *SocketProxyServer) StreamData(stream DataStream, conn net.Conn) error { // Check for EOF; and close socket connection if bytes.Equal(data.GetData(), []byte(io.EOF.Error())) { if conn != nil { - conn.Close() + err := conn.Close() + if err != nil { + log.Warnf("Error closing socket: %v", err) + } } return fmt.Errorf("EOF received") } @@ -205,7 +211,7 @@ func (s *SocketProxyServer) StreamData(stream DataStream, conn net.Conn) error { if err != nil { // Forward any read error to terminate stream and socket connections on both ends log.Infof(">> Socket read error: %v", err) - message := &socket_api.BytePacket{ + message := &givc_socket.BytePacket{ Data: []byte(io.EOF.Error()), } err = stream.Send(message) @@ -216,7 +222,7 @@ func (s *SocketProxyServer) StreamData(stream DataStream, conn net.Conn) error { } // Send data to grpc stream - message := &socket_api.BytePacket{ + message := &givc_socket.BytePacket{ Data: data, } err = stream.Send(message) @@ -234,7 +240,10 @@ func (s *SocketProxyServer) StreamData(stream DataStream, conn net.Conn) error { // Close socket connection if conn != nil { - conn.Close() + err := conn.Close() + if err != nil { + log.Warnf("Error closing socket: %v", err) + } } return nil diff --git a/internal/pkgs/types/types.go b/modules/pkgs/types/types.go similarity index 100% rename from internal/pkgs/types/types.go rename to modules/pkgs/types/types.go diff --git a/internal/pkgs/utility/tls.go b/modules/pkgs/utility/tls.go similarity index 100% rename from internal/pkgs/utility/tls.go rename to modules/pkgs/utility/tls.go diff --git a/internal/pkgs/utility/utility.go b/modules/pkgs/utility/utility.go similarity index 100% rename from internal/pkgs/utility/utility.go rename to modules/pkgs/utility/utility.go diff --git a/internal/pkgs/wifimanager/controller.go b/modules/pkgs/wifimanager/controller.go similarity index 98% rename from internal/pkgs/wifimanager/controller.go rename to modules/pkgs/wifimanager/controller.go index 0384e43..ab90224 100644 --- a/internal/pkgs/wifimanager/controller.go +++ b/modules/pkgs/wifimanager/controller.go @@ -7,7 +7,7 @@ import ( "encoding/json" "fmt" - wifi_api "givc/api/wifi" + givc_wifi "givc/modules/api/wifi" "github.com/godbus/dbus/v5" log "github.com/sirupsen/logrus" @@ -116,8 +116,8 @@ func (c *WifiController) Close() { } } -func (c *WifiController) GetNetworkList(ctx context.Context, NetworkInterface string) ([]*wifi_api.AccessPoint, error) { - var output []*wifi_api.AccessPoint +func (c *WifiController) GetNetworkList(ctx context.Context, NetworkInterface string) ([]*givc_wifi.AccessPoint, error) { + var output []*givc_wifi.AccessPoint // Input validation if ctx == nil { @@ -144,7 +144,7 @@ func (c *WifiController) GetNetworkList(ctx context.Context, NetworkInterface st accesspoint.Security = GetAPSecurity(accesspoint) // Append variables into output - network := wifi_api.AccessPoint{ + network := givc_wifi.AccessPoint{ SSID: accesspoint.SSID, Signal: accesspoint.Strength, Security: accesspoint.Security, diff --git a/internal/pkgs/wifimanager/transport.go b/modules/pkgs/wifimanager/transport.go similarity index 74% rename from internal/pkgs/wifimanager/transport.go rename to modules/pkgs/wifimanager/transport.go index 9a705c9..a9b9345 100644 --- a/internal/pkgs/wifimanager/transport.go +++ b/modules/pkgs/wifimanager/transport.go @@ -8,7 +8,7 @@ import ( "time" - wifi_api "givc/api/wifi" + givc_wifi "givc/modules/api/wifi" log "github.com/sirupsen/logrus" "google.golang.org/grpc" @@ -20,7 +20,7 @@ const ( type WifiControlServer struct { Controller *WifiController - wifi_api.UnimplementedWifiServiceServer + givc_wifi.UnimplementedWifiServiceServer } func (s *WifiControlServer) Name() string { @@ -28,7 +28,7 @@ func (s *WifiControlServer) Name() string { } func (s *WifiControlServer) RegisterGrpcService(srv *grpc.Server) { - wifi_api.RegisterWifiServiceServer(srv, s) + givc_wifi.RegisterWifiServiceServer(srv, s) } func NewWifiControlServer() (*WifiControlServer, error) { @@ -46,7 +46,7 @@ func NewWifiControlServer() (*WifiControlServer, error) { return &wifiControlServer, nil } -func (s *WifiControlServer) ListNetwork(ctx context.Context, req *wifi_api.WifiNetworkRequest) (*wifi_api.WifiNetworkResponse, error) { +func (s *WifiControlServer) ListNetwork(ctx context.Context, req *givc_wifi.WifiNetworkRequest) (*givc_wifi.WifiNetworkResponse, error) { log.Infof("Incoming request to list available APs of %v\n", req) networks, err := s.Controller.GetNetworkList(context.Background(), req.NetworkName) @@ -55,14 +55,14 @@ func (s *WifiControlServer) ListNetwork(ctx context.Context, req *wifi_api.WifiN return nil, fmt.Errorf("cannot fetch network list") } - resp := wifi_api.WifiNetworkResponse{ + resp := givc_wifi.WifiNetworkResponse{ Networks: networks, } return &resp, nil } -func (s *WifiControlServer) GetActiveConnection(ctx context.Context, req *wifi_api.EmptyRequest) (*wifi_api.AccessPoint, error) { +func (s *WifiControlServer) GetActiveConnection(ctx context.Context, req *givc_wifi.EmptyRequest) (*givc_wifi.AccessPoint, error) { log.Infof("Incoming request to list available APs") connection, ssid, signal, security, err := s.Controller.GetActiveConnection(context.Background()) @@ -71,7 +71,7 @@ func (s *WifiControlServer) GetActiveConnection(ctx context.Context, req *wifi_a return nil, fmt.Errorf("cannot fetch network list") } - resp := wifi_api.AccessPoint{ + resp := givc_wifi.AccessPoint{ Connection: connection, SSID: ssid, Signal: signal, @@ -85,7 +85,7 @@ func (s *WifiControlServer) GetActiveConnection(ctx context.Context, req *wifi_a return &resp, nil } -func (s *WifiControlServer) ConnectNetwork(ctx context.Context, req *wifi_api.WifiConnectionRequest) (*wifi_api.WifiConnectionResponse, error) { +func (s *WifiControlServer) ConnectNetwork(ctx context.Context, req *givc_wifi.WifiConnectionRequest) (*givc_wifi.WifiConnectionResponse, error) { log.Infof("Incoming connection request to %v\n", req.SSID) response, err := s.Controller.Connect(context.Background(), req.SSID, req.Password, req.Settings) @@ -94,10 +94,10 @@ func (s *WifiControlServer) ConnectNetwork(ctx context.Context, req *wifi_api.Wi return nil, fmt.Errorf("cannot connect to AP %s (%s)", response, err) } - return &wifi_api.WifiConnectionResponse{Response: response}, nil + return &givc_wifi.WifiConnectionResponse{Response: response}, nil } -func (s *WifiControlServer) DisconnectNetwork(ctx context.Context, req *wifi_api.EmptyRequest) (*wifi_api.WifiConnectionResponse, error) { +func (s *WifiControlServer) DisconnectNetwork(ctx context.Context, req *givc_wifi.EmptyRequest) (*givc_wifi.WifiConnectionResponse, error) { log.Infof("Incoming disconnection request\n") response, err := s.Controller.Disconnect(context.Background()) @@ -106,10 +106,10 @@ func (s *WifiControlServer) DisconnectNetwork(ctx context.Context, req *wifi_api return nil, fmt.Errorf("cannot disconnect fromAP %s (%s)", response, err) } - return &wifi_api.WifiConnectionResponse{Response: response}, nil + return &givc_wifi.WifiConnectionResponse{Response: response}, nil } -func (s *WifiControlServer) TurnOn(ctx context.Context, req *wifi_api.EmptyRequest) (*wifi_api.WifiConnectionResponse, error) { +func (s *WifiControlServer) TurnOn(ctx context.Context, req *givc_wifi.EmptyRequest) (*givc_wifi.WifiConnectionResponse, error) { log.Infof("Incoming request to turn on the wifi\n") response, err := s.Controller.WifiRadioSwitch(context.Background(), true) @@ -118,10 +118,10 @@ func (s *WifiControlServer) TurnOn(ctx context.Context, req *wifi_api.EmptyReque return nil, fmt.Errorf("cannot switch the network") } - return &wifi_api.WifiConnectionResponse{Response: response}, nil + return &givc_wifi.WifiConnectionResponse{Response: response}, nil } -func (s *WifiControlServer) TurnOff(ctx context.Context, req *wifi_api.EmptyRequest) (*wifi_api.WifiConnectionResponse, error) { +func (s *WifiControlServer) TurnOff(ctx context.Context, req *givc_wifi.EmptyRequest) (*givc_wifi.WifiConnectionResponse, error) { log.Infof("Incoming request to turn off the wifi\n") response, err := s.Controller.WifiRadioSwitch(context.Background(), false) @@ -130,5 +130,5 @@ func (s *WifiControlServer) TurnOff(ctx context.Context, req *wifi_api.EmptyRequ return nil, fmt.Errorf("cannot switch the network") } - return &wifi_api.WifiConnectionResponse{Response: response}, nil + return &givc_wifi.WifiConnectionResponse{Response: response}, nil } diff --git a/nixos/modules/admin.nix b/nixos/modules/admin.nix index 1ec42bc..ca486d5 100644 --- a/nixos/modules/admin.nix +++ b/nixos/modules/admin.nix @@ -9,7 +9,7 @@ }: let cfg = config.givc.admin; - givc-admin = self.packages.${pkgs.stdenv.hostPlatform.system}.givc-admin-rs; + inherit (self.packages.${pkgs.stdenv.hostPlatform.system}) givc-admin; inherit (lib) mkOption mkEnableOption diff --git a/nixos/modules/sysvm.nix b/nixos/modules/sysvm.nix index 4efbed8..61e05a3 100644 --- a/nixos/modules/sysvm.nix +++ b/nixos/modules/sysvm.nix @@ -129,9 +129,9 @@ in systemd.targets.givc-setup = { enable = true; description = "Ghaf givc target"; - bindsTo = [ "network-online.target" ]; - after = [ "network-online.target" ]; - wantedBy = [ "network-online.target" ]; + bindsTo = [ "network.target" ]; + after = [ "network.target" ]; + wantedBy = [ "network.target" ]; }; systemd.services."givc-${cfg.agent.name}" = { diff --git a/nixos/packages/givc-admin-rs.nix b/nixos/packages/givc-admin.nix similarity index 100% rename from nixos/packages/givc-admin-rs.nix rename to nixos/packages/givc-admin.nix diff --git a/nixos/packages/givc-agent.nix b/nixos/packages/givc-agent.nix index e3338ab..7c1f28a 100644 --- a/nixos/packages/givc-agent.nix +++ b/nixos/packages/givc-agent.nix @@ -1,17 +1,27 @@ # Copyright 2024 TII (SSRC) and the Ghaf contributors # SPDX-License-Identifier: Apache-2.0 { pkgs, src }: -pkgs.buildGoModule { +let pname = "givc-agent"; +in +pkgs.buildGoModule { + inherit pname; version = "0.0.3"; inherit src; - vendorHash = "sha256-qF9Amm8A55b8hu0WIVSlxFQqpF+4wFlKhKuUg8k/EiM="; + vendorHash = "sha256-EgrJbTYT6iLv0qq9JiBKpoIqIgIptFhByQDyJSeznhc="; subPackages = [ - "internal/pkgs/grpc" - "internal/pkgs/servicemanager" - "internal/pkgs/serviceclient" - "internal/pkgs/applications" - "internal/pkgs/utility" - "internal/cmd/givc-agent" + "modules/cmd/${pname}" + ]; + configureFlags = [ + "-trimpath" + "-buildmode=pie" + "-mod=readonly" + ]; + ldflags = [ + "-w" + "-s" + "-linkmode=external" + "-extldflags=-pie" ]; + NIX_CFLAGS_COMPILE = "-fstack-protector-all -fcf-protection=full -fstack-clash-protection"; } diff --git a/nixos/tests/admin.nix b/nixos/tests/admin.nix index 8780a9f..aacfa77 100644 --- a/nixos/tests/admin.nix +++ b/nixos/tests/admin.nix @@ -10,8 +10,8 @@ let tls = true; snakeoil = ./snakeoil; addrs = { - host = "192.168.101.10"; - adminvm = "192.168.101.2"; + host = "192.168.101.2"; + adminvm = "192.168.101.10"; appvm = "192.168.101.5"; guivm = "192.168.101.3"; }; @@ -226,7 +226,7 @@ in testScript = { nodes, ... }: let - cli = "${self'.packages.givc-admin-rs.cli}/bin/givc-cli"; + cli = "${self'.packages.givc-admin.cli}/bin/givc-cli"; expected = "givc-ghaf-host.service"; # Name which we _expect_ to see registered in admin server's registry in # FIXME: why it so bizzare? (derived from name in cert) @@ -293,7 +293,7 @@ in adminvm.wait_for_unit("givc-admin.service") guivm.wait_for_unit("multi-user.target") appvm.wait_for_unit("multi-user.target") - guivm.wait_for_unit("givc-gui-vm") + guivm.wait_for_unit("givc-gui-vm.service") time.sleep(1) # Ensure, that hostvm's agent registered in admin service. It take ~10 seconds to spin up and register itself diff --git a/nixos/tests/default.nix b/nixos/tests/default.nix index 68d88c0..3cebd14 100644 --- a/nixos/tests/default.nix +++ b/nixos/tests/default.nix @@ -3,7 +3,6 @@ { imports = [ ./admin.nix - ./netvm.nix ./dbus.nix ]; }