node.proto 2.2 KB

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