2021-03-09 23:24:35 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <llarp/hook/ihook.hpp>
|
|
|
|
#include <llarp/router_id.hpp>
|
|
|
|
#include "address.hpp"
|
|
|
|
#include "pendingbuffer.hpp"
|
|
|
|
#include "router_lookup_job.hpp"
|
|
|
|
#include "session.hpp"
|
|
|
|
#include "endpoint_types.hpp"
|
|
|
|
#include <llarp/util/compare_ptr.hpp>
|
|
|
|
#include <llarp/util/decaying_hashtable.hpp>
|
|
|
|
#include <llarp/util/status.hpp>
|
2021-03-19 15:09:06 +01:00
|
|
|
#include "lns_tracker.hpp"
|
2019-07-15 11:15:51 +02:00
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
#include <queue>
|
|
|
|
#include <set>
|
|
|
|
#include <unordered_map>
|
|
|
|
|
2021-03-20 19:30:18 +01:00
|
|
|
#include <oxenmq/variant.h>
|
|
|
|
|
2021-01-12 00:13:22 +01:00
|
|
|
namespace llarp
|
|
|
|
{
|
2019-07-15 11:15:51 +02:00
|
|
|
namespace service
|
|
|
|
{
|
|
|
|
struct EndpointState
|
|
|
|
{
|
|
|
|
hooks::Backend_ptr m_OnUp;
|
|
|
|
hooks::Backend_ptr m_OnDown;
|
|
|
|
hooks::Backend_ptr m_OnReady;
|
|
|
|
|
2020-04-07 20:38:56 +02:00
|
|
|
std::set<RouterID> m_SnodeBlacklist;
|
2019-07-15 11:15:51 +02:00
|
|
|
|
|
|
|
AbstractRouter* m_Router;
|
|
|
|
std::string m_Keyfile;
|
|
|
|
std::string m_Name;
|
|
|
|
std::string m_NetNS;
|
2020-05-21 16:18:23 +02:00
|
|
|
bool m_ExitEnabled = false;
|
2019-07-15 11:15:51 +02:00
|
|
|
|
|
|
|
PendingTraffic m_PendingTraffic;
|
|
|
|
|
|
|
|
Sessions m_RemoteSessions;
|
|
|
|
Sessions m_DeadSessions;
|
|
|
|
|
2020-04-07 20:38:56 +02:00
|
|
|
std::set<ConvoTag> m_InboundConvos;
|
2019-07-15 11:15:51 +02:00
|
|
|
|
|
|
|
SNodeSessions m_SNodeSessions;
|
|
|
|
|
2021-03-09 19:39:40 +01:00
|
|
|
std::unordered_multimap<Address, PathEnsureHook> m_PendingServiceLookups;
|
|
|
|
std::unordered_map<Address, llarp_time_t> m_LastServiceLookupTimes;
|
2019-07-15 11:15:51 +02:00
|
|
|
|
2021-03-09 19:39:40 +01:00
|
|
|
std::unordered_map<RouterID, uint32_t> m_ServiceLookupFails;
|
2019-07-15 11:15:51 +02:00
|
|
|
|
|
|
|
PendingRouters m_PendingRouters;
|
|
|
|
|
2020-04-07 20:38:56 +02:00
|
|
|
llarp_time_t m_LastPublish = 0s;
|
2020-02-24 20:40:45 +01:00
|
|
|
llarp_time_t m_LastPublishAttempt = 0s;
|
2019-07-15 11:15:51 +02:00
|
|
|
/// our introset
|
|
|
|
IntroSet m_IntroSet;
|
|
|
|
/// pending remote service lookups by id
|
|
|
|
PendingLookups m_PendingLookups;
|
|
|
|
/// on initialize functions
|
2020-04-07 20:38:56 +02:00
|
|
|
std::list<std::function<bool(void)>> m_OnInit;
|
2019-07-15 11:15:51 +02:00
|
|
|
|
|
|
|
/// conversations
|
|
|
|
ConvoMap m_Sessions;
|
|
|
|
|
2020-02-18 17:00:45 +01:00
|
|
|
OutboundSessions_t m_OutboundSessions;
|
|
|
|
|
2021-03-20 20:26:08 +01:00
|
|
|
util::DecayingHashTable<std::string, std::variant<Address, RouterID>, std::hash<std::string>>
|
2021-03-20 16:47:36 +01:00
|
|
|
nameCache;
|
2019-07-15 11:15:51 +02:00
|
|
|
|
2021-03-19 15:09:06 +01:00
|
|
|
LNSLookupTracker lnsTracker;
|
2019-07-15 11:15:51 +02:00
|
|
|
|
|
|
|
bool
|
2020-05-01 00:11:05 +02:00
|
|
|
Configure(const NetworkConfig& conf);
|
2019-07-15 11:15:51 +02:00
|
|
|
|
|
|
|
util::StatusObject
|
|
|
|
ExtractStatus(util::StatusObject& obj) const;
|
|
|
|
};
|
|
|
|
} // namespace service
|
|
|
|
} // namespace llarp
|