feat: add first page with auth and containers list and agents
This commit is contained in:
100
proto/agent/v1/agent.proto
Normal file
100
proto/agent/v1/agent.proto
Normal file
@ -0,0 +1,100 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package containarr.agent.v1;
|
||||
|
||||
option go_package = "github.com/containarr/server/internal/proto/agentv1";
|
||||
|
||||
// ── Shared types ─────────────────────────────────────────────────────────────
|
||||
|
||||
message ContainerPort {
|
||||
uint32 host_port = 1;
|
||||
uint32 container_port = 2;
|
||||
string protocol = 3;
|
||||
string host_ip = 4;
|
||||
}
|
||||
|
||||
message ContainerInfo {
|
||||
string id = 1;
|
||||
string name = 2;
|
||||
string image = 3;
|
||||
string status = 4;
|
||||
string state = 5;
|
||||
repeated ContainerPort ports = 6;
|
||||
int64 created_at = 7;
|
||||
map<string, string> labels = 8;
|
||||
string compose_project = 9;
|
||||
}
|
||||
|
||||
// ── Agent → Server ────────────────────────────────────────────────────────────
|
||||
|
||||
message AgentHandshake {
|
||||
string token = 1;
|
||||
string hostname = 2;
|
||||
string arch = 3;
|
||||
string os = 4;
|
||||
}
|
||||
|
||||
message ContainerSnapshot {
|
||||
repeated ContainerInfo containers = 1;
|
||||
int64 timestamp = 2;
|
||||
}
|
||||
|
||||
message CommandResult {
|
||||
string command_id = 1;
|
||||
bool success = 2;
|
||||
string error = 3;
|
||||
}
|
||||
|
||||
message LogChunk {
|
||||
string container_id = 1;
|
||||
string stream = 2; // "stdout" | "stderr"
|
||||
bytes data = 3;
|
||||
int64 timestamp = 4;
|
||||
}
|
||||
|
||||
message AgentMessage {
|
||||
oneof payload {
|
||||
AgentHandshake handshake = 1;
|
||||
ContainerSnapshot snapshot = 2;
|
||||
CommandResult result = 3;
|
||||
LogChunk log_chunk = 4;
|
||||
}
|
||||
}
|
||||
|
||||
// ── Server → Agent ────────────────────────────────────────────────────────────
|
||||
|
||||
enum ContainerAction {
|
||||
CONTAINER_ACTION_UNSPECIFIED = 0;
|
||||
CONTAINER_ACTION_START = 1;
|
||||
CONTAINER_ACTION_STOP = 2;
|
||||
CONTAINER_ACTION_RESTART = 3;
|
||||
CONTAINER_ACTION_REMOVE = 4;
|
||||
}
|
||||
|
||||
message ContainerCommand {
|
||||
string command_id = 1;
|
||||
string container_id = 2;
|
||||
ContainerAction action = 3;
|
||||
}
|
||||
|
||||
message StreamLogsCommand {
|
||||
string command_id = 1;
|
||||
string container_id = 2;
|
||||
bool follow = 3;
|
||||
int32 tail = 4;
|
||||
}
|
||||
|
||||
message ServerMessage {
|
||||
oneof payload {
|
||||
ContainerCommand container_cmd = 1;
|
||||
StreamLogsCommand stream_logs = 2;
|
||||
}
|
||||
}
|
||||
|
||||
// ── Service ───────────────────────────────────────────────────────────────────
|
||||
|
||||
service AgentGateway {
|
||||
// Bidirectional stream: agent connects once and maintains the tunnel.
|
||||
// First AgentMessage must be AgentHandshake.
|
||||
rpc Tunnel(stream AgentMessage) returns (stream ServerMessage);
|
||||
}
|
||||
Reference in New Issue
Block a user