extend protobuf for dht api

This commit is contained in:
vyzo 2018-09-30 10:28:04 +03:00
parent 6182083649
commit 5e720e5799
2 changed files with 1258 additions and 58 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,5 @@
syntax = "proto2";
package p2pd.pb;
message Request {
@ -6,6 +8,7 @@ message Request {
CONNECT = 1;
STREAM_OPEN = 2;
STREAM_HANDLER = 3;
DHT = 4;
}
required Type type = 1;
@ -13,6 +16,7 @@ message Request {
optional ConnectRequest connect = 2;
optional StreamOpenRequest streamOpen = 3;
optional StreamHandlerRequest streamHandler = 4;
optional DHTRequest dht = 5;
}
message Response {
@ -25,6 +29,7 @@ message Response {
optional ErrorResponse error = 2;
optional StreamInfo streamInfo = 3;
optional IdentifyResponse identify = 4;
optional DHTResponse dht = 5;
}
message IdentifyResponse {
@ -56,3 +61,42 @@ message StreamInfo {
required bytes addr = 2;
required string proto = 3;
}
message DHTRequest {
enum Type {
FIND_PEER = 0;
FIND_PEERS_CONNECTED_TO_PEER = 1;
FIND_PROVIDERS = 2;
GET_CLOSEST_PEERS = 3;
GET_PUBLIC_KEY = 4;
GET_VALUE = 5;
SEARCH_VALUE = 6;
PUT_VALUE = 7;
PROVIDE = 8;
}
required Type type = 1;
optional bytes peer = 2;
optional bytes cid = 3;
optional string key = 4;
optional bytes value = 5;
optional int32 count = 6;
optional int64 timeout = 7;
}
message DHTResponse {
enum Type {
BEGIN = 0;
VALUE = 1;
END = 2;
}
required Type type = 1;
optional PeerInfo peer = 2;
optional bytes value = 3;
}
message PeerInfo {
required bytes id = 1;
repeated bytes addrs = 2;
}