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
Config::Save() const
Config::Save()
{
m_Parser.Save();
}

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

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

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

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

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

@ -190,6 +190,14 @@ namespace llarp
auto obj = path::Builder::ExtractStatus();
obj["exitMap"] = m_ExitMap.ExtractStatus();
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);
}

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

Loading…
Cancel
Save