1
1
Fork 0
mirror of https://github.com/oxen-io/lokinet synced 2023-12-14 06:53:00 +01:00
lokinet/llarp/link/contacts.hpp
dr7ana cef2ff7782 Local router mode
- Up and running locally, no connections yet
- Next: flip testnet and do the gosh dang thing
2023-12-07 09:27:58 -08:00

51 lines
1.2 KiB
C++

#pragma once
#include <llarp/dht/bucket.hpp>
#include <llarp/dht/node.hpp>
namespace llarp
{
struct Router;
/// This class mediates storage, retrieval, and functionality for the various types
/// of contact information that needs to be stored locally by the link manager and
/// router, like RouterContacts and introsets for example
struct Contacts
{
private:
// TODO: why was this a shared ptr in the original implementation? revisit this
std::shared_ptr<int> timer_keepalive;
Router& _router;
const dht::Key_t _local_key;
// holds introsets for remote services
std::unique_ptr<dht::Bucket<dht::ISNode>> _introset_nodes;
public:
Contacts(Router& r);
std::optional<service::EncryptedIntroSet>
get_introset_by_location(const dht::Key_t& key) const;
// TODO: rename every ExtractStatus function to be uniformly snake cased
util::StatusObject
ExtractStatus() const;
void
put_intro(service::EncryptedIntroSet enc);
dht::Bucket<dht::ISNode>*
services() const
{
return _introset_nodes.get();
}
Router*
router() const
{
return &_router;
}
};
} // namespace llarp