Merge pull request #1387 from jagerman/net-if-default

Set default inbound link to best public interface
pull/1388/head v0.8.0
Jason Rhinelander 4 years ago committed by GitHub
commit b67df3aaf3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -27,12 +27,13 @@ namespace llarp
constexpr int DefaultMinConnectionsForClient = 4;
constexpr int DefaultMaxConnectionsForClient = 6;
constexpr int DefaultPublicPort = 1090;
void
RouterConfig::defineConfigOptions(ConfigDefinition& conf, const ConfigGenParameters& params)
{
constexpr int DefaultJobQueueSize = 1024 * 8;
constexpr auto DefaultNetId = "lokinet";
constexpr int DefaultPublicPort = 1090;
constexpr int DefaultWorkerThreads = 1;
constexpr int DefaultNetThreads = 1;
constexpr bool DefaultBlockBogons = true;
@ -443,8 +444,19 @@ namespace llarp
m_OutboundLink = LinkInfoFromINIValues("*", arg);
});
if (std::string best_if; GetBestNetIF(best_if))
m_InboundLinks.push_back(LinkInfoFromINIValues(best_if, std::to_string(DefaultPublicPort)));
conf.addUndeclaredHandler(
"bind", [&](std::string_view, std::string_view name, std::string_view value) {
"bind",
[&, defaulted = true](
std::string_view, std::string_view name, std::string_view value) mutable {
if (defaulted)
{
m_InboundLinks.clear(); // Clear the default
defaulted = false;
}
LinkInfo info = LinkInfoFromINIValues(name, value);
if (info.port <= 0)

Loading…
Cancel
Save