lokinet/llarp/dht/node.hpp

67 lines
1.0 KiB
C++
Raw Normal View History

#pragma once
#include "key.hpp"
#include <llarp/router_contact.hpp>
#include <llarp/service/intro_set.hpp>
2019-07-30 23:42:13 +00:00
#include <utility>
namespace llarp::dht
{
struct RCNode
{
RouterContact rc;
Key_t ID;
RCNode()
{
ID.Zero();
}
2018-09-10 17:37:28 +00:00
RCNode(const RouterContact& other) : rc(other), ID(other.router_id())
{}
2019-02-08 19:43:25 +00:00
util::StatusObject
ExtractStatus() const
{
return rc.extract_status();
}
bool
operator<(const RCNode& other) const
{
return rc.timestamp() < other.rc.timestamp();
}
};
struct ISNode
{
service::EncryptedIntroSet introset;
Key_t ID;
ISNode()
{
ID.Zero();
}
ISNode(service::EncryptedIntroSet other) : introset(std::move(other))
{
ID = Key_t(introset.derivedSigningKey.as_array());
}
2018-09-10 17:37:28 +00:00
util::StatusObject
ExtractStatus() const
{
return introset.ExtractStatus();
}
2019-02-08 19:43:25 +00:00
bool
operator<(const ISNode& other) const
{
return introset.signedAt < other.introset.signedAt;
}
};
} // namespace llarp::dht