Rename isRouter -> isSNode

The isRouter wording was quite confusing, especially in a call such as:

    router->Configure(config, opts.isRouter, nodedb)
pull/1576/head
Jason Rhinelander 3 years ago committed by Jeff Becker
parent 1d6ad7284c
commit 2ca7ef7f5f
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

@ -268,7 +268,7 @@ run_main_context(std::optional<fs::path> confFile, const llarp::RuntimeOptions o
{
conf = std::make_shared<llarp::Config>(llarp::GetDefaultDataDir());
}
if (!conf->Load(confFile, opts.isRouter))
if (!conf->Load(confFile, opts.isSNode))
throw std::runtime_error{"Config file parsing failed"};
ctx = std::make_shared<llarp::Context>();
@ -486,7 +486,7 @@ lokinet_main(int argc, char* argv[])
if (result.count("router") > 0)
{
opts.isRouter = true;
opts.isSNode = true;
}
if (result.count("force") > 0)
@ -518,7 +518,7 @@ lokinet_main(int argc, char* argv[])
{
try
{
llarp::ensureConfig(basedir, *configFile, overwrite, opts.isRouter);
llarp::ensureConfig(basedir, *configFile, overwrite, opts.isSNode);
}
catch (std::exception& ex)
{
@ -548,7 +548,7 @@ lokinet_main(int argc, char* argv[])
try
{
llarp::ensureConfig(
llarp::GetDefaultDataDir(), llarp::GetDefaultConfigPath(), overwrite, opts.isRouter);
llarp::GetDefaultDataDir(), llarp::GetDefaultConfigPath(), overwrite, opts.isSNode);
}
catch (std::exception& ex)
{

@ -33,7 +33,7 @@ namespace llarp
{
bool background = false;
bool debug = false;
bool isRouter = false;
bool isSNode = false;
};
struct Context

@ -12,7 +12,7 @@ namespace llarp
{}
bool
KeyManager::initialize(const llarp::Config& config, bool genIfAbsent, bool isRouter)
KeyManager::initialize(const llarp::Config& config, bool genIfAbsent, bool isSNode)
{
if (m_initialized)
return false;
@ -51,7 +51,7 @@ namespace llarp
// we need to back up keys if our self.signed doesn't appear to have a
// valid signature
m_needBackup = (isRouter and not rc.VerifySignature());
m_needBackup = (isSNode and not rc.VerifySignature());
// if our RC file can't be verified, assume it is out of date (e.g. uses
// older encryption) and needs to be regenerated. before doing so, backup

@ -40,10 +40,10 @@ namespace llarp
/// @param config should be a prepared config object
/// @param genIfAbsent determines whether or not we will create files if they
/// do not exist.
/// @param isRouter
/// @param isSNode
/// @return true on success, false otherwise
bool
initialize(const llarp::Config& config, bool genIfAbsent, bool isRouter);
initialize(const llarp::Config& config, bool genIfAbsent, bool isSNode);
/// Obtain the self-signed RouterContact
///

@ -77,7 +77,7 @@ namespace llarp
nodedb = std::make_shared<NodeDB>(
nodedb_dir, [r = router.get()](auto call) { r->QueueDiskIO(std::move(call)); });
if (!router->Configure(config, opts.isRouter, nodedb))
if (!router->Configure(config, opts.isSNode, nodedb))
throw std::runtime_error("Failed to configure router");
}

@ -172,7 +172,7 @@ namespace llarp
Sign(Signature& sig, const llarp_buffer_t& buf) const = 0;
virtual bool
Configure(std::shared_ptr<Config> conf, bool isRouter, std::shared_ptr<NodeDB> nodedb) = 0;
Configure(std::shared_ptr<Config> conf, bool isSNode, std::shared_ptr<NodeDB> nodedb) = 0;
virtual bool
IsServiceNode() const = 0;

@ -284,7 +284,7 @@ namespace llarp
}
bool
Router::Configure(std::shared_ptr<Config> c, bool isRouter, std::shared_ptr<NodeDB> nodedb)
Router::Configure(std::shared_ptr<Config> c, bool isSNode, std::shared_ptr<NodeDB> nodedb)
{
m_Config = std::move(c);
auto& conf = *m_Config;
@ -314,7 +314,7 @@ namespace llarp
}
// fetch keys
if (not m_keyManager->initialize(conf, true, isRouter))
if (not m_keyManager->initialize(conf, true, isSNode))
throw std::runtime_error("KeyManager failed to initialize");
if (!FromConfig(conf))
throw std::runtime_error("FromConfig() failed");

@ -344,7 +344,7 @@ namespace llarp
Close();
bool
Configure(std::shared_ptr<Config> conf, bool isRouter, std::shared_ptr<NodeDB> nodedb) override;
Configure(std::shared_ptr<Config> conf, bool isSNode, std::shared_ptr<NodeDB> nodedb) override;
bool
StartRpcServer() override;

@ -13,12 +13,12 @@ using namespace std::chrono_literals;
namespace tooling
{
void
RouterHive::AddRouter(const std::shared_ptr<llarp::Config>& config, bool isRouter)
RouterHive::AddRouter(const std::shared_ptr<llarp::Config>& config, bool isSNode)
{
auto& container = (isRouter ? relays : clients);
auto& container = (isSNode ? relays : clients);
llarp::RuntimeOptions opts;
opts.isRouter = isRouter;
opts.isSNode = isSNode;
Context_ptr context = std::make_shared<HiveContext>(this);
context->Configure(config);

@ -5,7 +5,7 @@
#include <llarp.hpp>
#include <catch2/catch.hpp>
static const llarp::RuntimeOptions opts = {.background = false, .debug = false, .isRouter = true};
static const llarp::RuntimeOptions opts = {.background = false, .debug = false, .isSNode = true};
std::shared_ptr<llarp::Context>
make_context()

@ -11,7 +11,7 @@ static std::shared_ptr<llarp::Context>
make_context(std::optional<fs::path> keyfile)
{
auto conf = std::make_shared<llarp::Config>(fs::current_path());
conf->Load(std::nullopt, opts.isRouter);
conf->Load(std::nullopt, opts.isSNode);
conf->network.m_endpointType = "null";
conf->network.m_keyfile = keyfile;
conf->bootstrap.seednode = true;

Loading…
Cancel
Save