|
|
|
@ -568,8 +568,22 @@ namespace llarp
|
|
|
|
|
whitelistRouters,
|
|
|
|
|
m_isServiceNode);
|
|
|
|
|
|
|
|
|
|
std::vector<LinksConfig::LinkInfo> inboundLinks = conf.links.m_InboundLinks;
|
|
|
|
|
|
|
|
|
|
if (inboundLinks.empty() and m_isServiceNode)
|
|
|
|
|
{
|
|
|
|
|
const auto& publicAddr = conf.router.m_publicAddress;
|
|
|
|
|
if (publicAddr.isEmpty() or not publicAddr.hasPort())
|
|
|
|
|
{
|
|
|
|
|
throw std::runtime_error(
|
|
|
|
|
"service node enabled but could not find a public IP to bind to; you need to set the "
|
|
|
|
|
"public-ip= and public-port= options");
|
|
|
|
|
}
|
|
|
|
|
inboundLinks.push_back(LinksConfig::LinkInfo{"0.0.0.0", AF_INET, *publicAddr.getPort()});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// create inbound links, if we are a service node
|
|
|
|
|
for (const LinksConfig::LinkInfo& serverConfig : conf.links.m_InboundLinks)
|
|
|
|
|
for (const LinksConfig::LinkInfo& serverConfig : inboundLinks)
|
|
|
|
|
{
|
|
|
|
|
auto server = iwp::NewInboundLink(
|
|
|
|
|
m_keyManager,
|
|
|
|
@ -594,11 +608,6 @@ namespace llarp
|
|
|
|
|
_linkManager.AddLink(std::move(server), true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (conf.links.m_InboundLinks.empty() and m_isServiceNode)
|
|
|
|
|
{
|
|
|
|
|
throw std::runtime_error("service node enabled but have no inbound links");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Network config
|
|
|
|
|
if (conf.network.m_enableProfiling.has_value() and not*conf.network.m_enableProfiling)
|
|
|
|
|
{
|
|
|
|
|