lokinet/include/llarp/dht/node.hpp

63 lines
1013 B
C++
Raw Normal View History

#ifndef LLARP_DHT_NODE_HPP
#define LLARP_DHT_NODE_HPP
2018-08-30 18:48:43 +00:00
#include <llarp/router_contact.hpp>
#include <llarp/dht/key.hpp>
#include <llarp/service/IntroSet.hpp>
namespace llarp
{
namespace dht
{
struct RCNode
{
2018-08-30 18:48:43 +00:00
llarp::RouterContact rc;
Key_t ID;
2018-08-30 18:48:43 +00:00
RCNode()
{
ID.Zero();
}
2018-08-30 18:48:43 +00:00
RCNode(const llarp::RouterContact& other)
{
2018-08-30 18:48:43 +00:00
rc = other;
ID = other.pubkey.data();
}
2018-09-10 17:37:28 +00:00
bool
operator<(const RCNode& other) const
{
return rc.OtherIsNewer(other.rc);
}
};
struct ISNode
{
llarp::service::IntroSet introset;
Key_t ID;
ISNode()
{
ID.Zero();
}
ISNode(const llarp::service::IntroSet& other)
{
introset = other;
2018-08-10 03:51:38 +00:00
introset.A.CalculateAddress(ID);
2018-09-10 17:37:28 +00:00
}
bool
operator<(const ISNode& other) const
{
return introset.OtherIsNewer(other.introset);
}
};
2018-07-17 04:37:50 +00:00
} // namespace dht
} // namespace llarp
2018-08-30 18:48:43 +00:00
#endif