lokinet/llarp/dht/kademlia.hpp
dr7ana 07271f9ae7 RC refactor layout
- Local and Remote RC's now implemented with discrete functionalities and uses
2023-10-31 13:49:14 -07:00

29 lines
511 B
C++

#pragma once
#include "key.hpp"
#include <llarp/router_contact.hpp>
namespace llarp::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);
}
bool
operator()(const RouterContact& left, const RouterContact& right) const
{
return (left.router_id() ^ us) < (right.router_id() ^ us);
}
};
} // namespace llarp::dht