node.proto 2.4 KB

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