From 70eb353c42c54f3b596ae9c586b06f06712ecd83 Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Tue, 11 Feb 2020 16:48:36 -0500 Subject: [PATCH] make publishing introsets optional using reachable=false to disable --- llarp/handlers/tun.cpp | 8 ++++++++ llarp/service/endpoint.cpp | 2 ++ llarp/service/endpoint.hpp | 1 + 3 files changed, 11 insertions(+) diff --git a/llarp/handlers/tun.cpp b/llarp/handlers/tun.cpp index 80d09007c..9ea113bd3 100644 --- a/llarp/handlers/tun.cpp +++ b/llarp/handlers/tun.cpp @@ -111,6 +111,14 @@ namespace llarp bool TunEndpoint::SetOption(const std::string &k, const std::string &v) { + if(k == "reachable") + { + if(IsFalseValue(v)) + { + m_PublishIntroSet = false; + LogInfo(Name(), " setting to be not reachable by default"); + } + } if(k == "isolate-network" && IsTrueValue(v.c_str())) { #if defined(__linux__) diff --git a/llarp/service/endpoint.cpp b/llarp/service/endpoint.cpp index 8200555fd..41fb08dea 100644 --- a/llarp/service/endpoint.cpp +++ b/llarp/service/endpoint.cpp @@ -544,6 +544,8 @@ namespace llarp bool Endpoint::ShouldPublishDescriptors(llarp_time_t now) const { + if(not m_PublishIntroSet) + return false; // make sure we have all paths that are established // in our introset size_t numNotInIntroset = 0; diff --git a/llarp/service/endpoint.hpp b/llarp/service/endpoint.hpp index c67dc83d1..7bd1fd635 100644 --- a/llarp/service/endpoint.hpp +++ b/llarp/service/endpoint.hpp @@ -438,6 +438,7 @@ namespace llarp hooks::Backend_ptr m_OnUp; hooks::Backend_ptr m_OnDown; hooks::Backend_ptr m_OnReady; + bool m_PublishIntroSet = true; private: void