node.proto 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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 nodenetwork = 9;
  29. bool ispending = 10;
  30. string postup = 11;
  31. string postdown = 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. string allowedips = 22;
  42. }
  43. message CheckInResponse {
  44. bool success = 1;
  45. bool needpeerupdate = 2;
  46. bool needconfigupdate = 3;
  47. string nodemessage = 4;
  48. bool ispending = 5;
  49. bool needkeyupdate = 6;
  50. bool needdelete = 7;
  51. }
  52. message PeersResponse {
  53. bool isgateway = 1;
  54. string gatewayrange = 2;
  55. string publickey = 5;
  56. string endpoint = 6;
  57. string address = 3;
  58. int32 listenport = 4;
  59. string localaddress = 7;
  60. int32 keepalive = 13;
  61. }
  62. message CreateNodeReq {
  63. Node node = 1; // Node id blank
  64. }
  65. message CreateNodeRes {
  66. Node node = 1; // Node id filled in
  67. }
  68. message UpdateNodeReq {
  69. Node node = 1;
  70. }
  71. message UpdateNodeRes {
  72. Node node = 1;
  73. }
  74. message ReadNodeReq {
  75. string macaddress = 1;
  76. string network = 2;
  77. }
  78. message ReadNodeRes {
  79. Node node = 1;
  80. }
  81. message DeleteNodeReq {
  82. string macaddress = 1;
  83. string networkName = 2;
  84. }
  85. message DeleteNodeRes {
  86. bool success = 1;
  87. }
  88. message GetPeersReq {
  89. string macaddress = 1;
  90. string network = 2;
  91. }
  92. message GetPeersRes {
  93. PeersResponse peers = 1;
  94. }
  95. message CheckInReq {
  96. Node node = 1;
  97. // bool postchanges = 2;
  98. }
  99. message CheckInRes {
  100. CheckInResponse checkinresponse = 1;
  101. }