syntax = "proto3"; package coordinator; option go_package = "server/api"; service Coordinator { // Registers a node. User name is auto-generated by server initially. rpc RegisterNode(RegisterRequest) returns (RegisterResponse); // Updates the display name of the node (allows user to change it later). rpc UpdateNodeName(UpdateNameRequest) returns (UpdateNameResponse); // Heartbeat to keep the node marked as online in Redis. rpc Heartbeat(HeartbeatRequest) returns (HeartbeatResponse); // Requests the connection details for a target peer. rpc GetPeerEndpoint(PeerRequest) returns (PeerResponse); // Notifies the coordinator that a node wants to establish a connection. rpc SignalConnection(SignalRequest) returns (SignalResponse); } message RegisterRequest { string network_key = 1; // The shared secret for this overlay network string node_id = 2; // Unique hardware/installation ID string public_key = 3; // WireGuard public key for E2EE string local_ip = 4; // Local network IP } message RegisterResponse { string virtual_ip = 1; // Assigned IP in the overlay network string session_token = 2; // JWT for subsequent authenticated requests string coordinator_address = 3; string assigned_name = 4; // The auto-generated name (e.g., "Node-8a2f") } message UpdateNameRequest { string node_id = 1; string new_name = 2; string session_token = 3; } message UpdateNameResponse { bool success = 1; string current_name = 2; } message HeartbeatRequest { string node_id = 1; string session_token = 2; string public_endpoint = 3; } message HeartbeatResponse { bool success = 1; } message PeerRequest { string target_node_id = 1; string session_token = 2; } message PeerResponse { string peer_public_key = 1; string public_endpoint = 2; string nat_type = 3; } message SignalRequest { string source_node_id = 1; string target_node_id = 2; string session_token = 3; } message SignalResponse { bool acknowledged = 1; }