node.proto 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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. }
  49. message PeersResponse {
  50. string publickey = 5;
  51. string endpoint = 6;
  52. string address = 3;
  53. int32 listenport = 4;
  54. string localaddress = 7;
  55. int32 keepalive = 13;
  56. }
  57. message CreateNodeReq {
  58. Node node = 1; // Node id blank
  59. }
  60. message CreateNodeRes {
  61. Node node = 1; // Node id filled in
  62. }
  63. message UpdateNodeReq {
  64. Node node = 1;
  65. }
  66. message UpdateNodeRes {
  67. Node node = 1;
  68. }
  69. message ReadNodeReq {
  70. string macaddress = 1;
  71. string group = 2;
  72. }
  73. message ReadNodeRes {
  74. Node node = 1;
  75. }
  76. message DeleteNodeReq {
  77. string macaddress = 1;
  78. string groupName = 2;
  79. }
  80. message DeleteNodeRes {
  81. bool success = 1;
  82. }
  83. message GetPeersReq {
  84. string macaddress = 1;
  85. string group = 2;
  86. }
  87. message GetPeersRes {
  88. PeersResponse peers = 1;
  89. }
  90. message CheckInReq {
  91. Node node = 1;
  92. // bool postchanges = 2;
  93. }
  94. message CheckInRes {
  95. CheckInResponse checkinresponse = 1;
  96. }