mirror of
https://github.com/ipfs/kubo.git
synced 2025-09-17 21:06:18 +08:00
43 lines
932 B
Protocol Buffer
43 lines
932 B
Protocol Buffer
package dht;
|
|
|
|
//run `protoc --go_out=. *.proto` to generate
|
|
|
|
message Message {
|
|
enum MessageType {
|
|
PUT_VALUE = 0;
|
|
GET_VALUE = 1;
|
|
ADD_PROVIDER = 2;
|
|
GET_PROVIDERS = 3;
|
|
FIND_NODE = 4;
|
|
PING = 5;
|
|
DIAGNOSTIC = 6;
|
|
}
|
|
|
|
message Peer {
|
|
required string id = 1;
|
|
required string addr = 2;
|
|
}
|
|
|
|
// defines what type of message it is.
|
|
required MessageType type = 1;
|
|
|
|
// defines what coral cluster level this query/response belongs to.
|
|
optional int32 clusterLevelRaw = 10;
|
|
|
|
// Used to specify the key associated with this message.
|
|
// PUT_VALUE, GET_VALUE, ADD_PROVIDER, GET_PROVIDERS
|
|
optional string key = 2;
|
|
|
|
// Used to return a value
|
|
// PUT_VALUE, GET_VALUE
|
|
optional bytes value = 3;
|
|
|
|
// Used to return peers closer to a key in a query
|
|
// GET_VALUE, GET_PROVIDERS, FIND_NODE
|
|
repeated Peer closerPeers = 8;
|
|
|
|
// Used to return Providers
|
|
// GET_VALUE, ADD_PROVIDER, GET_PROVIDERS
|
|
repeated Peer providerPeers = 9;
|
|
}
|