diff --git a/Daemon.cpp b/Daemon.cpp index cbfaf31f..dbc65053 100644 --- a/Daemon.cpp +++ b/Daemon.cpp @@ -77,6 +77,9 @@ namespace i2p if (i2p::util::config::GetArg("-unreachable", 0)) i2p::context.SetUnreachable (); + if (i2p::util::config::GetArg("-floodfill", 0)) + i2p::context.SetFloodfill (true); + i2p::context.SetSupportsV6 (i2p::util::config::GetArg("-v6", 0)); LogPrint("CMD parameters:"); diff --git a/RouterContext.cpp b/RouterContext.cpp index 90f804df..2d42d3da 100644 --- a/RouterContext.cpp +++ b/RouterContext.cpp @@ -13,7 +13,8 @@ namespace i2p RouterContext context; RouterContext::RouterContext (): - m_LastUpdateTime (0), m_IsUnreachable (false), m_AcceptsTunnels (true) + m_LastUpdateTime (0), m_IsUnreachable (false), m_AcceptsTunnels (true), + m_IsFloodfill (false) { } @@ -107,6 +108,16 @@ namespace i2p UpdateRouterInfo (); } + void RouterContext::SetFloodfill (bool floodfill) + { + m_IsFloodfill = floodfill; + if (floodfill) + m_RouterInfo.SetCaps (m_RouterInfo.GetCaps () | i2p::data::RouterInfo::eFloodfill); + else + m_RouterInfo.SetCaps (m_RouterInfo.GetCaps () & ~i2p::data::RouterInfo::eFloodfill); + UpdateRouterInfo (); + } + void RouterContext::SetUnreachable () { m_IsUnreachable = true; diff --git a/RouterContext.h b/RouterContext.h index 80928901..10512d67 100644 --- a/RouterContext.h +++ b/RouterContext.h @@ -37,7 +37,9 @@ namespace i2p bool AddIntroducer (const i2p::data::RouterInfo& routerInfo, uint32_t tag); void RemoveIntroducer (const boost::asio::ip::udp::endpoint& e); bool IsUnreachable () const { return m_IsUnreachable; }; - void SetUnreachable (); + void SetUnreachable (); + bool IsFloodfill () const { return m_IsFloodfill; }; + void SetFloodfill (bool floodfill); bool AcceptsTunnels () const { return m_AcceptsTunnels; }; void SetAcceptsTunnels (bool acceptsTunnels) { m_AcceptsTunnels = acceptsTunnels; }; bool SupportsV6 () const { return m_RouterInfo.IsV6 (); }; @@ -68,7 +70,7 @@ namespace i2p i2p::data::PrivateKeys m_Keys; CryptoPP::AutoSeededRandomPool m_Rnd; uint64_t m_LastUpdateTime; - bool m_IsUnreachable, m_AcceptsTunnels; + bool m_IsUnreachable, m_AcceptsTunnels, m_IsFloodfill; }; extern RouterContext context; diff --git a/RouterInfo.cpp b/RouterInfo.cpp index 91f793fb..56a9327a 100644 --- a/RouterInfo.cpp +++ b/RouterInfo.cpp @@ -276,8 +276,13 @@ namespace data void RouterInfo::UpdateCapsProperty () { std::string caps; - caps += (m_Caps & eHighBandwidth) ? CAPS_FLAG_HIGH_BANDWIDTH1 : CAPS_FLAG_LOW_BANDWIDTH2; // bandwidth - if (m_Caps & eFloodfill) caps += CAPS_FLAG_FLOODFILL; // floodfill + if (m_Caps & eFloodfill) + { + caps += CAPS_FLAG_HIGH_BANDWIDTH3; // highest bandwidth + caps += CAPS_FLAG_FLOODFILL; // floodfill + } + else + caps += (m_Caps & eHighBandwidth) ? CAPS_FLAG_HIGH_BANDWIDTH1 : CAPS_FLAG_LOW_BANDWIDTH2; // bandwidth if (m_Caps & eHidden) caps += CAPS_FLAG_HIDDEN; // hidden if (m_Caps & eReachable) caps += CAPS_FLAG_REACHABLE; // reachable if (m_Caps & eUnreachable) caps += CAPS_FLAG_UNREACHABLE; // unreachable