lokinet/llarp/dht/node.hpp

61 lines
988 B
C++
Raw Normal View History

#ifndef LLARP_DHT_NODE_HPP
#define LLARP_DHT_NODE_HPP
2018-12-12 00:48:54 +00:00
#include <dht/key.hpp>
2018-12-12 01:55:30 +00:00
#include <router_contact.hpp>
2018-12-12 02:15:08 +00:00
#include <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();
}
RCNode(const llarp::RouterContact& other) : rc(other), ID(other.pubkey)
{
}
2018-09-10 17:37:28 +00:00
bool
operator<(const RCNode& other) const
{
return rc.last_updated < other.rc.last_updated;
2018-09-10 17:37:28 +00:00
}
};
struct ISNode
{
llarp::service::IntroSet introset;
Key_t ID;
ISNode()
{
ID.Zero();
}
ISNode(const llarp::service::IntroSet& other)
{
introset = other;
introset.A.CalculateAddress(ID.as_array());
2018-09-10 17:37:28 +00:00
}
bool
operator<(const ISNode& other) const
{
return introset.T < other.introset.T;
}
};
2018-07-17 04:37:50 +00:00
} // namespace dht
} // namespace llarp
2018-08-30 18:48:43 +00:00
#endif