serialize auth codes in rpc (#1369)

* serialize auth codes in rpc

* format

* format

* config and route fixups

* bump lokimq

* fix compile

* discard unknown members in service keys

* format
pull/1373/head
Jeff 4 years ago committed by GitHub
parent 7f18df4e9a
commit 8943be6c3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -559,7 +559,7 @@ namespace llarp
} }
void void
Config::Save() const Config::Save()
{ {
m_Parser.Save(); m_Parser.Save();
} }

@ -229,7 +229,7 @@ namespace llarp
generateBaseRouterConfig(fs::path defaultDataDir); generateBaseRouterConfig(fs::path defaultDataDir);
void void
Save() const; Save();
void void
Override(std::string section, std::string key, std::string value); Override(std::string section, std::string key, std::string value);

@ -171,7 +171,7 @@ namespace llarp
} }
void void
ConfigParser::Save() const ConfigParser::Save()
{ {
// if we have no overrides keep the config the same on disk // if we have no overrides keep the config the same on disk
if (m_Overrides.empty()) if (m_Overrides.empty())
@ -189,6 +189,7 @@ namespace llarp
ofs << key << "=" << value << std::endl; ofs << key << "=" << value << std::endl;
} }
} }
m_Overrides.clear();
} }
} // namespace llarp } // namespace llarp

@ -46,7 +46,7 @@ namespace llarp
/// save config and any overrides to the file it was loaded from /// save config and any overrides to the file it was loaded from
void void
Save() const; Save();
private: private:
bool bool

@ -72,6 +72,9 @@ namespace llarp
{ {
AddRoute(ip); AddRoute(ip);
} }
const auto ep = router.hiddenServiceContext().GetDefault();
net::AddDefaultRouteViaInterface(ep->GetIfName());
} }
} }
} // namespace llarp } // namespace llarp

@ -19,7 +19,7 @@
namespace lokimq namespace lokimq
{ {
struct bt_list_consumer; class bt_list_consumer;
} // namespace lokimq } // namespace lokimq
namespace llarp namespace llarp

@ -190,6 +190,14 @@ namespace llarp
auto obj = path::Builder::ExtractStatus(); auto obj = path::Builder::ExtractStatus();
obj["exitMap"] = m_ExitMap.ExtractStatus(); obj["exitMap"] = m_ExitMap.ExtractStatus();
obj["identity"] = m_Identity.pub.Addr().ToString(); obj["identity"] = m_Identity.pub.Addr().ToString();
util::StatusObject authCodes;
for (const auto& [service, info] : m_RemoteAuthInfos)
{
authCodes[service.ToString()] = info.token;
}
obj["authCodes"] = authCodes;
return m_state->ExtractStatus(obj); return m_state->ExtractStatus(obj);
} }

@ -28,7 +28,9 @@ namespace llarp
return false; return false;
if (!BEncodeMaybeReadDictInt("v", version, read, key, buf)) if (!BEncodeMaybeReadDictInt("v", version, read, key, buf))
return false; return false;
return read; if (not read)
return bencode_discard(buf);
return true;
} }
void void

Loading…
Cancel
Save