node.proto 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. syntax = "proto3";
  2. package node;
  3. option go_package = "google.golang.org/protobuf/types/known/nodepb";
  4. service NodeService {
  5. rpc Login(LoginRequest) returns (LoginResponse);
  6. rpc CreateNode(CreateNodeReq) returns (CreateNodeRes);
  7. rpc ReadNode(ReadNodeReq) returns (ReadNodeRes);
  8. rpc UpdateNode(UpdateNodeReq) returns (UpdateNodeRes);
  9. rpc DeleteNode(DeleteNodeReq) returns (DeleteNodeRes);
  10. rpc GetPeers(GetPeersReq) returns (stream GetPeersRes);
  11. rpc CheckIn(CheckInReq) returns (CheckInRes);
  12. }
  13. message LoginRequest {
  14. string macaddress = 1;
  15. string password = 2;
  16. }
  17. message LoginResponse { string accesstoken = 1; }
  18. message Node {
  19. string id = 1;
  20. string name = 2;
  21. string address = 3;
  22. int32 listenport = 4;
  23. string publickey = 5;
  24. string endpoint = 6;
  25. string macaddress = 7;
  26. string password = 8;
  27. string nodegroup = 9;
  28. bool ispending = 10;
  29. string postup = 11;
  30. string preup = 12;
  31. int32 keepalive = 13;
  32. bool saveconfig = 14;
  33. string accesskey = 15;
  34. string interface = 16;
  35. string lastcheckin = 17;
  36. string lastmodified = 18;
  37. int32 checkininterval = 19;
  38. string localaddress = 20;
  39. string postchanges = 21;
  40. }
  41. message CheckInResponse {
  42. bool success = 1;
  43. bool needpeerupdate = 2;
  44. bool needconfigupdate = 3;
  45. string nodemessage = 4;
  46. bool ispending = 5;
  47. bool needkeyupdate = 6;
  48. bool needdelete = 7;
  49. }
  50. message PeersResponse {
  51. string publickey = 5;
  52. string endpoint = 6;
  53. string address = 3;
  54. int32 listenport = 4;
  55. string localaddress = 7;
  56. int32 keepalive = 13;
  57. }
  58. message CreateNodeReq {
  59. Node node = 1; // Node id blank
  60. }
  61. message CreateNodeRes {
  62. Node node = 1; // Node id filled in
  63. }
  64. message UpdateNodeReq {
  65. Node node = 1;
  66. }
  67. message UpdateNodeRes {
  68. Node node = 1;
  69. }
  70. message ReadNodeReq {
  71. string macaddress = 1;
  72. string group = 2;
  73. }
  74. message ReadNodeRes {
  75. Node node = 1;
  76. }
  77. message DeleteNodeReq {
  78. string macaddress = 1;
  79. string groupName = 2;
  80. }
  81. message DeleteNodeRes {
  82. bool success = 1;
  83. }
  84. message GetPeersReq {
  85. string macaddress = 1;
  86. string group = 2;
  87. }
  88. message GetPeersRes {
  89. PeersResponse peers = 1;
  90. }
  91. message CheckInReq {
  92. Node node = 1;
  93. // bool postchanges = 2;
  94. }
  95. message CheckInRes {
  96. CheckInResponse checkinresponse = 1;
  97. }