Browse Source

remove SSU address if SSU is off

pull/1786/head
orignal 2 years ago
parent
commit
3dd78a2589
  1. 1
      daemon/Daemon.cpp
  2. 12
      libi2pd/RouterContext.cpp
  3. 1
      libi2pd/RouterContext.h

1
daemon/Daemon.cpp

@ -253,6 +253,7 @@ namespace util
if (!ipv4 && !ipv6) if (!ipv4 && !ipv6)
i2p::context.SetStatus (eRouterStatusMesh); i2p::context.SetStatus (eRouterStatusMesh);
} }
if (!ssu) i2p::context.RemoveSSUAddress (); // TODO: remove later
bool ssu2; i2p::config::GetOption("ssu2.enabled", ssu2); bool ssu2; i2p::config::GetOption("ssu2.enabled", ssu2);
if (ssu2) if (ssu2)
{ {

12
libi2pd/RouterContext.cpp

@ -628,6 +628,18 @@ namespace i2p
} }
} }
void RouterContext::RemoveSSUAddress ()
{
auto& addresses = m_RouterInfo.GetAddresses ();
for (auto it = addresses.begin (); it != addresses.end ();)
{
if ((*it)->transportStyle == i2p::data::RouterInfo::eTransportSSU)
it = addresses.erase (it);
else
++it;
}
}
void RouterContext::SetUnreachableSSU2 (bool v4, bool v6) void RouterContext::SetUnreachableSSU2 (bool v4, bool v6)
{ {
if (IsSSU2Only ()) if (IsSSU2Only ())

1
libi2pd/RouterContext.h

@ -123,6 +123,7 @@ namespace garlic
void PublishSSU2Address (int port, bool publish, bool v4, bool v6); void PublishSSU2Address (int port, bool publish, bool v4, bool v6);
void UpdateSSU2Address (bool enable); void UpdateSSU2Address (bool enable);
void RemoveNTCPAddress (bool v4only = true); // delete NTCP address for older routers. TODO: remove later void RemoveNTCPAddress (bool v4only = true); // delete NTCP address for older routers. TODO: remove later
void RemoveSSUAddress (); // delete SSU address for older routers
bool AddIntroducer (const i2p::data::RouterInfo::Introducer& introducer); bool AddIntroducer (const i2p::data::RouterInfo::Introducer& introducer);
void RemoveIntroducer (const boost::asio::ip::udp::endpoint& e); void RemoveIntroducer (const boost::asio::ip::udp::endpoint& e);
bool AddSSU2Introducer (const i2p::data::RouterInfo::Introducer& introducer, bool v4); bool AddSSU2Introducer (const i2p::data::RouterInfo::Introducer& introducer, bool v4);

Loading…
Cancel
Save