1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
// Install protoc compiler https://github.com/google/protobuf/releases
// Install gogofaster program:
// go get -u github.com/gogo/protobuf/protoc-gen-gogofaster
// protoc --proto_path=../../vendor:. --gogofaster_out=. control.proto
// Note that we use vendored gogoprotobuf path in example above.
syntax = "proto3";
package controlpb;
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
option (gogoproto.equal_all) = true;
option (gogoproto.populate_all) = true;
option (gogoproto.testgen_all) = true;
enum MethodType {
option (gogoproto.goproto_enum_prefix) = false;
NODE = 0 [(gogoproto.enumvalue_customname) = "MethodTypeNode"];
UNSUBSCRIBE = 1 [(gogoproto.enumvalue_customname) = "MethodTypeUnsubscribe"];
DISCONNECT = 2 [(gogoproto.enumvalue_customname) = "MethodTypeDisconnect"];
SHUTDOWN = 3 [(gogoproto.enumvalue_customname) = "MethodTypeShutdown"];
SURVEY_REQUEST = 4 [(gogoproto.enumvalue_customname) = "MethodTypeSurveyRequest"];
SURVEY_RESPONSE = 5 [(gogoproto.enumvalue_customname) = "MethodTypeSurveyResponse"];
}
message Command {
string uid = 1 [(gogoproto.customname) = "UID", (gogoproto.jsontag) = "uid"];
MethodType method = 2 [(gogoproto.jsontag) = "method"];
bytes params = 3 [(gogoproto.customtype) = "Raw", (gogoproto.jsontag) = "params", (gogoproto.nullable) = false];
}
message Node {
string uid = 1 [(gogoproto.customname) = "UID", (gogoproto.jsontag) = "uid"];
string name = 2 [(gogoproto.jsontag) = "name"];
string version = 3 [(gogoproto.jsontag) = "version"];
uint32 num_clients = 4 [(gogoproto.jsontag) = "num_clients"];
uint32 num_users = 5 [(gogoproto.jsontag) = "num_users"];
uint32 num_channels = 6 [(gogoproto.jsontag) = "num_channels"];
uint32 uptime = 7 [(gogoproto.jsontag) = "uptime"];
Metrics metrics = 8 [(gogoproto.jsontag) = "metrics"];
}
message Metrics {
double interval = 1 [(gogoproto.jsontag) = "interval"];
map<string, double> items = 2 [(gogoproto.jsontag) = "items"];
}
message Unsubscribe {
string channel = 1 [(gogoproto.jsontag) = "channel"];
string user = 2 [(gogoproto.jsontag) = "user"];
}
message Disconnect {
string user = 1 [(gogoproto.jsontag) = "user"];
repeated string whitelist = 2 [(gogoproto.jsontag) = "whitelist"];
uint32 code = 3 [(gogoproto.jsontag) = "code"];
string reason = 4 [(gogoproto.jsontag) = "reason"];
bool reconnect = 5 [(gogoproto.jsontag) = "reconnect"];
}
message SurveyRequest {
uint64 id = 1 [(gogoproto.customname) = "ID", (gogoproto.jsontag) = "id"];
string op = 2 [(gogoproto.jsontag) = "op"];
bytes data = 3 [(gogoproto.jsontag) = "data"];
}
message SurveyResponse {
uint64 id = 1 [(gogoproto.customname) = "ID", (gogoproto.jsontag) = "id"];
uint32 code = 3 [(gogoproto.jsontag) = "code"];
bytes data = 4 [(gogoproto.jsontag) = "data"];
}
|