feat: Add uc wg show command to inspect a machine's uncloud wireguard network (#161)

* feat: Add `uc wg show` command to inspect a machine's uncloud wireguard network (draft / work in progress)

* Compile proto files with `make proto-mise`

* Fix lint errors

* Output peers in tabwriter table

* Lookup machine name for wireguard peer public key

* Add --machine flag to `uc wg show` to proxy call to specific machine

* Small refactor to move wg show logic out into a separate function
This commit is contained in:
Justin Bradford
2026-01-10 16:49:35 +11:00
committed by GitHub
parent 06c3fba96e
commit a945291371
6 changed files with 620 additions and 165 deletions
+19
View File
@@ -5,6 +5,7 @@ package api;
option go_package = "github.com/psviderski/uncloud/internal/machine/api/pb";
import "google/protobuf/empty.proto";
import "google/protobuf/timestamp.proto";
import "internal/machine/api/pb/common.proto";
service Machine {
@@ -21,6 +22,8 @@ service Machine {
rpc Reset(ResetRequest) returns (google.protobuf.Empty);
rpc InspectService(InspectServiceRequest) returns (InspectServiceResponse);
rpc GetWireGuardDevice(google.protobuf.Empty) returns (GetWireGuardDeviceResponse);
}
message MachineInfo {
@@ -105,3 +108,19 @@ message InspectServiceRequest {
message InspectServiceResponse {
Service service = 1;
}
message GetWireGuardDeviceResponse {
string name = 1;
string public_key = 2;
int32 listen_port = 3;
repeated WireGuardPeer peers = 4;
}
message WireGuardPeer {
string public_key = 1;
string endpoint = 2;
google.protobuf.Timestamp last_handshake_time = 3;
int64 receive_bytes = 4;
int64 transmit_bytes = 5;
repeated string allowed_ips = 6;
}