246 lines
4.6 KiB
Protocol Buffer
246 lines
4.6 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package gamepanel.daemon;
|
|
|
|
// Empty message for parameterless RPCs
|
|
message Empty {}
|
|
|
|
// === Node ===
|
|
|
|
message NodeStatus {
|
|
string version = 1;
|
|
bool is_healthy = 2;
|
|
int64 uptime_seconds = 3;
|
|
int32 active_servers = 4;
|
|
}
|
|
|
|
message NodeStats {
|
|
double cpu_percent = 1;
|
|
int64 memory_used = 2;
|
|
int64 memory_total = 3;
|
|
int64 disk_used = 4;
|
|
int64 disk_total = 5;
|
|
}
|
|
|
|
// === Server Lifecycle ===
|
|
|
|
message ServerIdentifier {
|
|
string uuid = 1;
|
|
}
|
|
|
|
message PortMapping {
|
|
int32 host_port = 1;
|
|
int32 container_port = 2;
|
|
string protocol = 3; // "tcp" or "udp"
|
|
}
|
|
|
|
message CreateServerRequest {
|
|
string uuid = 1;
|
|
string docker_image = 2;
|
|
int64 memory_limit = 3;
|
|
int64 disk_limit = 4;
|
|
int32 cpu_limit = 5;
|
|
string startup_command = 6;
|
|
map<string, string> environment = 7;
|
|
repeated PortMapping ports = 8;
|
|
repeated string install_plugin_urls = 9;
|
|
}
|
|
|
|
message ServerResponse {
|
|
string uuid = 1;
|
|
string status = 2;
|
|
}
|
|
|
|
// === Power ===
|
|
|
|
enum PowerAction {
|
|
START = 0;
|
|
STOP = 1;
|
|
RESTART = 2;
|
|
KILL = 3;
|
|
}
|
|
|
|
message PowerRequest {
|
|
string uuid = 1;
|
|
PowerAction action = 2;
|
|
}
|
|
|
|
// === Server Status ===
|
|
|
|
message ServerStatus {
|
|
string uuid = 1;
|
|
string state = 2;
|
|
double cpu_percent = 3;
|
|
int64 memory_bytes = 4;
|
|
int64 disk_bytes = 5;
|
|
int64 network_rx = 6;
|
|
int64 network_tx = 7;
|
|
int64 uptime_seconds = 8;
|
|
}
|
|
|
|
message ServerResourceStats {
|
|
string uuid = 1;
|
|
double cpu_percent = 2;
|
|
int64 memory_bytes = 3;
|
|
int64 disk_bytes = 4;
|
|
int64 network_rx = 5;
|
|
int64 network_tx = 6;
|
|
string state = 7;
|
|
}
|
|
|
|
// === Console ===
|
|
|
|
message ConsoleOutput {
|
|
string uuid = 1;
|
|
string line = 2;
|
|
int64 timestamp = 3;
|
|
}
|
|
|
|
message CommandRequest {
|
|
string uuid = 1;
|
|
string command = 2;
|
|
}
|
|
|
|
// === Files ===
|
|
|
|
message FileEntry {
|
|
string name = 1;
|
|
string path = 2;
|
|
bool is_directory = 3;
|
|
int64 size = 4;
|
|
int64 modified_at = 5;
|
|
string mime_type = 6;
|
|
}
|
|
|
|
message FileListRequest {
|
|
string uuid = 1;
|
|
string path = 2;
|
|
}
|
|
|
|
message FileListResponse {
|
|
repeated FileEntry files = 1;
|
|
}
|
|
|
|
message FileReadRequest {
|
|
string uuid = 1;
|
|
string path = 2;
|
|
}
|
|
|
|
message FileContent {
|
|
bytes data = 1;
|
|
string mime_type = 2;
|
|
}
|
|
|
|
message FileWriteRequest {
|
|
string uuid = 1;
|
|
string path = 2;
|
|
bytes data = 3;
|
|
}
|
|
|
|
message FileDeleteRequest {
|
|
string uuid = 1;
|
|
repeated string paths = 2;
|
|
}
|
|
|
|
message CompressRequest {
|
|
string uuid = 1;
|
|
repeated string paths = 2;
|
|
string destination = 3;
|
|
}
|
|
|
|
message DecompressRequest {
|
|
string uuid = 1;
|
|
string path = 2;
|
|
string destination = 3;
|
|
}
|
|
|
|
// === Backup ===
|
|
|
|
message BackupRequest {
|
|
string server_uuid = 1;
|
|
string backup_id = 2;
|
|
string cdn_upload_url = 3;
|
|
}
|
|
|
|
message BackupResponse {
|
|
string backup_id = 1;
|
|
int64 size_bytes = 2;
|
|
string checksum = 3;
|
|
bool success = 4;
|
|
}
|
|
|
|
message BackupIdentifier {
|
|
string server_uuid = 1;
|
|
string backup_id = 2;
|
|
}
|
|
|
|
message RestoreBackupRequest {
|
|
string server_uuid = 1;
|
|
string backup_id = 2;
|
|
string cdn_download_url = 3;
|
|
}
|
|
|
|
// === Players ===
|
|
|
|
message Player {
|
|
string name = 1;
|
|
string uuid = 2;
|
|
int64 connected_at = 3;
|
|
}
|
|
|
|
message PlayerList {
|
|
repeated Player players = 1;
|
|
int32 max_players = 2;
|
|
}
|
|
|
|
// === Install Progress ===
|
|
|
|
message InstallProgress {
|
|
string uuid = 1;
|
|
int32 percent = 2;
|
|
string message = 3;
|
|
}
|
|
|
|
// === Service Definition ===
|
|
|
|
service DaemonService {
|
|
// Node
|
|
rpc GetNodeStatus(Empty) returns (NodeStatus);
|
|
rpc StreamNodeStats(Empty) returns (stream NodeStats);
|
|
|
|
// Server lifecycle
|
|
rpc CreateServer(CreateServerRequest) returns (ServerResponse);
|
|
rpc DeleteServer(ServerIdentifier) returns (Empty);
|
|
rpc ReinstallServer(ServerIdentifier) returns (Empty);
|
|
|
|
// Power
|
|
rpc SetPowerState(PowerRequest) returns (Empty);
|
|
rpc GetServerStatus(ServerIdentifier) returns (ServerStatus);
|
|
|
|
// Console
|
|
rpc StreamConsole(ServerIdentifier) returns (stream ConsoleOutput);
|
|
rpc SendCommand(CommandRequest) returns (Empty);
|
|
|
|
// Files
|
|
rpc ListFiles(FileListRequest) returns (FileListResponse);
|
|
rpc ReadFile(FileReadRequest) returns (FileContent);
|
|
rpc WriteFile(FileWriteRequest) returns (Empty);
|
|
rpc DeleteFiles(FileDeleteRequest) returns (Empty);
|
|
rpc CompressFiles(CompressRequest) returns (FileContent);
|
|
rpc DecompressFile(DecompressRequest) returns (Empty);
|
|
|
|
// Backup
|
|
rpc CreateBackup(BackupRequest) returns (BackupResponse);
|
|
rpc RestoreBackup(RestoreBackupRequest) returns (Empty);
|
|
rpc DeleteBackup(BackupIdentifier) returns (Empty);
|
|
|
|
// Stats
|
|
rpc StreamServerStats(ServerIdentifier) returns (stream ServerResourceStats);
|
|
|
|
// Install progress
|
|
rpc StreamInstallProgress(ServerIdentifier) returns (stream InstallProgress);
|
|
|
|
// Players
|
|
rpc GetActivePlayers(ServerIdentifier) returns (PlayerList);
|
|
}
|