1
1
Fork 0
mirror of https://github.com/oxen-io/lokinet synced 2023-12-14 06:53:00 +01:00
lokinet/llarp/service/endpoint.hpp

671 lines
17 KiB
C++
Raw Normal View History

2018-07-09 19:32:11 +02:00
#ifndef LLARP_SERVICE_ENDPOINT_HPP
#define LLARP_SERVICE_ENDPOINT_HPP
2018-12-12 03:15:08 +01:00
2019-01-11 02:19:36 +01:00
#include <ev/ev.h>
2018-12-12 02:06:46 +01:00
#include <exit/session.hpp>
#include <net/net.hpp>
2019-01-11 02:19:36 +01:00
#include <path/path.hpp>
#include <path/pathbuilder.hpp>
#include <service/address.hpp>
2018-12-12 03:15:08 +01:00
#include <service/Identity.hpp>
#include <service/handler.hpp>
#include <service/protocol.hpp>
2018-07-09 19:32:11 +02:00
2019-03-29 02:02:41 +01:00
// minimum time between introset shifts
2018-09-18 19:48:26 +02:00
#ifndef MIN_SHIFT_INTERVAL
#define MIN_SHIFT_INTERVAL (5 * 1000)
#endif
2018-07-09 19:32:11 +02:00
namespace llarp
{
namespace service
{
2019-02-03 00:12:42 +01:00
// forward declare
struct Context;
// forward declare
struct AsyncKeyExchange;
2018-08-30 20:48:43 +02:00
struct Endpoint : public path::Builder,
2018-08-09 21:02:17 +02:00
public ILookupHolder,
public IDataHandler
2018-07-09 19:32:11 +02:00
{
2018-07-18 05:10:21 +02:00
/// minimum interval for publishing introsets
static const llarp_time_t INTROSET_PUBLISH_INTERVAL =
2019-04-05 16:58:22 +02:00
path::default_lifetime / 8;
2018-07-18 05:10:21 +02:00
static const llarp_time_t INTROSET_PUBLISH_RETRY_INTERVAL = 5000;
static const size_t MAX_OUTBOUND_CONTEXT_COUNT = 4;
Endpoint(const std::string& nickname, AbstractRouter* r, Context* parent);
2018-07-09 19:32:11 +02:00
~Endpoint();
2019-02-11 18:14:43 +01:00
virtual util::StatusObject
ExtractStatus() const override;
2019-02-08 20:43:25 +01:00
void
SetHandler(IDataHandler* h);
2018-08-16 16:34:15 +02:00
virtual bool
2018-07-09 19:32:11 +02:00
SetOption(const std::string& k, const std::string& v);
2018-08-16 16:34:15 +02:00
virtual void
2018-07-19 00:50:05 +02:00
Tick(llarp_time_t now);
/// return true if we have a resolvable ip address
virtual bool
HasIfAddr() const
{
return false;
}
/// get our ifaddr if it is set
virtual huint32_t
GetIfAddr() const
{
return huint32_t{0};
}
2018-08-09 21:02:17 +02:00
/// router's logic
2018-12-10 15:14:55 +01:00
llarp::Logic*
2018-08-09 21:02:17 +02:00
RouterLogic();
/// endpoint's logic
2018-12-10 15:14:55 +01:00
llarp::Logic*
2018-08-09 21:02:17 +02:00
EndpointLogic();
2018-07-19 06:58:39 +02:00
/// endpoint's net loop for sending data to user
llarp_ev_loop*
EndpointNetLoop();
llarp::Crypto*
2018-07-19 06:58:39 +02:00
Crypto();
llarp_threadpool*
Worker();
AbstractRouter*
2018-07-23 01:14:29 +02:00
Router()
{
return m_Router;
}
virtual bool
LoadKeyFile();
2018-08-16 16:34:15 +02:00
virtual bool
2018-07-09 19:32:11 +02:00
Start();
virtual std::string
2019-03-25 02:54:37 +01:00
Name() const override;
2018-07-16 05:32:13 +02:00
2018-07-18 05:10:21 +02:00
bool
2018-12-24 22:10:35 +01:00
ShouldPublishDescriptors(llarp_time_t now) const override;
2018-07-18 05:10:21 +02:00
2019-03-30 14:02:10 +01:00
void
HandlePathDied(path::Path* p) override;
void
EnsureReplyPath(const ServiceInfo& addr);
2018-07-18 05:10:21 +02:00
bool
PublishIntroSet(AbstractRouter* r) override;
2018-07-18 05:10:21 +02:00
2018-09-18 16:48:06 +02:00
bool
PublishIntroSetVia(AbstractRouter* r, path::Path* p);
2018-09-18 16:48:06 +02:00
bool
2018-12-24 22:10:35 +01:00
HandleGotIntroMessage(const llarp::dht::GotIntroMessage* msg) override;
2018-08-10 23:34:11 +02:00
bool
2018-12-24 22:10:35 +01:00
HandleGotRouterMessage(const llarp::dht::GotRouterMessage* msg) override;
2018-08-10 23:34:11 +02:00
2018-07-12 20:21:44 +02:00
bool
HandleHiddenServiceFrame(path::Path* p,
const llarp::service::ProtocolFrame* msg);
2018-07-12 20:21:44 +02:00
/// return true if we have an established path to a hidden service
bool
HasPathToService(const Address& remote) const;
2018-10-23 20:06:55 +02:00
virtual huint32_t
ObtainIPForAddr(const AlignedBuffer< 32 >& addr, bool serviceNode) = 0;
2018-10-23 20:06:55 +02:00
2018-10-23 20:18:00 +02:00
virtual bool
HasAddress(const AlignedBuffer< 32 >& addr) const = 0;
2018-08-10 05:51:38 +02:00
/// return true if we have a pending job to build to a hidden service but
/// it's not done yet
bool
HasPendingPathToService(const Address& remote) const;
2018-07-12 20:21:44 +02:00
/// return false if we don't have a path to the service
/// return true if we did and we removed it
bool
ForgetPathToService(const Address& remote);
2018-09-18 19:48:26 +02:00
bool
2018-12-24 22:10:35 +01:00
HandleDataMessage(const PathID_t&, ProtocolMessage* msg) override;
2018-08-09 21:02:17 +02:00
virtual bool
HandleWriteIPPacket(const llarp_buffer_t& pkt,
std::function< huint32_t(void) > getFromIP) = 0;
2018-11-29 14:12:35 +01:00
bool
ProcessDataMessage(ProtocolMessage* msg);
2018-09-18 19:48:26 +02:00
2018-08-10 23:34:11 +02:00
/// ensure that we know a router, looks up if it doesn't
void
EnsureRouterIsKnown(const RouterID& router);
/// lookup a router via closest path
bool
LookupRouterAnon(RouterID router);
/// stop this endpoint
bool
Stop() override;
const Identity&
2018-11-21 15:30:14 +01:00
GetIdentity() const
2018-07-23 01:14:29 +02:00
{
return m_Identity;
2018-07-23 01:14:29 +02:00
}
2018-07-19 06:58:39 +02:00
2018-08-04 04:59:32 +02:00
void
2018-12-24 22:10:35 +01:00
PutLookup(IServiceLookup* lookup, uint64_t txid) override;
2018-08-04 04:59:32 +02:00
void
2018-12-24 22:10:35 +01:00
HandlePathBuilt(path::Path* path) override;
2018-08-22 17:52:10 +02:00
bool
SendToServiceOrQueue(const RouterID& addr, const llarp_buffer_t& payload,
ProtocolType t);
2018-11-29 14:12:35 +01:00
bool
SendToSNodeOrQueue(const RouterID& addr, const llarp_buffer_t& payload);
2018-08-22 17:52:10 +02:00
2018-12-12 19:37:03 +01:00
void
FlushSNodeTraffic();
2018-08-22 17:52:10 +02:00
struct PendingBuffer
{
std::vector< byte_t > payload;
ProtocolType protocol;
PendingBuffer(const llarp_buffer_t& buf, ProtocolType t)
2018-08-22 17:52:10 +02:00
: payload(buf.sz), protocol(t)
{
memcpy(payload.data(), buf.base, buf.sz);
}
2019-02-03 01:48:10 +01:00
ManagedBuffer
2018-08-22 17:52:10 +02:00
Buffer()
{
2019-02-03 01:48:10 +01:00
return ManagedBuffer{llarp_buffer_t(payload)};
2018-08-22 17:52:10 +02:00
}
};
bool
HandleDataDrop(path::Path* p, const PathID_t& dst, uint64_t s);
bool
CheckPathIsDead(path::Path* p, llarp_time_t latency);
using PendingBufferQueue = std::queue< PendingBuffer >;
2018-08-22 17:52:10 +02:00
struct SendContext
{
SendContext(const ServiceInfo& ident, const Introduction& intro,
PathSet* send, Endpoint* ep);
void
AsyncEncryptAndSendTo(const llarp_buffer_t& payload, ProtocolType t);
/// send a fully encrypted hidden service frame
/// via a path on our pathset with path id p
2019-02-21 17:45:33 +01:00
bool
2019-03-08 18:26:29 +01:00
Send(const ProtocolFrame& f);
llarp::SharedSecret sharedKey;
ServiceInfo remoteIdent;
Introduction remoteIntro;
2018-10-01 17:45:55 +02:00
ConvoTag currentConvoTag;
PathSet* m_PathSet;
IDataHandler* m_DataHandler;
Endpoint* m_Endpoint;
2018-09-24 17:34:56 +02:00
uint64_t sequenceNo = 0;
llarp_time_t lastGoodSend = 0;
llarp_time_t createdAt;
2018-09-27 19:29:26 +02:00
llarp_time_t sendTimeout = 40 * 1000;
llarp_time_t connectTimeout = 60 * 1000;
bool markedBad = false;
virtual bool
2019-03-26 22:01:20 +01:00
ShiftIntroduction(bool rebuild = true)
{
2019-03-26 22:01:20 +01:00
(void)rebuild;
return true;
};
virtual void
UpdateIntroSet(bool randomizePath = false) = 0;
2018-10-23 20:06:55 +02:00
virtual bool
MarkCurrentIntroBad(llarp_time_t now) = 0;
private:
void
EncryptAndSendTo(const llarp_buffer_t& payload, ProtocolType t);
virtual void
AsyncGenIntro(const llarp_buffer_t& payload, ProtocolType t) = 0;
};
2018-09-17 17:32:37 +02:00
static void
HandlePathDead(void*);
2019-03-08 18:00:13 +01:00
bool
HasConvoTag(const ConvoTag& t) const override;
2019-03-08 15:36:24 +01:00
bool
ShouldBuildMore(llarp_time_t now) const override;
2018-07-12 20:21:44 +02:00
/// context needed to initiate an outbound hidden service session
struct OutboundContext : public path::Builder, public SendContext
2018-07-12 20:21:44 +02:00
{
OutboundContext(const IntroSet& introSet, Endpoint* parent);
2018-07-12 20:21:44 +02:00
~OutboundContext();
2019-02-11 18:14:43 +01:00
util::StatusObject
ExtractStatus() const override;
bool
Stop() override;
bool
HandleDataDrop(path::Path* p, const PathID_t& dst, uint64_t s);
2019-03-30 14:02:10 +01:00
void
HandlePathDied(path::Path* p) override;
2018-09-12 15:29:42 +02:00
/// set to true if we are updating the remote introset right now
bool updatingIntroSet;
2018-07-23 01:14:29 +02:00
/// update the current selected intro to be a new best introduction
/// return true if we have changed intros
bool
2019-03-26 22:01:20 +01:00
ShiftIntroduction(bool rebuild = true) override;
2018-07-12 20:21:44 +02:00
/// mark the current remote intro as bad
bool
MarkCurrentIntroBad(llarp_time_t now) override;
/// return true if we are ready to send
bool
ReadyToSend() const;
bool
ShouldBuildMore(llarp_time_t now) const override;
/// tick internal state
2018-09-24 17:52:25 +02:00
/// return true to mark as dead
bool
Tick(llarp_time_t now);
2018-09-24 17:52:25 +02:00
/// return true if it's safe to remove ourselves
bool
IsDone(llarp_time_t now) const;
bool
CheckPathIsDead(path::Path* p, llarp_time_t dlt);
void
AsyncGenIntro(const llarp_buffer_t& payload, ProtocolType t) override;
2018-07-12 20:21:44 +02:00
/// issues a lookup to find the current intro set of the remote service
void
UpdateIntroSet(bool randomizePath) override;
2018-07-12 20:21:44 +02:00
bool
BuildOneAlignedTo(const RouterID& remote);
void
HandlePathBuilt(path::Path* path) override;
bool
2018-08-30 20:48:43 +02:00
SelectHop(llarp_nodedb* db, const RouterContact& prev,
RouterContact& cur, size_t hop,
llarp::path::PathRole roles) override;
bool
HandleHiddenServiceFrame(path::Path* p, const ProtocolFrame* frame);
2018-08-04 04:59:32 +02:00
std::string
2019-03-29 02:02:41 +01:00
Name() const override;
2018-08-04 04:59:32 +02:00
2018-07-12 20:21:44 +02:00
private:
2018-10-04 15:03:48 +02:00
/// swap remoteIntro with next intro
void
SwapIntros();
2018-07-19 06:58:39 +02:00
void
OnGeneratedIntroFrame(AsyncKeyExchange* k, PathID_t p);
2018-07-23 01:14:29 +02:00
bool
2018-10-15 17:43:41 +02:00
OnIntroSetUpdate(const Address& addr, const IntroSet* i,
const RouterID& endpoint);
2018-07-19 06:58:39 +02:00
2018-08-04 04:59:32 +02:00
uint64_t m_UpdateIntrosetTX = 0;
IntroSet currentIntroSet;
2018-10-04 15:03:48 +02:00
Introduction m_NextIntro;
std::unordered_map< Introduction, llarp_time_t, Introduction::Hash >
m_BadIntros;
2018-09-18 19:48:26 +02:00
llarp_time_t lastShift = 0;
uint16_t m_LookupFails = 0;
2019-03-29 02:02:41 +01:00
uint16_t m_BuildFails = 0;
2018-07-12 20:21:44 +02:00
};
// passed a sendto context when we have a path established otherwise
// nullptr if the path was not made before the timeout
using PathEnsureHook = std::function< void(Address, OutboundContext*) >;
2018-07-12 20:21:44 +02:00
/// return false if we have already called this function before for this
/// address
bool
EnsurePathToService(const Address& remote, PathEnsureHook h,
2018-10-23 20:06:55 +02:00
uint64_t timeoutMS, bool lookupOnRandomPath = false);
2018-07-12 20:21:44 +02:00
using SNodeEnsureHook =
std::function< void(RouterID, llarp::exit::BaseSession*) >;
2018-11-29 14:12:35 +01:00
/// ensure a path to a service node by public key
void
EnsurePathToSNode(const RouterID& remote, SNodeEnsureHook h);
2018-11-29 14:12:35 +01:00
bool
HasPathToSNode(const RouterID& remote) const;
2018-11-29 14:12:35 +01:00
2018-08-09 21:02:17 +02:00
void
2018-12-24 22:10:35 +01:00
PutSenderFor(const ConvoTag& tag, const ServiceInfo& info) override;
2018-08-09 21:02:17 +02:00
bool
GetCachedSessionKeyFor(const ConvoTag& remote,
SharedSecret& secret) const override;
2018-08-09 21:02:17 +02:00
void
PutCachedSessionKeyFor(const ConvoTag& remote,
2018-12-24 22:10:35 +01:00
const SharedSecret& secret) override;
2018-08-09 21:02:17 +02:00
bool
2018-12-24 22:10:35 +01:00
GetSenderFor(const ConvoTag& remote, ServiceInfo& si) const override;
2018-08-09 21:02:17 +02:00
void
2018-12-24 22:10:35 +01:00
PutIntroFor(const ConvoTag& remote, const Introduction& intro) override;
2018-08-09 21:02:17 +02:00
bool
2018-12-24 22:10:35 +01:00
GetIntroFor(const ConvoTag& remote, Introduction& intro) const override;
2018-08-09 21:02:17 +02:00
2019-03-08 17:00:45 +01:00
void
RemoveConvoTag(const ConvoTag& remote) override;
2019-02-21 17:45:33 +01:00
void
PutReplyIntroFor(const ConvoTag& remote,
const Introduction& intro) override;
bool
GetReplyIntroFor(const ConvoTag& remote,
Introduction& intro) const override;
2018-08-09 21:02:17 +02:00
bool
GetConvoTagsForService(const ServiceInfo& si,
2018-12-24 22:10:35 +01:00
std::set< ConvoTag >& tag) const override;
2018-08-09 21:02:17 +02:00
void
PutNewOutboundContext(const IntroSet& introset);
2018-07-18 05:10:21 +02:00
virtual void
IntroSetPublishFail();
virtual void
IntroSetPublished();
2018-09-18 16:48:06 +02:00
protected:
/// parent context that owns this endpoint
Context* const context;
void
RegenAndPublishIntroSet(llarp_time_t now, bool forceRebuild = false);
2018-07-18 05:10:21 +02:00
IServiceLookup*
GenerateLookupByTag(const Tag& tag);
void
PrefetchServicesByTag(const Tag& tag);
2018-08-09 21:02:17 +02:00
uint64_t
GetSeqNoForConvo(const ConvoTag& tag);
bool
IsolateNetwork();
2018-08-16 16:34:15 +02:00
bool
NetworkIsIsolated() const;
static void
RunIsolatedMainLoop(void*);
2018-07-18 05:10:21 +02:00
private:
2018-08-10 23:34:11 +02:00
bool
2018-10-15 17:43:41 +02:00
OnLookup(const service::Address& addr, const IntroSet* i,
const RouterID& endpoint); /* */
2018-08-10 23:34:11 +02:00
2018-08-09 21:02:17 +02:00
static bool
2018-08-20 21:12:12 +02:00
SetupIsolatedNetwork(void* user, bool success);
2018-08-09 21:02:17 +02:00
bool
2018-08-18 16:01:21 +02:00
DoNetworkIsolation(bool failed);
2018-08-09 21:02:17 +02:00
2018-08-16 16:34:15 +02:00
virtual bool
SetupNetworking()
{
// XXX: override me
return true;
}
2018-08-18 16:01:21 +02:00
virtual bool
IsolationFailed()
{
// XXX: override me
return false;
}
2018-07-18 05:10:21 +02:00
uint64_t
GenTXID();
protected:
IDataHandler* m_DataHandler = nullptr;
2018-08-09 21:02:17 +02:00
Identity m_Identity;
2018-11-14 20:34:17 +01:00
std::unique_ptr< llarp::exit::BaseSession > m_Exit;
2018-07-09 19:32:11 +02:00
private:
AbstractRouter* m_Router;
2018-08-09 21:02:17 +02:00
llarp_threadpool* m_IsolatedWorker = nullptr;
2018-12-10 15:14:55 +01:00
llarp::Logic* m_IsolatedLogic = nullptr;
llarp_ev_loop* m_IsolatedNetLoop = nullptr;
2018-07-09 19:32:11 +02:00
std::string m_Keyfile;
std::string m_Name;
2018-08-09 21:02:17 +02:00
std::string m_NetNS;
2018-11-03 21:17:28 +01:00
using PendingTraffic =
std::unordered_map< Address, PendingBufferQueue, Address::Hash >;
2018-08-22 17:52:10 +02:00
2018-11-03 21:17:28 +01:00
PendingTraffic m_PendingTraffic;
2018-11-03 21:17:28 +01:00
using Sessions =
std::unordered_multimap< Address, std::unique_ptr< OutboundContext >,
Address::Hash >;
Sessions m_RemoteSessions;
Sessions m_DeadSessions;
2018-09-24 17:52:25 +02:00
using SNodeSessions =
std::unordered_multimap< RouterID,
std::unique_ptr< llarp::exit::BaseSession >,
RouterID::Hash >;
2018-11-29 14:12:35 +01:00
SNodeSessions m_SNodeSessions;
std::unordered_map< Address, ServiceInfo, Address::Hash >
m_AddressToService;
std::unordered_multimap< Address, PathEnsureHook, Address::Hash >
2018-07-23 01:14:29 +02:00
m_PendingServiceLookups;
2018-08-10 23:34:11 +02:00
2018-10-23 20:06:55 +02:00
std::unordered_map< RouterID, uint32_t, RouterID::Hash >
m_ServiceLookupFails;
2018-08-14 23:17:18 +02:00
struct RouterLookupJob
{
RouterLookupJob(Endpoint* p)
{
2018-10-29 17:48:36 +01:00
started = p->Now();
2018-08-14 23:17:18 +02:00
txid = p->GenTXID();
}
uint64_t txid;
llarp_time_t started;
bool
IsExpired(llarp_time_t now) const
{
if(now < started)
return false;
return now - started > 5000;
}
};
std::unordered_map< RouterID, RouterLookupJob, RouterID::Hash >
m_PendingRouters;
2018-08-10 23:34:11 +02:00
2018-07-18 05:10:21 +02:00
uint64_t m_CurrentPublishTX = 0;
llarp_time_t m_LastPublish = 0;
llarp_time_t m_LastPublishAttempt = 0;
2018-10-04 18:48:26 +02:00
llarp_time_t m_MinPathLatency = (5 * 1000);
2018-07-18 05:10:21 +02:00
/// our introset
service::IntroSet m_IntroSet;
/// pending remote service lookups by id
2018-08-14 23:17:18 +02:00
std::unordered_map< uint64_t, std::unique_ptr< service::IServiceLookup > >
m_PendingLookups;
/// prefetch remote address list
std::set< Address > m_PrefetchAddrs;
2018-07-18 05:10:21 +02:00
/// hidden service tag
Tag m_Tag;
/// prefetch descriptors for these hidden service tags
std::set< Tag > m_PrefetchTags;
2018-08-09 21:02:17 +02:00
/// on initialize functions
std::list< std::function< bool(void) > > m_OnInit;
2019-02-08 20:43:25 +01:00
struct Session : public util::IStateful
2018-08-09 21:02:17 +02:00
{
2019-02-21 17:45:33 +01:00
Introduction replyIntro;
2018-08-09 21:02:17 +02:00
SharedSecret sharedKey;
ServiceInfo remote;
Introduction intro;
llarp_time_t lastUsed = 0;
uint64_t seqno = 0;
2019-02-08 20:43:25 +01:00
2019-02-11 18:14:43 +01:00
util::StatusObject
ExtractStatus() const override
2019-02-08 20:43:25 +01:00
{
2019-02-11 18:14:43 +01:00
util::StatusObject obj{{"lastUsed", lastUsed},
2019-02-21 17:45:33 +01:00
{"replyIntro", replyIntro.ExtractStatus()},
2019-02-11 18:14:43 +01:00
{"remote", remote.Addr().ToString()},
2019-02-21 17:45:33 +01:00
{"seqno", seqno},
{"intro", intro.ExtractStatus()}};
2019-02-11 18:14:43 +01:00
return obj;
2019-02-08 20:43:25 +01:00
};
2019-02-09 15:37:24 +01:00
bool
IsExpired(llarp_time_t now,
2019-04-05 16:58:22 +02:00
llarp_time_t lifetime = (path::default_lifetime * 2)) const
2019-02-09 15:37:24 +01:00
{
if(now <= lastUsed)
return false;
return now - lastUsed > lifetime;
2019-02-09 15:37:24 +01:00
}
2018-08-09 21:02:17 +02:00
};
/// conversations
using ConvoMap_t =
std::unordered_map< ConvoTag, Session, ConvoTag::Hash >;
ConvoMap_t m_Sessions;
2018-07-18 05:10:21 +02:00
2018-08-14 23:17:18 +02:00
struct CachedTagResult
2018-07-18 05:10:21 +02:00
{
2018-07-19 06:58:39 +02:00
const static llarp_time_t TTL = 10000;
llarp_time_t lastRequest = 0;
2018-08-04 04:59:32 +02:00
llarp_time_t lastModified = 0;
2018-07-18 05:10:21 +02:00
std::set< IntroSet > result;
Tag tag;
2018-10-29 17:51:52 +01:00
Endpoint* parent;
2018-07-18 05:10:21 +02:00
2018-10-29 17:51:52 +01:00
CachedTagResult(const Tag& t, Endpoint* p) : tag(t), parent(p)
2018-07-18 05:10:21 +02:00
{
}
2018-08-14 23:17:18 +02:00
~CachedTagResult()
{
}
2018-07-18 05:10:21 +02:00
2018-07-19 00:50:05 +02:00
void
Expire(llarp_time_t now);
2018-07-18 05:10:21 +02:00
bool
ShouldRefresh(llarp_time_t now) const
{
2018-07-19 06:58:39 +02:00
if(now <= lastRequest)
return false;
2018-08-04 04:59:32 +02:00
return (now - lastRequest) > TTL;
2018-07-18 05:10:21 +02:00
}
llarp::routing::IMessage*
2018-08-14 23:17:18 +02:00
BuildRequestMessage(uint64_t txid);
2018-07-18 05:10:21 +02:00
bool
HandleResponse(const std::set< IntroSet >& results);
};
2018-08-14 23:17:18 +02:00
struct TagLookupJob : public IServiceLookup
{
TagLookupJob(Endpoint* parent, CachedTagResult* result)
: IServiceLookup(parent, parent->GenTXID(), "taglookup")
, m_result(result)
{
}
~TagLookupJob()
{
}
llarp::routing::IMessage*
BuildRequestMessage()
{
return m_result->BuildRequestMessage(txid);
}
bool
HandleResponse(const std::set< IntroSet >& results)
{
return m_result->HandleResponse(results);
}
CachedTagResult* m_result;
};
2018-07-18 05:10:21 +02:00
std::unordered_map< Tag, CachedTagResult, Tag::Hash > m_PrefetchedTags;
2018-07-09 19:32:11 +02:00
};
} // namespace service
} // namespace llarp
2018-08-16 16:34:15 +02:00
#endif