mirror of
https://source.quilibrium.com/quilibrium/ceremonyclient.git
synced 2024-12-27 09:05:18 +00:00
73 lines
2.2 KiB
Protocol Buffer
73 lines
2.2 KiB
Protocol Buffer
|
// In order to re-generate the golang packages for `Message` you will need...
|
||
|
// 1. Protobuf binary (tested with protoc 3.0.0). - https://github.com/gogo/protobuf/releases
|
||
|
// 2. Gogo Protobuf (tested with gogo 0.3). - https://github.com/gogo/protobuf
|
||
|
// 3. To have cloned `libp2p/go-libp2p-{record,kad-dht}` under the same directory.
|
||
|
// Now from `libp2p/go-libp2p-kad-dht/pb` you can run...
|
||
|
// `protoc --gogo_out=. --proto_path=../../go-libp2p-record/pb/ --proto_path=./ dht.proto`
|
||
|
|
||
|
syntax = "proto3";
|
||
|
package dht.pb;
|
||
|
|
||
|
import "github.com/libp2p/go-libp2p-record/pb/record.proto";
|
||
|
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
||
|
|
||
|
message Message {
|
||
|
enum MessageType {
|
||
|
PUT_VALUE = 0;
|
||
|
GET_VALUE = 1;
|
||
|
ADD_PROVIDER = 2;
|
||
|
GET_PROVIDERS = 3;
|
||
|
FIND_NODE = 4;
|
||
|
PING = 5;
|
||
|
}
|
||
|
|
||
|
enum ConnectionType {
|
||
|
// sender does not have a connection to peer, and no extra information (default)
|
||
|
NOT_CONNECTED = 0;
|
||
|
|
||
|
// sender has a live connection to peer
|
||
|
CONNECTED = 1;
|
||
|
|
||
|
// sender recently connected to peer
|
||
|
CAN_CONNECT = 2;
|
||
|
|
||
|
// sender recently tried to connect to peer repeatedly but failed to connect
|
||
|
// ("try" here is loose, but this should signal "made strong effort, failed")
|
||
|
CANNOT_CONNECT = 3;
|
||
|
}
|
||
|
|
||
|
message Peer {
|
||
|
// ID of a given peer.
|
||
|
bytes id = 1 [(gogoproto.customtype) = "byteString", (gogoproto.nullable) = false];
|
||
|
|
||
|
// multiaddrs for a given peer
|
||
|
repeated bytes addrs = 2;
|
||
|
|
||
|
// used to signal the sender's connection capabilities to the peer
|
||
|
ConnectionType connection = 3;
|
||
|
}
|
||
|
|
||
|
// defines what type of message it is.
|
||
|
MessageType type = 1;
|
||
|
|
||
|
// defines what coral cluster level this query/response belongs to.
|
||
|
// in case we want to implement coral's cluster rings in the future.
|
||
|
int32 clusterLevelRaw = 10;
|
||
|
|
||
|
// Used to specify the key associated with this message.
|
||
|
// PUT_VALUE, GET_VALUE, ADD_PROVIDER, GET_PROVIDERS
|
||
|
bytes key = 2;
|
||
|
|
||
|
// Used to return a value
|
||
|
// PUT_VALUE, GET_VALUE
|
||
|
record.pb.Record record = 3;
|
||
|
|
||
|
// Used to return peers closer to a key in a query
|
||
|
// GET_VALUE, GET_PROVIDERS, FIND_NODE
|
||
|
repeated Peer closerPeers = 8 [(gogoproto.nullable) = false];
|
||
|
|
||
|
// Used to return Providers
|
||
|
// GET_VALUE, ADD_PROVIDER, GET_PROVIDERS
|
||
|
repeated Peer providerPeers = 9 [(gogoproto.nullable) = false];
|
||
|
}
|