publish hidden service descriptors and acknoledge publish

pull/5/head
Jeff Becker 6 years ago
parent 980db97145
commit bae4f746be
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

@ -191,6 +191,8 @@ set(LIB_SRC
llarp/routing/path_confirm.cpp
llarp/routing/path_latency.cpp
llarp/routing/path_transfer.cpp
llarp/service/context.cpp
llarp/service/endpoint.cpp
vendor/cppbackport-master/lib/fs/rename.cpp
vendor/cppbackport-master/lib/fs/filestatus.cpp
vendor/cppbackport-master/lib/fs/filetype.cpp

@ -27,6 +27,7 @@ def main():
ap.add_argument('--bin', type=str, required=True)
ap.add_argument('--out', type=str, required=True)
ap.add_argument('--connect', type=int, default=10)
ap.add_argument('--ifname', type=str, default='lo')
args = ap.parse_args()
@ -39,7 +40,7 @@ def main():
'worker-threads': '4'
}
config['bind'] = {
'lo': str(args.baseport + nodeid)
args.ifname: str(args.baseport + nodeid)
}
config['netdb'] = {
'dir': 'netdb'
@ -60,6 +61,7 @@ def main():
for nodeid in range(args.clients):
config = CP()
config['router'] = {
'net-threads': '1',
'worker-threads': '2'
@ -77,9 +79,19 @@ def main():
d = os.path.join(args.dir, clientNodeName(nodeid))
if not os.path.exists(d):
os.mkdir(d)
hiddenservice = os.path.join(d, 'service.ini')
config['services'] = {
'testnet': hiddenservice
}
fp = os.path.join(d, 'daemon.ini')
with open(fp, 'w') as f:
config.write(f)
config = CP()
config['test-service'] = {
}
with open(hiddenservice, 'w') as f:
config.write(f)
with open(args.out, 'w') as f:
f.write('''[program:svc-node]

@ -11,7 +11,11 @@ namespace llarp
struct GotIntroMessage : public IMessage
{
std::list< llarp::service::IntroSet > I;
uint64_t T;
uint64_t T = 0;
GotIntroMessage() : IMessage({})
{
}
GotIntroMessage(uint64_t tx, const llarp::service::IntroSet* i = nullptr);
@ -23,7 +27,7 @@ namespace llarp
bool
DecodeKey(llarp_buffer_t key, llarp_buffer_t* val);
virtual bool
bool
HandleMessage(llarp_dht_context* ctx,
std::vector< IMessage* >& replies) const;
};

@ -17,6 +17,12 @@ namespace llarp
{
}
PublishIntroMessage(const llarp::service::IntroSet& i, uint64_t tx)
: IMessage({}), txID(tx)
{
I = i;
}
~PublishIntroMessage();
bool

@ -8,15 +8,15 @@ struct sendbuf_t
{
sendbuf_t(size_t s) : sz(s)
{
buf = new byte_t[s];
_buf = new byte_t[s];
}
~sendbuf_t()
{
delete[] buf;
if(_buf)
delete[] _buf;
}
byte_t *buf;
size_t sz;
size_t
@ -28,8 +28,11 @@ struct sendbuf_t
byte_t *
data()
{
return buf;
return _buf;
}
private:
byte_t *_buf = nullptr;
};
typedef std::queue< sendbuf_t * > sendqueue_t;

@ -14,6 +14,7 @@
#include <llarp/router_id.hpp>
#include <llarp/routing/handler.hpp>
#include <llarp/routing/message.hpp>
#include <llarp/service/Intro.hpp>
#include <functional>
#include <list>
@ -204,6 +205,9 @@ namespace llarp
typedef std::function< void(Path*) > BuildResultHookFunc;
typedef std::vector< PathHopConfig > HopList;
HopList hops;
llarp::service::Introduction intro;
llarp_time_t buildStarted;
PathStatus status;
@ -253,6 +257,9 @@ namespace llarp
bool
HandleDownstream(llarp_buffer_t X, const TunnelNonce& Y, llarp_router* r);
bool
IsReady() const;
// Is this deprecated?
// nope not deprecated :^DDDD
const PathID_t&
@ -264,8 +271,6 @@ namespace llarp
RouterID
Upstream() const;
llarp_time_t Latency = 0;
protected:
llarp::routing::InboundMessageParser m_InboundMessageParser;

@ -12,6 +12,8 @@ struct llarp_pathbuilder_context : public llarp::path::PathSet
llarp_pathbuilder_context(llarp_router* p_router,
struct llarp_dht_context* p_dht);
virtual ~llarp_pathbuilder_context(){};
void
BuildOne();
};

@ -1,7 +1,10 @@
#ifndef LLARP_PATHSET_HPP
#define LLARP_PATHSET_HPP
#include <llarp/time.h>
#include <list>
#include <llarp/path_types.hpp>
#include <llarp/router_id.hpp>
#include <llarp/service/IntroSet.hpp>
#include <map>
#include <tuple>
@ -61,8 +64,22 @@ namespace llarp
bool
ShouldPublishDescriptors() const;
virtual bool
HandleGotIntroMessage(const llarp::dht::GotIntroMessage* msg)
{
return false;
}
Path*
PickRandomEstablishedPath();
bool
GetCurrentIntroductions(
std::list< llarp::service::Introduction >& intros) const;
bool
HandleGotIntroMessage(const llarp::dht::GotIntroMessage* msg);
PublishIntroSet(const llarp::service::IntroSet& introset,
llarp_router* r);
private:
typedef std::pair< RouterID, PathID_t > PathInfo_t;
@ -70,6 +87,7 @@ namespace llarp
size_t m_NumPaths;
PathMap_t m_Paths;
uint64_t m_CurrentPublishTX = 0;
};
} // namespace path

@ -22,6 +22,7 @@ namespace llarp
struct InboundMessageParser
{
llarp::PathID_t from;
InboundMessageParser();
bool
ParseMessageBuffer(llarp_buffer_t buf, IMessageHandler* handler,

@ -4,27 +4,9 @@
#include <llarp/service/Identity.hpp>
#include <llarp/service/Intro.hpp>
#include <llarp/service/IntroSet.hpp>
#include <llarp/service/config.hpp>
#include <llarp/service/context.hpp>
#include <llarp/service/endpoint.hpp>
#include <llarp/service/types.hpp>
#include <set>
#include <string>
namespace llarp
{
namespace service
{
struct Config
{
typedef std::list< std::pair< std::string, std::string > >
section_values_t;
typedef std::pair< std::string, section_values_t > section_t;
std::list< section_t > services;
bool
Load(const std::string& fname);
};
}; // namespace service
} // namespace llarp
#endif

@ -19,6 +19,13 @@ namespace llarp
~ServiceInfo();
bool
operator==(const ServiceInfo& other) const
{
return enckey == other.enckey && signkey == other.signkey
&& version == other.version && vanity == other.vanity;
}
ServiceInfo&
operator=(const ServiceInfo& other)
{

@ -18,6 +18,16 @@ namespace llarp
uint64_t version = 0;
uint64_t expiresAt;
Introduction() = default;
Introduction(const Introduction& other)
{
router = other.router;
pathID = other.pathID;
latency = other.latency;
version = other.version;
expiresAt = other.expiresAt;
}
~Introduction();
friend std::ostream&

@ -0,0 +1,23 @@
#ifndef LLARP_SERVICE_CONFIG_HPP
#define LLARP_SERVICE_CONFIG_HPP
#include <list>
#include <string>
namespace llarp
{
namespace service
{
struct Config
{
typedef std::list< std::pair< std::string, std::string > >
section_values_t;
typedef std::pair< std::string, section_values_t > section_t;
std::list< section_t > services;
bool
Load(const std::string& fname);
};
}
}
#endif

@ -0,0 +1,30 @@
#ifndef LLARP_SERVICE_CONTEXT_HPP
#define LLARP_SERVICE_CONTEXT_HPP
#include <llarp/router.h>
#include <llarp/service/config.hpp>
#include <llarp/service/endpoint.hpp>
#include <unordered_map>
namespace llarp
{
namespace service
{
/// holds all the hidden service endpoints we own
struct Context
{
Context(llarp_router *r);
~Context();
void
Tick();
bool
AddEndpoint(const Config::section_t &conf);
private:
llarp_router *m_Router;
std::unordered_map< std::string, Endpoint * > m_Endpoints;
};
}
}
#endif

@ -7,7 +7,7 @@ namespace llarp
{
namespace service
{
struct Endpoint
struct Endpoint : public llarp_pathbuilder_context
{
Endpoint(const std::string& nickname, llarp_router* r);
~Endpoint();
@ -15,13 +15,19 @@ namespace llarp
bool
SetOption(const std::string& k, const std::string& v);
void
Tick();
bool
Start();
bool
HandleGotIntroMessage(const llarp::dht::GotIntroMessage* msg);
private:
llarp_router* m_Router;
llarp_pathbuilder_context* m_PathSet;
std::string m_Keyfile;
std::string m_Name;
Identity m_Identity;
};
} // namespace service

@ -208,6 +208,7 @@ namespace iwp
iwp_async_session_start *session =
static_cast< iwp_async_session_start * >(user);
auto crypto = session->iwp->crypto;
auto logic = session->iwp->logic;
auto dh = crypto->transport_dh_client;
auto shorthash = crypto->shorthash;
@ -248,8 +249,8 @@ namespace iwp
buf.base = (session->buf + 32);
buf.sz = session->sz - 32;
hmac(session->buf, buf, e_K);
session->hook(session);
// llarp_logic_queue_job(logic, {user, &inform_session_start});
// session->hook(session);
llarp_logic_queue_job(logic, {user, &inform_session_start});
}
void
@ -258,6 +259,7 @@ namespace iwp
iwp_async_session_start *session =
static_cast< iwp_async_session_start * >(user);
auto crypto = session->iwp->crypto;
auto logic = session->iwp->logic;
auto dh = crypto->transport_dh_server;
auto shorthash = crypto->shorthash;
@ -313,8 +315,8 @@ namespace iwp
}
else // hmac fail
session->buf = nullptr;
session->hook(session);
// llarp_logic_queue_job(logic, {user, &inform_session_start});
// session->hook(session);
llarp_logic_queue_job(logic, {user, &inform_session_start});
}
void

@ -57,6 +57,18 @@ namespace llarp
case 'I':
dec->msg = new PublishIntroMessage();
break;
case 'G':
if(dec->relayed)
{
dec->msg = new GotIntroMessage();
break;
}
else
{
llarp::LogWarn(
"GotIntroMessage found when parsing direct DHT message");
return false;
}
default:
llarp::LogWarn("unknown dht message type: ", (char)*strbuf.base);
// bad msg type

@ -27,11 +27,12 @@ namespace llarp
std::vector< IMessage * > &replies) const
{
// TODO: implement me better?
auto path = ctx->impl.router->paths.GetLocalPathSet(pathID);
if(path)
auto pathset = ctx->impl.router->paths.GetLocalPathSet(pathID);
if(pathset)
{
return path->HandleGotIntroMessage(this);
return pathset->HandleGotIntroMessage(this);
}
llarp::LogWarn("No path for got intro message pathid=", pathID);
return false;
}

@ -27,6 +27,8 @@ namespace llarp
if(!bencode_read_integer(val, &S))
return false;
}
if(!BEncodeMaybeReadDictInt("T", txID, read, key, val))
return false;
if(!BEncodeMaybeReadDictInt("V", version, read, key, val))
return false;
return read;
@ -39,7 +41,7 @@ namespace llarp
auto &dht = ctx->impl;
if(!I.VerifySignature(&dht.router->crypto))
{
llarp::LogWarn("invalid introset signature");
llarp::LogWarn("invalid introset signature, ", I);
return false;
}
if(I.W && !I.W->IsValid(dht.router->crypto.shorthash))
@ -69,6 +71,8 @@ namespace llarp
if(!BEncodeWriteDictInt(buf, "S", S))
return false;
}
if(!BEncodeWriteDictInt(buf, "T", txID))
return false;
if(!BEncodeWriteDictInt(buf, "V", LLARP_PROTO_VERSION))
return false;
return bencode_end(buf);

@ -199,44 +199,36 @@ frame_state::inbound_frame_complete(uint64_t id)
" != ", llarp::AlignedBuffer< 32 >(rxmsg->msginfo.hash()));
return false;
}
if(id == nextMsgID)
{
llarp_link_session *impl = parent;
if(id == 0)
llarp_link_session *impl = parent;
if(id == 0)
{
success = router->HandleRecvLinkMessage(parent, buf);
if(impl->CheckRCValid())
{
success = router->HandleRecvLinkMessage(parent, buf);
if(impl->CheckRCValid())
{
if(!impl->IsEstablished())
{
impl->send_LIM();
impl->session_established();
}
++nextMsgID;
}
else
if(!impl->IsEstablished())
{
llarp::PubKey k = impl->remote_router.pubkey;
llarp::LogWarn("spoofed LIM from ", k);
impl->close();
success = false;
impl->send_LIM();
impl->session_established();
}
++nextMsgID;
}
else
{
recvqueue.Put(new InboundMessage(id, msg));
success = true;
llarp::PubKey k = impl->remote_router.pubkey;
llarp::LogWarn("spoofed LIM from ", k);
impl->close();
success = false;
}
}
else
{
llarp::LogWarn("out of order message expected ", nextMsgID, " but got ",
id);
recvqueue.Put(new InboundMessage(id, msg));
success = true;
}
}
delete rxmsg;
rx.erase(id);
@ -334,10 +326,10 @@ frame_state::next_frame(llarp_buffer_t *buf)
llarp::LogDebug("next frame, ", left, " frames left in send queue");
if(left)
{
sendbuf_t *send = sendqueue.front();
buf->base = send->data();
buf->cur = send->data();
buf->sz = send->size();
auto &send = sendqueue.front();
buf->base = send->data();
buf->cur = send->data();
buf->sz = send->size();
return true;
}
return false;
@ -346,9 +338,9 @@ frame_state::next_frame(llarp_buffer_t *buf)
void
frame_state::pop_next_frame()
{
sendbuf_t *buf = sendqueue.front();
sendqueue.pop();
auto &buf = sendqueue.front();
delete buf;
sendqueue.pop();
}
void

@ -292,6 +292,12 @@ namespace llarp
{
hops[idx].txID = hops[idx + 1].rxID;
}
// initialize parts of the introduction
intro.router = hops[h->numHops - 1].router.pubkey;
// TODO: or is it rxid ?
intro.pathID = hops[h->numHops - 1].txID;
m_InboundMessageParser.from = RXID();
}
void
@ -312,6 +318,12 @@ namespace llarp
return hops[0].rxID;
}
bool
Path::IsReady() const
{
return intro.latency > 0 && status == ePathEstablished;
}
RouterID
Path::Upstream() const
{
@ -419,12 +431,15 @@ namespace llarp
{
if(status == ePathBuilding)
{
// finish initializing introduction
intro.expiresAt = buildStarted + hops[0].lifetime;
// confirm that we build the path
status = ePathEstablished;
llarp::LogInfo("path is confirmed tx=", TXID(), " rx=", RXID());
if(m_BuiltHook)
m_BuiltHook(this);
m_BuiltHook = nullptr;
llarp::routing::PathLatencyMessage latency;
latency.T = rand();
m_LastLatencyTestID = latency.T;
@ -442,8 +457,8 @@ namespace llarp
{
if(msg->L == m_LastLatencyTestID)
{
Latency = llarp_time_now_ms() - m_LastLatencyTestTime;
llarp::LogInfo("path latency is ", Latency, " ms for tx=", TXID(),
intro.latency = llarp_time_now_ms() - m_LastLatencyTestTime;
llarp::LogInfo("path latency is ", intro.latency, " ms for tx=", TXID(),
" rx=", RXID());
m_LastLatencyTestID = 0;
return true;

@ -1,3 +1,5 @@
#include <llarp/dht/messages/pubintro.hpp>
#include <llarp/messages/dht.hpp>
#include <llarp/path.hpp>
#include <llarp/pathset.hpp>
@ -87,10 +89,65 @@ namespace llarp
}
bool
PathSet::HandleGotIntroMessage(const llarp::dht::GotIntroMessage* msg)
PathSet::GetCurrentIntroductions(
std::list< llarp::service::Introduction >& intros) const
{
size_t count = 0;
auto itr = m_Paths.begin();
while(itr != m_Paths.end())
{
if(itr->second->IsReady())
{
intros.push_back(itr->second->intro);
++count;
}
++itr;
}
return count > 0;
}
bool
PathSet::ShouldPublishDescriptors() const
{
// TODO: implement me
return false;
return m_CurrentPublishTX == 0 || true;
}
Path*
PathSet::PickRandomEstablishedPath()
{
std::vector< Path* > established;
auto itr = m_Paths.begin();
while(itr != m_Paths.end())
{
if(itr->second->IsReady())
established.push_back(itr->second);
++itr;
}
auto sz = established.size();
if(sz)
{
return established[rand() % sz];
}
else
return nullptr;
}
bool
PathSet::PublishIntroSet(const llarp::service::IntroSet& introset,
llarp_router* r)
{
auto path = PickRandomEstablishedPath();
if(path)
{
m_CurrentPublishTX = rand();
llarp::routing::DHTMessage msg;
msg.M.push_back(
new llarp::dht::PublishIntroMessage(introset, m_CurrentPublishTX));
return path->SendRoutingMessage(&msg, r);
}
else
return false;
}
} // namespace path

@ -35,6 +35,7 @@ llarp_router::llarp_router()
, dht(llarp_dht_context_new(this))
, inbound_link_msg_parser(this)
, explorePool(llarp_pathbuilder_context_new(this, dht))
, hiddenServiceContext(this)
{
// set rational defaults
@ -379,6 +380,7 @@ void
llarp_router::Tick()
{
llarp::LogDebug("tick router");
paths.ExpirePaths();
// TODO: don't do this if we have enough paths already
if(inboundLinks.size() == 0)
@ -393,15 +395,9 @@ llarp_router::Tick()
llarp::LogWarn("not enough nodes known to build exploritory paths, have ",
N, " nodes, need 3 now (will be 5 later)");
}
hiddenServiceContext.Tick();
}
paths.TickPaths();
llarp_link_session_iter iter;
iter.user = this;
iter.visit = &send_padded_message;
if(sendPadding)
{
outboundLink->iter_sessions(iter);
}
}
bool
@ -1119,29 +1115,12 @@ llarp_router::LoadHiddenServiceConfig(const char *fname)
return false;
for(const auto &config : conf.services)
{
if(!AddHiddenService(config))
if(!hiddenServiceContext.AddEndpoint(config))
return false;
}
return true;
}
bool
llarp_router::AddHiddenService(const llarp::service::Config::section_t &config)
{
auto service = new llarp::service::Endpoint(config.first, this);
for(const auto &option : config.second)
{
auto &k = option.first;
auto &v = option.second;
if(!service->SetOption(k, v))
{
delete service;
return false;
}
}
return service->Start();
}
namespace llarp
{
void

@ -94,6 +94,8 @@ struct llarp_router
llarp_pathbuilder_select_hop_func selectHopFunc = nullptr;
llarp_pathbuilder_context *explorePool = nullptr;
llarp::service::Context hiddenServiceContext;
llarp_link *outboundLink = nullptr;
std::list< llarp_link * > inboundLinks;

@ -73,7 +73,10 @@ namespace llarp
firstKey = true;
if(bencode_read_dict(&buf, &reader))
{
result = msg->HandleMessage(h, r);
msg->from = from;
result = msg->HandleMessage(h, r);
if(!result)
llarp::LogWarn("Failed to handle inbound routing message");
delete msg;
}
else

@ -1,5 +1,6 @@
#include <llarp/service.hpp>
#include "buffer.hpp"
#include "ini.hpp"
#include "router.hpp"
namespace llarp
@ -79,18 +80,18 @@ namespace llarp
IntroSet::DecodeKey(llarp_buffer_t key, llarp_buffer_t* buf)
{
bool read = false;
if(!BEncodeMaybeReadDictEntry("A", A, read, key, buf))
if(!BEncodeMaybeReadDictEntry("a", A, read, key, buf))
return false;
if(llarp_buffer_eq(key, "I"))
if(llarp_buffer_eq(key, "i"))
{
return BEncodeReadList(I, buf);
}
if(!BEncodeMaybeReadDictInt("V", version, read, key, buf))
if(!BEncodeMaybeReadDictInt("v", version, read, key, buf))
return false;
if(!BEncodeMaybeReadDictEntry("Z", Z, read, key, buf))
if(!BEncodeMaybeReadDictEntry("z", Z, read, key, buf))
return false;
return read;
@ -113,11 +114,13 @@ namespace llarp
// write version
if(!BEncodeWriteDictInt(buf, "v", version))
return false;
/*
if(W)
{
if(!BEncodeWriteDictEntry("w", *W, buf))
return false;
}
*/
if(!BEncodeWriteDictEntry("z", Z, buf))
return false;
@ -192,6 +195,7 @@ namespace llarp
crypto->identity_keygen(signkey);
pub.enckey = llarp::seckey_topublic(enckey);
pub.signkey = llarp::seckey_topublic(signkey);
pub.vanity.Zero();
}
bool
@ -235,48 +239,16 @@ namespace llarp
return crypto->verify(A.signkey, buf, Z);
}
Endpoint::Endpoint(const std::string& name, llarp_router* r)
: m_Router(r), m_PathSet(llarp_pathbuilder_context_new(r, r->dht))
{
}
bool
Endpoint::SetOption(const std::string& k, const std::string& v)
{
if(k == "keyfile")
{
m_Keyfile = v;
return true;
}
return false;
}
bool
Endpoint::Start()
{
auto crypto = &m_Router->crypto;
if(m_Keyfile.size())
{
if(!m_Identity.EnsureKeys(m_Keyfile, crypto))
return false;
}
else
{
m_Identity.RegenerateKeys(crypto);
}
return true;
}
Endpoint::~Endpoint()
{
llarp_pathbuilder_context_free(m_PathSet);
}
bool
Config::Load(const std::string& fname)
{
// TODO: implement me
return false;
ini::Parser parser(fname);
for(const auto& sec : parser.top().ordered_sections)
{
services.push_back({sec->first, sec->second.values});
}
return services.size() > 0;
}
} // namespace service

@ -0,0 +1,64 @@
#include <llarp/service/context.hpp>
namespace llarp
{
namespace service
{
Context::Context(llarp_router *r) : m_Router(r)
{
}
Context::~Context()
{
auto itr = m_Endpoints.begin();
while(itr != m_Endpoints.end())
{
delete itr->second;
itr = m_Endpoints.erase(itr);
}
}
void
Context::Tick()
{
auto itr = m_Endpoints.begin();
while(itr != m_Endpoints.end())
{
itr->second->Tick();
++itr;
}
}
bool
Context::AddEndpoint(const Config::section_t &conf)
{
auto itr = m_Endpoints.find(conf.first);
if(itr != m_Endpoints.end())
{
llarp::LogError("cannot add hidden service with duplicate name: ",
conf.first);
return false;
}
auto service = new llarp::service::Endpoint(conf.first, m_Router);
for(const auto &option : conf.second)
{
auto &k = option.first;
auto &v = option.second;
if(!service->SetOption(k, v))
{
delete service;
return false;
}
}
if(service->Start())
{
llarp::LogInfo("added hidden service endpoint ", conf.first);
m_Endpoints.emplace(conf.first, service);
return true;
}
llarp::LogError("failed to start hidden service endpoint ", conf.first);
delete service;
return false;
}
}
}

@ -0,0 +1,101 @@
#include <llarp/service/endpoint.hpp>
#include "router.hpp"
namespace llarp
{
namespace service
{
Endpoint::Endpoint(const std::string& name, llarp_router* r)
: llarp_pathbuilder_context(r, r->dht), m_Router(r), m_Name(name)
{
}
bool
Endpoint::SetOption(const std::string& k, const std::string& v)
{
if(k == "keyfile")
{
m_Keyfile = v;
return true;
}
return false;
}
void
Endpoint::Tick()
{
if(ShouldPublishDescriptors())
{
llarp::LogDebug("publish descriptor for endpoint ", m_Name);
IntroSet introset;
if(!GetCurrentIntroductions(introset.I))
{
llarp::LogWarn("could not publish descriptors for endpoint ", m_Name,
" because we couldn't get any introductions");
return;
}
if(!m_Identity.SignIntroSet(introset, &m_Router->crypto))
{
llarp::LogWarn("failed to sign introset for endpoint ", m_Name);
return;
}
if(PublishIntroSet(introset, m_Router))
{
llarp::LogInfo("publishing introset for endpoint ", m_Name);
}
else
{
llarp::LogWarn("failed to publish intro set for endpoint ", m_Name);
}
}
}
bool
Endpoint::HandleGotIntroMessage(const llarp::dht::GotIntroMessage* msg)
{
auto crypto = &m_Router->crypto;
for(const auto& introset : msg->I)
{
if(!introset.VerifySignature(crypto))
{
llarp::LogWarn(
"invalid signature in got intro message for service endpoint ",
m_Name);
return false;
}
if(m_Identity.pub == introset.A)
{
llarp::LogInfo(
"got introset publish confirmation for hidden service endpoint ",
m_Name);
}
else
{
/// TODO: implement lookup response
}
}
return true;
}
bool
Endpoint::Start()
{
auto crypto = &m_Router->crypto;
if(m_Keyfile.size())
{
if(!m_Identity.EnsureKeys(m_Keyfile, crypto))
return false;
}
else
{
m_Identity.RegenerateKeys(crypto);
}
return true;
}
Endpoint::~Endpoint()
{
}
}
}
Loading…
Cancel
Save