Files
orchard/rpc/orchard.proto
T

77 lines
2.0 KiB
Protocol Buffer

syntax = "proto3";
import "google/protobuf/empty.proto";
option go_package = "github.com/cirruslabs/orchard/rpc";
service Controller {
// message bus between the controller and a worker
rpc Watch(google.protobuf.Empty) returns (stream WatchInstruction);
// single purpose method when a port forward is requested and running
// session information is passed in the requests metadata
rpc PortForward(stream PortForwardData) returns (stream PortForwardData);
// worker calls this method when it has successfully resolved the VM's IP
rpc ResolveIP(ResolveIPResult) returns (google.protobuf.Empty);
}
message WatchInstruction {
message PortForward {
// Target identifies where the worker forwards the byte stream
message Target {
// Forward the byte stream to a host process, identified by
// a VM UID and a host process name
message HostProcess {
string vm_uid = 1;
string name = 2;
}
// Forward the byte stream to the Tart Guest Agent running inside the VM
message TartGuestAgent {
string vm_uid = 1;
}
oneof value {
HostProcess host_process = 1;
TartGuestAgent tart_guest_agent = 2;
}
}
// Distinguish multiple port forwards to the same VM/port pair or a target
string session = 1;
// Legacy port-forwarding destination that supports workers and VMs
string vm_uid = 2;
uint32 port = 3;
// Typed alternative to the legacy port-forwarding destination,
// adding support for host processes and Tart Guest Agent
Target target = 4;
}
message SyncVMs {
// nothing for now
}
message ResolveIP {
// we can have multiple IP resolution requests for the same vm
// let's distinguish them by a unique session
string session = 1;
string vm_uid = 2;
}
oneof action {
PortForward port_forward_action = 1;
SyncVMs sync_vms_action = 2;
ResolveIP resolve_ip_action = 3;
}
}
message PortForwardData {
bytes data = 1;
}
message ResolveIPResult {
string session = 1;
string ip = 2;
}