go-libp2p-kad-dht/pb/dht.proto

58 lines
1.3 KiB
Protocol Buffer
Raw Normal View History

package dht.pb;
//run `protoc --go_out=. *.proto` to generate
2014-09-16 00:52:57 -07:00
message Message {
enum MessageType {
PUT_VALUE = 0;
GET_VALUE = 1;
ADD_PROVIDER = 2;
GET_PROVIDERS = 3;
FIND_NODE = 4;
PING = 5;
}
2014-09-16 00:52:57 -07:00
message Peer {
optional string id = 1;
optional string addr = 2;
}
2014-09-16 00:52:57 -07:00
// defines what type of message it is.
optional MessageType type = 1;
2014-09-16 00:52:57 -07:00
// 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;
2014-09-16 00:52:57 -07:00
// Used to return a value
// PUT_VALUE, GET_VALUE
optional Record record = 3;
2014-09-16 00:52:57 -07:00
// Used to return peers closer to a key in a query
// GET_VALUE, GET_PROVIDERS, FIND_NODE
repeated Peer closerPeers = 8;
2014-09-16 00:52:57 -07:00
// Used to return Providers
// GET_VALUE, ADD_PROVIDER, GET_PROVIDERS
repeated Peer providerPeers = 9;
}
// Record represents a dht record that contains a value
// for a key value pair
message Record {
// The key that references this record
optional string key = 1;
// The actual value this record is storing
optional bytes value = 2;
// hash of the authors public key
optional string author = 3;
// A PKI signature for the key+value+author
optional bytes signature = 4;
}