mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
kademlia
This commit is contained in:
parent
4f9a977022
commit
4f1f08b805
6 changed files with 78 additions and 0 deletions
19
Identity.h
19
Identity.h
|
@ -57,7 +57,26 @@ namespace data
|
|||
|
||||
IdentHash CalculateIdentHash (const Identity& identity);
|
||||
Keys CreateRandomKeys ();
|
||||
|
||||
// kademlia
|
||||
struct RoutingKey
|
||||
{
|
||||
uint8_t hash[32];
|
||||
};
|
||||
|
||||
struct XORMetric
|
||||
{
|
||||
uint8_t metric[32];
|
||||
|
||||
void SetMin () { memset (metric, 0, 32); };
|
||||
void SetMax () { memset (metric, 0xFF, 32); };
|
||||
bool operator< (const XORMetric& other) const { return memcmp (metric, other.metric, 32) < 0; };
|
||||
};
|
||||
|
||||
RoutingKey CreateRoutingKey (const IdentHash& ident);
|
||||
XORMetric operator^(const RoutingKey& key1, const RoutingKey& key2);
|
||||
|
||||
// destination for delivery instuctions
|
||||
class RoutingDestination
|
||||
{
|
||||
public:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue