github.com/keltia/go-ipfs@v0.3.8-0.20150909044612-210793031c63/routing/dht/pb/dht.proto (about)

     1  package dht.pb;
     2  
     3  //run `protoc --go_out=. *.proto` to generate
     4  
     5  message Message {
     6  	enum MessageType {
     7  		PUT_VALUE = 0;
     8  		GET_VALUE = 1;
     9  		ADD_PROVIDER = 2;
    10  		GET_PROVIDERS = 3;
    11  		FIND_NODE = 4;
    12  		PING = 5;
    13  	}
    14  
    15  	enum ConnectionType {
    16  		// sender does not have a connection to peer, and no extra information (default)
    17  		NOT_CONNECTED = 0;
    18  
    19  		// sender has a live connection to peer
    20  		CONNECTED = 1;
    21  
    22  		// sender recently connected to peer
    23  		CAN_CONNECT = 2;
    24  
    25  		// sender recently tried to connect to peer repeatedly but failed to connect
    26  		// ("try" here is loose, but this should signal "made strong effort, failed")
    27  		CANNOT_CONNECT = 3;
    28  	}
    29  
    30  	message Peer {
    31  		// ID of a given peer.
    32  		optional string id = 1;
    33  
    34  		// multiaddrs for a given peer
    35  		repeated bytes addrs = 2;
    36  
    37  		// used to signal the sender's connection capabilities to the peer
    38  		optional ConnectionType connection = 3;
    39  	}
    40  
    41  	// defines what type of message it is.
    42  	optional MessageType type = 1;
    43  
    44  	// defines what coral cluster level this query/response belongs to.
    45  	optional int32 clusterLevelRaw = 10;
    46  
    47  	// Used to specify the key associated with this message.
    48  	// PUT_VALUE, GET_VALUE, ADD_PROVIDER, GET_PROVIDERS
    49  	optional string key = 2;
    50  
    51  	// Used to return a value
    52  	// PUT_VALUE, GET_VALUE
    53  	optional Record record = 3;
    54  
    55  	// Used to return peers closer to a key in a query
    56  	// GET_VALUE, GET_PROVIDERS, FIND_NODE
    57  	repeated Peer closerPeers = 8;
    58  
    59  	// Used to return Providers
    60  	// GET_VALUE, ADD_PROVIDER, GET_PROVIDERS
    61  	repeated Peer providerPeers = 9;
    62  }
    63  
    64  // Record represents a dht record that contains a value
    65  // for a key value pair
    66  message Record {
    67  	// The key that references this record
    68  	optional string key = 1;
    69  
    70  	// The actual value this record is storing
    71  	optional bytes value = 2;
    72  
    73  	// hash of the authors public key
    74  	optional string author = 3;
    75  
    76  	// A PKI signature for the key+value+author
    77  	optional bytes signature = 4;
    78  }