node.proto 2.3 KB

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