53 lines
1.4 KiB
Protocol Buffer
53 lines
1.4 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 {
|
|
// we can have multiple port forwards for the same vm/port pair
|
|
// let's distinguish them by a unique session
|
|
string session = 1;
|
|
// can be empty to request port-forwarding to the worker itself
|
|
string vm_uid = 2;
|
|
uint32 port = 3;
|
|
}
|
|
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;
|
|
}
|