mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-03-07 06:09:42 +00:00
kademlia
This commit is contained in:
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:
|
||||
|
||||
Reference in New Issue
Block a user