p2pd.proto 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. //Originally taken from: https://github.com/mhchia/py-libp2p-daemon-bindings
  2. //Licence: MIT
  3. //Author: Kevin Mai-Husan Chia
  4. syntax = "proto2";
  5. package p2pclient.p2pd.pb;
  6. message Request {
  7. enum Type {
  8. IDENTIFY = 0;
  9. CONNECT = 1;
  10. STREAM_OPEN = 2;
  11. STREAM_HANDLER = 3;
  12. DHT = 4;
  13. LIST_PEERS = 5;
  14. CONNMANAGER = 6;
  15. DISCONNECT = 7;
  16. PUBSUB = 8;
  17. }
  18. required Type type = 1;
  19. optional ConnectRequest connect = 2;
  20. optional StreamOpenRequest streamOpen = 3;
  21. optional StreamHandlerRequest streamHandler = 4;
  22. optional DHTRequest dht = 5;
  23. optional ConnManagerRequest connManager = 6;
  24. optional DisconnectRequest disconnect = 7;
  25. optional PSRequest pubsub = 8;
  26. }
  27. message Response {
  28. enum Type {
  29. OK = 0;
  30. ERROR = 1;
  31. }
  32. required Type type = 1;
  33. optional ErrorResponse error = 2;
  34. optional StreamInfo streamInfo = 3;
  35. optional IdentifyResponse identify = 4;
  36. optional DHTResponse dht = 5;
  37. repeated PeerInfo peers = 6;
  38. optional PSResponse pubsub = 7;
  39. }
  40. message IdentifyResponse {
  41. required bytes id = 1;
  42. repeated bytes addrs = 2;
  43. }
  44. message ConnectRequest {
  45. required bytes peer = 1;
  46. repeated bytes addrs = 2;
  47. optional int64 timeout = 3;
  48. }
  49. message StreamOpenRequest {
  50. required bytes peer = 1;
  51. repeated string proto = 2;
  52. optional int64 timeout = 3;
  53. }
  54. message StreamHandlerRequest {
  55. required bytes addr = 1;
  56. repeated string proto = 2;
  57. }
  58. message ErrorResponse {
  59. required string msg = 1;
  60. }
  61. message StreamInfo {
  62. required bytes peer = 1;
  63. required bytes addr = 2;
  64. required string proto = 3;
  65. }
  66. message DHTRequest {
  67. enum Type {
  68. FIND_PEER = 0;
  69. FIND_PEERS_CONNECTED_TO_PEER = 1;
  70. FIND_PROVIDERS = 2;
  71. GET_CLOSEST_PEERS = 3;
  72. GET_PUBLIC_KEY = 4;
  73. GET_VALUE = 5;
  74. SEARCH_VALUE = 6;
  75. PUT_VALUE = 7;
  76. PROVIDE = 8;
  77. }
  78. required Type type = 1;
  79. optional bytes peer = 2;
  80. optional bytes cid = 3;
  81. optional bytes key = 4;
  82. optional bytes value = 5;
  83. optional int32 count = 6;
  84. optional int64 timeout = 7;
  85. }
  86. message DHTResponse {
  87. enum Type {
  88. BEGIN = 0;
  89. VALUE = 1;
  90. END = 2;
  91. }
  92. required Type type = 1;
  93. optional PeerInfo peer = 2;
  94. optional bytes value = 3;
  95. }
  96. message PeerInfo {
  97. required bytes id = 1;
  98. repeated bytes addrs = 2;
  99. }
  100. message ConnManagerRequest {
  101. enum Type {
  102. TAG_PEER = 0;
  103. UNTAG_PEER = 1;
  104. TRIM = 2;
  105. }
  106. required Type type = 1;
  107. optional bytes peer = 2;
  108. optional string tag = 3;
  109. optional int64 weight = 4;
  110. }
  111. message DisconnectRequest {
  112. required bytes peer = 1;
  113. }
  114. message PSRequest {
  115. enum Type {
  116. GET_TOPICS = 0;
  117. LIST_PEERS = 1;
  118. PUBLISH = 2;
  119. SUBSCRIBE = 3;
  120. }
  121. required Type type = 1;
  122. optional string topic = 2;
  123. optional bytes data = 3;
  124. }
  125. message PSMessage {
  126. optional bytes from_id = 1;
  127. optional bytes data = 2;
  128. optional bytes seqno = 3;
  129. repeated string topicIDs = 4;
  130. optional bytes signature = 5;
  131. optional bytes key = 6;
  132. }
  133. message PSResponse {
  134. repeated string topics = 1;
  135. repeated bytes peerIDs = 2;
  136. }
  137. message RPCError {
  138. optional string message = 1;
  139. }