lokinet/llarp/dht/kademlia.hpp
Jeff Becker 9a8470bcc1
* const correctness
* use std::map's upper_bound to find many closer entries
* randomize key for exploration to allow many explore jobs in paralell
2019-07-29 09:08:40 -04:00

27 lines
432 B
C++

#ifndef LLARP_DHT_KADEMLIA_HPP
#define LLARP_DHT_KADEMLIA_HPP
#include <dht/key.hpp>
namespace llarp
{
namespace dht
{
struct XorMetric
{
const Key_t us;
XorMetric(const Key_t& ourKey) : us(ourKey)
{
}
bool
operator()(const Key_t& left, const Key_t& right) const
{
return (us ^ left) < (us ^ right);
}
};
} // namespace dht
} // namespace llarp
#endif