Add rpc call to get current addresses for our node

This commit is contained in:
Michael 2019-10-05 15:52:48 +01:00
parent 01611c2282
commit 0721ce4d34
No known key found for this signature in database
GPG Key ID: 2D51757B47E2434C

View File

@ -201,6 +201,7 @@ namespace llarp
{"llarp.admin.exit.list", [=]() { return ListExitLevels(); }},
{"llarp.admin.dumpstate", [=]() { return DumpState(); }},
{"llarp.admin.status", [=]() { return DumpStatus(); }},
{"llarp.our.addresses", [=]() { return OurAddresses(); }},
{"llarp.version", [=]() { return DumpVersion(); }}}
{
}
@ -279,6 +280,21 @@ namespace llarp
return resp;
}
Response
OurAddresses() const
{
Response services;
router->hiddenServiceContext().ForEachService(
[&](const std::string&,
const std::shared_ptr< service::Endpoint >& service) {
const service::Address addr = service->GetIdentity().pub.Addr();
services.push_back(addr.ToString());
return true;
});
return Response{{"services", services}};
}
Response
DumpVersion() const
{