mirror of
https://github.com/oxen-io/lokinet.git
synced 2024-11-03 23:15:52 +00:00
49b9ad7197
* partial tun code refactor * take out the trash * move vpn platform code into llarp/vpn/platform.cpp * fix hive build * fix win32 * fix memory leak on win32 * reduce cpu use * make macos compile * win32 patches: * use wepoll for zmq * use all cores on windows iocp read loop * fix zmq patch for windows * clean up cmake for win32 * add uninstall before reinstall option to win32 installer * more ipv6 stuff * make it compile * fix up route poker * remove an unneeded code block in macos wtf * always use call to system * fix route poker behavior on macos * disable ipv6 on windows for now * cpu perf improvement: * colease calls to Router::PumpLL to 1 per event loop wakeup * set up THEN add addresses * emulate proactor event loop on win32 * remove excessively verbose error message * fix issue #1499 * exclude uv_poll from win32 so that it can start up * update logtag to include directory * create minidump on windows if there was a crash * make windows happy * use dmp suffix on minidump files * typo fix * address feedback from jason * use PROJECT_SOURCE_DIR instead of CMAKE_SOURCE_DIR * quote $@ in apply-patches in case path has spaces in it * address feedback from tom * remove llarp/ev/pipe * add comments for clairification * make event loop queue size constant named
99 lines
2.5 KiB
C++
99 lines
2.5 KiB
C++
#ifndef LLARP_SERVICE_ENDPOINT_STATE_HPP
|
|
#define LLARP_SERVICE_ENDPOINT_STATE_HPP
|
|
|
|
#include <hook/ihook.hpp>
|
|
#include <router_id.hpp>
|
|
#include <service/address.hpp>
|
|
#include <service/pendingbuffer.hpp>
|
|
#include <service/router_lookup_job.hpp>
|
|
#include <service/session.hpp>
|
|
#include <service/endpoint_types.hpp>
|
|
#include <util/compare_ptr.hpp>
|
|
#include <util/decaying_hashtable.hpp>
|
|
#include <util/status.hpp>
|
|
|
|
#include <memory>
|
|
#include <queue>
|
|
#include <set>
|
|
#include <unordered_map>
|
|
|
|
namespace llarp
|
|
{
|
|
struct EventLoop;
|
|
}
|
|
|
|
using llarp_ev_loop_ptr = std::shared_ptr<llarp::EventLoop>;
|
|
|
|
namespace llarp
|
|
{
|
|
// clang-format off
|
|
namespace exit { struct BaseSession; }
|
|
namespace path { struct Path; using Path_ptr = std::shared_ptr< Path >; }
|
|
namespace routing { struct PathTransferMessage; }
|
|
// clang-format on
|
|
|
|
namespace service
|
|
{
|
|
struct IServiceLookup;
|
|
struct OutboundContext;
|
|
struct Endpoint;
|
|
|
|
struct EndpointState
|
|
{
|
|
hooks::Backend_ptr m_OnUp;
|
|
hooks::Backend_ptr m_OnDown;
|
|
hooks::Backend_ptr m_OnReady;
|
|
|
|
std::set<RouterID> m_SnodeBlacklist;
|
|
|
|
AbstractRouter* m_Router;
|
|
std::shared_ptr<Logic> m_IsolatedLogic = nullptr;
|
|
llarp_ev_loop_ptr m_IsolatedNetLoop = nullptr;
|
|
std::string m_Keyfile;
|
|
std::string m_Name;
|
|
std::string m_NetNS;
|
|
bool m_ExitEnabled = false;
|
|
|
|
PendingTraffic m_PendingTraffic;
|
|
|
|
Sessions m_RemoteSessions;
|
|
Sessions m_DeadSessions;
|
|
|
|
std::set<ConvoTag> m_InboundConvos;
|
|
|
|
SNodeSessions m_SNodeSessions;
|
|
|
|
std::unordered_multimap<Address, PathEnsureHook, Address::Hash> m_PendingServiceLookups;
|
|
std::unordered_map<Address, llarp_time_t, Address::Hash> m_LastServiceLookupTimes;
|
|
|
|
std::unordered_map<RouterID, uint32_t, RouterID::Hash> m_ServiceLookupFails;
|
|
|
|
PendingRouters m_PendingRouters;
|
|
|
|
llarp_time_t m_LastPublish = 0s;
|
|
llarp_time_t m_LastPublishAttempt = 0s;
|
|
/// our introset
|
|
IntroSet m_IntroSet;
|
|
/// pending remote service lookups by id
|
|
PendingLookups m_PendingLookups;
|
|
/// on initialize functions
|
|
std::list<std::function<bool(void)>> m_OnInit;
|
|
|
|
/// conversations
|
|
ConvoMap m_Sessions;
|
|
|
|
OutboundSessions_t m_OutboundSessions;
|
|
|
|
util::DecayingHashTable<std::string, Address, std::hash<std::string>> nameCache;
|
|
|
|
bool
|
|
Configure(const NetworkConfig& conf);
|
|
|
|
util::StatusObject
|
|
ExtractStatus(util::StatusObject& obj) const;
|
|
};
|
|
} // namespace service
|
|
} // namespace llarp
|
|
|
|
#endif
|