diff --git a/llarp/config/config.cpp b/llarp/config/config.cpp index 56e11f462..5ad6a6366 100644 --- a/llarp/config/config.cpp +++ b/llarp/config/config.cpp @@ -143,6 +143,7 @@ namespace llarp else { m_enablePeerStats = true; + m_isRelay = true; } } diff --git a/llarp/config/config.hpp b/llarp/config/config.hpp index 5f92571e9..99e54df81 100644 --- a/llarp/config/config.hpp +++ b/llarp/config/config.hpp @@ -63,6 +63,7 @@ namespace llarp std::string m_transportKeyFile; bool m_enablePeerStats = false; + bool m_isRelay = false; void defineConfigOptions(ConfigDefinition& conf, const ConfigGenParameters& params); diff --git a/llarp/router/router.cpp b/llarp/router/router.cpp index 7bbc82ecf..2c828908b 100644 --- a/llarp/router/router.cpp +++ b/llarp/router/router.cpp @@ -449,11 +449,7 @@ namespace llarp if (usingSNSeed) ident_keyfile = conf.lokid.ident_keyfile; - // TODO: add config flag for "is service node" - if (conf.links.m_InboundLinks.size()) - { - m_isServiceNode = true; - } + m_isServiceNode = conf.router.m_isRelay; networkConfig = conf.network; @@ -966,6 +962,12 @@ namespace llarp } }); + if (IsServiceNode() and not _rc.IsPublicRouter()) + { + LogError("we are configured as relay but have no reachable addresses"); + return false; + } + // set public encryption key _rc.enckey = seckey_topublic(encryption());