2021-03-09 22:24:35 +00:00
|
|
|
#pragma once
|
|
|
|
|
2023-10-24 13:18:03 +00:00
|
|
|
#include "address.hpp"
|
|
|
|
#include "endpoint_types.hpp"
|
|
|
|
#include "lns_tracker.hpp"
|
|
|
|
#include "pendingbuffer.hpp"
|
|
|
|
#include "router_lookup_job.hpp"
|
|
|
|
#include "session.hpp"
|
|
|
|
|
2021-03-09 22:24:35 +00:00
|
|
|
#include <llarp/router_id.hpp>
|
|
|
|
#include <llarp/util/compare_ptr.hpp>
|
|
|
|
#include <llarp/util/decaying_hashtable.hpp>
|
|
|
|
#include <llarp/util/status.hpp>
|
2023-10-24 13:18:03 +00:00
|
|
|
|
2023-10-19 21:59:57 +00:00
|
|
|
#include <oxenc/variant.h>
|
2023-10-24 13:18:03 +00:00
|
|
|
|
2019-07-15 09:15:51 +00:00
|
|
|
#include <memory>
|
|
|
|
#include <queue>
|
|
|
|
#include <set>
|
|
|
|
#include <unordered_map>
|
|
|
|
|
2023-10-03 20:00:23 +00:00
|
|
|
namespace llarp::service
|
2021-01-11 23:13:22 +00:00
|
|
|
{
|
2023-10-03 20:00:23 +00:00
|
|
|
struct EndpointState
|
2019-07-15 09:15:51 +00:00
|
|
|
{
|
2023-10-03 20:00:23 +00:00
|
|
|
std::set<RouterID> snode_blacklist;
|
2019-07-15 09:15:51 +00:00
|
|
|
|
2023-10-03 20:00:23 +00:00
|
|
|
Router* router;
|
|
|
|
std::string key_file;
|
|
|
|
std::string name;
|
|
|
|
std::string net_NS;
|
|
|
|
bool is_exit_enabled = false;
|
2019-07-15 09:15:51 +00:00
|
|
|
|
2023-10-03 20:00:23 +00:00
|
|
|
PendingTrafficMap pending_traffic;
|
2019-07-15 09:15:51 +00:00
|
|
|
|
2023-10-03 20:00:23 +00:00
|
|
|
ConnectionMap remote_sessions;
|
|
|
|
ConnectionMap dead_sessions;
|
2019-07-15 09:15:51 +00:00
|
|
|
|
2023-10-03 20:00:23 +00:00
|
|
|
std::set<ConvoTag> inbound_convotags;
|
2019-07-15 09:15:51 +00:00
|
|
|
|
2023-10-03 20:00:23 +00:00
|
|
|
SNodeConnectionMap snode_sessions;
|
2019-07-15 09:15:51 +00:00
|
|
|
|
2023-10-03 20:00:23 +00:00
|
|
|
std::unordered_multimap<Address, EnsurePathCallback> pending_service_lookups;
|
|
|
|
std::unordered_map<Address, llarp_time_t> last_service_lookup_time;
|
2019-07-15 09:15:51 +00:00
|
|
|
|
2023-10-03 20:00:23 +00:00
|
|
|
std::unordered_map<RouterID, uint32_t> service_lookup_fails;
|
2019-07-15 09:15:51 +00:00
|
|
|
|
2023-10-03 20:00:23 +00:00
|
|
|
PendingRoutersMap pending_routers;
|
2019-07-15 09:15:51 +00:00
|
|
|
|
2023-10-03 20:00:23 +00:00
|
|
|
llarp_time_t last_publish = 0s;
|
|
|
|
llarp_time_t last_publish_attempt = 0s;
|
|
|
|
/// our introset
|
|
|
|
IntroSet local_introset;
|
|
|
|
/// on initialize functions
|
|
|
|
std::list<std::function<bool(void)>> on_init_callbacks;
|
2019-07-15 09:15:51 +00:00
|
|
|
|
2023-10-03 20:00:23 +00:00
|
|
|
/// conversations
|
|
|
|
std::unordered_map<ConvoTag, Session> m_Sessions;
|
2019-07-15 09:15:51 +00:00
|
|
|
|
2023-10-03 20:00:23 +00:00
|
|
|
std::unordered_set<Address> m_OutboundSessions;
|
2020-02-18 16:00:45 +00:00
|
|
|
|
2023-10-03 20:00:23 +00:00
|
|
|
util::DecayingHashTable<std::string, std::variant<Address, RouterID>, std::hash<std::string>>
|
|
|
|
nameCache;
|
2019-07-15 09:15:51 +00:00
|
|
|
|
2023-10-03 20:00:23 +00:00
|
|
|
LNSLookupTracker lnsTracker;
|
2019-07-15 09:15:51 +00:00
|
|
|
|
2023-10-03 20:00:23 +00:00
|
|
|
bool
|
|
|
|
Configure(const NetworkConfig& conf);
|
2019-07-15 09:15:51 +00:00
|
|
|
|
2023-10-03 20:00:23 +00:00
|
|
|
util::StatusObject
|
|
|
|
ExtractStatus(util::StatusObject& obj) const;
|
|
|
|
};
|
|
|
|
} // namespace llarp::service
|