mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 08:14:15 +00:00
use only SSU2 for network status
This commit is contained in:
parent
7705423c42
commit
ccfeca728e
@ -63,7 +63,6 @@ namespace i2p
|
|||||||
if (!port) port = SelectRandomPort ();
|
if (!port) port = SelectRandomPort ();
|
||||||
bool ipv4; i2p::config::GetOption("ipv4", ipv4);
|
bool ipv4; i2p::config::GetOption("ipv4", ipv4);
|
||||||
bool ipv6; i2p::config::GetOption("ipv6", ipv6);
|
bool ipv6; i2p::config::GetOption("ipv6", ipv6);
|
||||||
bool ssu; i2p::config::GetOption("ssu", ssu);
|
|
||||||
bool ntcp2; i2p::config::GetOption("ntcp2.enabled", ntcp2);
|
bool ntcp2; i2p::config::GetOption("ntcp2.enabled", ntcp2);
|
||||||
bool ssu2; i2p::config::GetOption("ssu2.enabled", ssu2);
|
bool ssu2; i2p::config::GetOption("ssu2.enabled", ssu2);
|
||||||
bool ygg; i2p::config::GetOption("meshnets.yggdrasil", ygg);
|
bool ygg; i2p::config::GetOption("meshnets.yggdrasil", ygg);
|
||||||
@ -109,17 +108,12 @@ namespace i2p
|
|||||||
routerInfo.AddNTCP2Address (m_NTCP2Keys->staticPublicKey, m_NTCP2Keys->iv);
|
routerInfo.AddNTCP2Address (m_NTCP2Keys->staticPublicKey, m_NTCP2Keys->iv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ssu)
|
|
||||||
{
|
|
||||||
routerInfo.AddSSUAddress (host.c_str(), port, nullptr);
|
|
||||||
caps |= i2p::data::RouterInfo::eReachable; // R
|
|
||||||
}
|
|
||||||
if (ssu2)
|
if (ssu2)
|
||||||
{
|
{
|
||||||
if (ssu2Published)
|
if (ssu2Published)
|
||||||
{
|
{
|
||||||
uint16_t ssu2Port; i2p::config::GetOption ("ssu2.port", ssu2Port);
|
uint16_t ssu2Port; i2p::config::GetOption ("ssu2.port", ssu2Port);
|
||||||
if (!ssu2Port) ssu2Port = ssu ? (port + 1) : port;
|
if (!ssu2Port) ssu2Port = port;
|
||||||
routerInfo.AddSSU2Address (m_SSU2Keys->staticPublicKey, m_SSU2Keys->intro, boost::asio::ip::address_v4::from_string (host), ssu2Port);
|
routerInfo.AddSSU2Address (m_SSU2Keys->staticPublicKey, m_SSU2Keys->intro, boost::asio::ip::address_v4::from_string (host), ssu2Port);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -158,17 +152,12 @@ namespace i2p
|
|||||||
addressCaps |= i2p::data::RouterInfo::AddressCaps::eV6;
|
addressCaps |= i2p::data::RouterInfo::AddressCaps::eV6;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ssu)
|
|
||||||
{
|
|
||||||
routerInfo.AddSSUAddress (host.c_str(), port, nullptr);
|
|
||||||
caps |= i2p::data::RouterInfo::eReachable; // R
|
|
||||||
}
|
|
||||||
if (ssu2)
|
if (ssu2)
|
||||||
{
|
{
|
||||||
if (ssu2Published)
|
if (ssu2Published)
|
||||||
{
|
{
|
||||||
uint16_t ssu2Port; i2p::config::GetOption ("ssu2.port", ssu2Port);
|
uint16_t ssu2Port; i2p::config::GetOption ("ssu2.port", ssu2Port);
|
||||||
if (!ssu2Port) ssu2Port = ssu ? (port + 1) : port;
|
if (!ssu2Port) ssu2Port = port;
|
||||||
routerInfo.AddSSU2Address (m_SSU2Keys->staticPublicKey, m_SSU2Keys->intro, boost::asio::ip::address_v6::from_string (host), ssu2Port);
|
routerInfo.AddSSU2Address (m_SSU2Keys->staticPublicKey, m_SSU2Keys->intro, boost::asio::ip::address_v6::from_string (host), ssu2Port);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -236,13 +225,6 @@ namespace i2p
|
|||||||
fk.write ((char *)m_SSU2Keys.get (), sizeof (SSU2PrivateKeys));
|
fk.write ((char *)m_SSU2Keys.get (), sizeof (SSU2PrivateKeys));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RouterContext::IsSSU2Only () const
|
|
||||||
{
|
|
||||||
auto transports = m_RouterInfo.GetCompatibleTransports (false);
|
|
||||||
return (transports & (i2p::data::RouterInfo::eSSU2V4 | i2p::data::RouterInfo::eSSU2V6)) &&
|
|
||||||
!(transports & (i2p::data::RouterInfo::eSSUV4 | i2p::data::RouterInfo::eSSUV6));
|
|
||||||
}
|
|
||||||
|
|
||||||
void RouterContext::SetStatus (RouterStatus status)
|
void RouterContext::SetStatus (RouterStatus status)
|
||||||
{
|
{
|
||||||
if (status != m_Status)
|
if (status != m_Status)
|
||||||
@ -262,13 +244,7 @@ namespace i2p
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RouterContext::SetStatusSSU2 (RouterStatus status)
|
|
||||||
{
|
|
||||||
if (IsSSU2Only ())
|
|
||||||
SetStatus (status);
|
|
||||||
}
|
|
||||||
|
|
||||||
void RouterContext::SetStatusV6 (RouterStatus status)
|
void RouterContext::SetStatusV6 (RouterStatus status)
|
||||||
{
|
{
|
||||||
if (status != m_StatusV6)
|
if (status != m_StatusV6)
|
||||||
@ -288,19 +264,13 @@ namespace i2p
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RouterContext::SetStatusV6SSU2 (RouterStatus status)
|
|
||||||
{
|
|
||||||
if (IsSSU2Only ())
|
|
||||||
SetStatusV6 (status);
|
|
||||||
}
|
|
||||||
|
|
||||||
void RouterContext::UpdatePort (int port)
|
void RouterContext::UpdatePort (int port)
|
||||||
{
|
{
|
||||||
bool updated = false;
|
bool updated = false;
|
||||||
for (auto& address : m_RouterInfo.GetAddresses ())
|
for (auto& address : m_RouterInfo.GetAddresses ())
|
||||||
{
|
{
|
||||||
if (address->port != port && (address->transportStyle == i2p::data::RouterInfo::eTransportSSU || IsSSU2Only ()))
|
if (address->port != port && address->transportStyle == i2p::data::RouterInfo::eTransportSSU2)
|
||||||
{
|
{
|
||||||
address->port = port;
|
address->port = port;
|
||||||
updated = true;
|
updated = true;
|
||||||
@ -476,8 +446,6 @@ namespace i2p
|
|||||||
mtu = maxMTU;
|
mtu = maxMTU;
|
||||||
LogPrint(eLogWarning, "Router: MTU dropped to upper limit of ", maxMTU, " bytes");
|
LogPrint(eLogWarning, "Router: MTU dropped to upper limit of ", maxMTU, " bytes");
|
||||||
}
|
}
|
||||||
if (mtu && !address->IsSSU2 ()) // SSU1
|
|
||||||
mtu = (mtu >> 4) << 4; // round to multiple of 16
|
|
||||||
address->ssu->mtu = mtu;
|
address->ssu->mtu = mtu;
|
||||||
updated = true;
|
updated = true;
|
||||||
}
|
}
|
||||||
@ -488,23 +456,8 @@ namespace i2p
|
|||||||
UpdateRouterInfo ();
|
UpdateRouterInfo ();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RouterContext::AddIntroducer (const i2p::data::RouterInfo::Introducer& introducer)
|
|
||||||
{
|
|
||||||
bool ret = m_RouterInfo.AddIntroducer (introducer);
|
|
||||||
if (ret)
|
|
||||||
UpdateRouterInfo ();
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
void RouterContext::RemoveIntroducer (const boost::asio::ip::udp::endpoint& e)
|
|
||||||
{
|
|
||||||
if (m_RouterInfo.RemoveIntroducer (e))
|
|
||||||
UpdateRouterInfo ();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool RouterContext::AddSSU2Introducer (const i2p::data::RouterInfo::Introducer& introducer, bool v4)
|
bool RouterContext::AddSSU2Introducer (const i2p::data::RouterInfo::Introducer& introducer, bool v4)
|
||||||
{
|
{
|
||||||
if (!IsSSU2Only ()) return false;
|
|
||||||
bool ret = m_RouterInfo.AddSSU2Introducer (introducer, v4);
|
bool ret = m_RouterInfo.AddSSU2Introducer (introducer, v4);
|
||||||
if (ret)
|
if (ret)
|
||||||
UpdateRouterInfo ();
|
UpdateRouterInfo ();
|
||||||
@ -513,7 +466,6 @@ namespace i2p
|
|||||||
|
|
||||||
void RouterContext::RemoveSSU2Introducer (const i2p::data::IdentHash& h, bool v4)
|
void RouterContext::RemoveSSU2Introducer (const i2p::data::IdentHash& h, bool v4)
|
||||||
{
|
{
|
||||||
if (!IsSSU2Only ()) return;
|
|
||||||
if (m_RouterInfo.RemoveSSU2Introducer (h, v4))
|
if (m_RouterInfo.RemoveSSU2Introducer (h, v4))
|
||||||
UpdateRouterInfo ();
|
UpdateRouterInfo ();
|
||||||
}
|
}
|
||||||
@ -669,12 +621,6 @@ namespace i2p
|
|||||||
m_RouterInfo.UpdateSupportedTransports ();
|
m_RouterInfo.UpdateSupportedTransports ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RouterContext::SetUnreachableSSU2 (bool v4, bool v6)
|
|
||||||
{
|
|
||||||
if (IsSSU2Only ())
|
|
||||||
SetUnreachable (v4, v6);
|
|
||||||
}
|
|
||||||
|
|
||||||
void RouterContext::SetUnreachable (bool v4, bool v6)
|
void RouterContext::SetUnreachable (bool v4, bool v6)
|
||||||
{
|
{
|
||||||
if (v4 || (v6 && !SupportsV4 ()))
|
if (v4 || (v6 && !SupportsV4 ()))
|
||||||
@ -691,8 +637,7 @@ namespace i2p
|
|||||||
// delete previous introducers
|
// delete previous introducers
|
||||||
auto& addresses = m_RouterInfo.GetAddresses ();
|
auto& addresses = m_RouterInfo.GetAddresses ();
|
||||||
for (auto& addr : addresses)
|
for (auto& addr : addresses)
|
||||||
if (addr->ssu && (!addr->IsSSU2 () || IsSSU2Only ()) &&
|
if (addr->ssu && ((v4 && addr->IsV4 ()) || (v6 && addr->IsV6 ())))
|
||||||
((v4 && addr->IsV4 ()) || (v6 && addr->IsV6 ())))
|
|
||||||
{
|
{
|
||||||
addr->published = false;
|
addr->published = false;
|
||||||
addr->caps &= ~i2p::data::RouterInfo::eSSUIntroducer; // can't be introducer
|
addr->caps &= ~i2p::data::RouterInfo::eSSUIntroducer; // can't be introducer
|
||||||
@ -722,19 +667,15 @@ namespace i2p
|
|||||||
}
|
}
|
||||||
uint16_t port = 0;
|
uint16_t port = 0;
|
||||||
// delete previous introducers
|
// delete previous introducers
|
||||||
bool isSSU2Published = IsSSU2Only (); // TODO
|
bool isSSU2Published; i2p::config::GetOption ("ssu2.published", isSSU2Published);
|
||||||
if (isSSU2Published)
|
|
||||||
i2p::config::GetOption ("ssu2.published", isSSU2Published);
|
|
||||||
auto& addresses = m_RouterInfo.GetAddresses ();
|
auto& addresses = m_RouterInfo.GetAddresses ();
|
||||||
for (auto& addr : addresses)
|
for (auto& addr : addresses)
|
||||||
if (addr->ssu && (!addr->IsSSU2 () || isSSU2Published) &&
|
if (addr->ssu && isSSU2Published && ((v4 && addr->IsV4 ()) || (v6 && addr->IsV6 ())))
|
||||||
((v4 && addr->IsV4 ()) || (v6 && addr->IsV6 ())))
|
|
||||||
{
|
{
|
||||||
addr->published = true;
|
addr->published = true;
|
||||||
addr->caps |= i2p::data::RouterInfo::eSSUIntroducer;
|
addr->caps |= i2p::data::RouterInfo::eSSUIntroducer;
|
||||||
addr->ssu->introducers.clear ();
|
addr->ssu->introducers.clear ();
|
||||||
if (addr->port && (!addr->IsSSU2 () || IsSSU2Only ()))
|
if (addr->port) port = addr->port;
|
||||||
port = addr->port;
|
|
||||||
}
|
}
|
||||||
// publish NTCP2
|
// publish NTCP2
|
||||||
bool ntcp2; i2p::config::GetOption("ntcp2.enabled", ntcp2);
|
bool ntcp2; i2p::config::GetOption("ntcp2.enabled", ntcp2);
|
||||||
@ -758,7 +699,7 @@ namespace i2p
|
|||||||
if (supportsV6)
|
if (supportsV6)
|
||||||
{
|
{
|
||||||
// insert v6 addresses if necessary
|
// insert v6 addresses if necessary
|
||||||
bool foundSSU = false, foundNTCP2 = false, foundSSU2 = false;
|
bool foundNTCP2 = false, foundSSU2 = false;
|
||||||
uint16_t port = 0;
|
uint16_t port = 0;
|
||||||
auto& addresses = m_RouterInfo.GetAddresses ();
|
auto& addresses = m_RouterInfo.GetAddresses ();
|
||||||
for (auto& addr: addresses)
|
for (auto& addr: addresses)
|
||||||
@ -767,9 +708,6 @@ namespace i2p
|
|||||||
{
|
{
|
||||||
switch (addr->transportStyle)
|
switch (addr->transportStyle)
|
||||||
{
|
{
|
||||||
case i2p::data::RouterInfo::eTransportSSU:
|
|
||||||
foundSSU = true;
|
|
||||||
break;
|
|
||||||
case i2p::data::RouterInfo::eTransportNTCP:
|
case i2p::data::RouterInfo::eTransportNTCP:
|
||||||
foundNTCP2 = true;
|
foundNTCP2 = true;
|
||||||
break;
|
break;
|
||||||
@ -786,13 +724,6 @@ namespace i2p
|
|||||||
i2p::config::GetOption("port", port);
|
i2p::config::GetOption("port", port);
|
||||||
if (!port) port = SelectRandomPort ();
|
if (!port) port = SelectRandomPort ();
|
||||||
}
|
}
|
||||||
// SSU
|
|
||||||
bool ssu; i2p::config::GetOption("ssu", ssu);
|
|
||||||
if (!foundSSU && ssu)
|
|
||||||
{
|
|
||||||
std::string host = "::1"; // TODO: read host
|
|
||||||
m_RouterInfo.AddSSUAddress (host.c_str (), port, nullptr);
|
|
||||||
}
|
|
||||||
// NTCP2
|
// NTCP2
|
||||||
if (!foundNTCP2)
|
if (!foundNTCP2)
|
||||||
{
|
{
|
||||||
@ -825,7 +756,7 @@ namespace i2p
|
|||||||
if (ssu2Published)
|
if (ssu2Published)
|
||||||
{
|
{
|
||||||
uint16_t ssu2Port; i2p::config::GetOption ("ssu2.port", ssu2Port);
|
uint16_t ssu2Port; i2p::config::GetOption ("ssu2.port", ssu2Port);
|
||||||
if (!ssu2Port) ssu2Port = ssu ? (port + 1) : port;
|
if (!ssu2Port) ssu2Port = port;
|
||||||
m_RouterInfo.AddSSU2Address (m_SSU2Keys->staticPublicKey, m_SSU2Keys->intro, boost::asio::ip::address::from_string ("::1"), ssu2Port);
|
m_RouterInfo.AddSSU2Address (m_SSU2Keys->staticPublicKey, m_SSU2Keys->intro, boost::asio::ip::address::from_string ("::1"), ssu2Port);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -847,7 +778,7 @@ namespace i2p
|
|||||||
// update
|
// update
|
||||||
if (supportsV4)
|
if (supportsV4)
|
||||||
{
|
{
|
||||||
bool foundSSU = false, foundNTCP2 = false, foundSSU2 = false;
|
bool foundNTCP2 = false, foundSSU2 = false;
|
||||||
std::string host = "127.0.0.1";
|
std::string host = "127.0.0.1";
|
||||||
uint16_t port = 0;
|
uint16_t port = 0;
|
||||||
auto& addresses = m_RouterInfo.GetAddresses ();
|
auto& addresses = m_RouterInfo.GetAddresses ();
|
||||||
@ -857,9 +788,6 @@ namespace i2p
|
|||||||
{
|
{
|
||||||
switch (addr->transportStyle)
|
switch (addr->transportStyle)
|
||||||
{
|
{
|
||||||
case i2p::data::RouterInfo::eTransportSSU:
|
|
||||||
foundSSU = true;
|
|
||||||
break;
|
|
||||||
case i2p::data::RouterInfo::eTransportNTCP:
|
case i2p::data::RouterInfo::eTransportNTCP:
|
||||||
foundNTCP2 = true;
|
foundNTCP2 = true;
|
||||||
break;
|
break;
|
||||||
@ -876,11 +804,6 @@ namespace i2p
|
|||||||
i2p::config::GetOption("port", port);
|
i2p::config::GetOption("port", port);
|
||||||
if (!port) port = SelectRandomPort ();
|
if (!port) port = SelectRandomPort ();
|
||||||
}
|
}
|
||||||
// SSU
|
|
||||||
bool ssu; i2p::config::GetOption("ssu", ssu);
|
|
||||||
if (!foundSSU && ssu)
|
|
||||||
m_RouterInfo.AddSSUAddress (host.c_str (), port, nullptr);
|
|
||||||
|
|
||||||
// NTCP2
|
// NTCP2
|
||||||
if (!foundNTCP2)
|
if (!foundNTCP2)
|
||||||
{
|
{
|
||||||
@ -908,7 +831,7 @@ namespace i2p
|
|||||||
if (ssu2Published)
|
if (ssu2Published)
|
||||||
{
|
{
|
||||||
uint16_t ssu2Port; i2p::config::GetOption ("ssu2.port", ssu2Port);
|
uint16_t ssu2Port; i2p::config::GetOption ("ssu2.port", ssu2Port);
|
||||||
if (!ssu2Port) ssu2Port = ssu ? (port + 1) : port;
|
if (!ssu2Port) ssu2Port = port;
|
||||||
m_RouterInfo.AddSSU2Address (m_SSU2Keys->staticPublicKey, m_SSU2Keys->intro, boost::asio::ip::address::from_string ("127.0.0.1"), ssu2Port);
|
m_RouterInfo.AddSSU2Address (m_SSU2Keys->staticPublicKey, m_SSU2Keys->intro, boost::asio::ip::address::from_string ("127.0.0.1"), ssu2Port);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -956,32 +879,9 @@ namespace i2p
|
|||||||
for (auto& addr: addresses)
|
for (auto& addr: addresses)
|
||||||
{
|
{
|
||||||
if (addr->ssu && ((v4 && addr->IsV4 ()) || (!v4 && addr->IsV6 ())))
|
if (addr->ssu && ((v4 && addr->IsV4 ()) || (!v4 && addr->IsV6 ())))
|
||||||
{
|
{
|
||||||
if (!addr->IsSSU2 ()) // SSU1
|
addr->ssu->mtu = mtu;
|
||||||
{
|
LogPrint (eLogDebug, "Router: MTU for ", v4 ? "ipv4" : "ipv6", " address ", addr->host.to_string(), " is set to ", mtu);
|
||||||
// round to multiple of 16
|
|
||||||
if (v4)
|
|
||||||
{
|
|
||||||
if (mtu > 1484) mtu = 1484;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mtu -= 12;
|
|
||||||
mtu = (mtu >> 4) << 4;
|
|
||||||
mtu += 12;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (mtu > 1488) mtu = 1488;
|
|
||||||
else
|
|
||||||
mtu = (mtu >> 4) << 4;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (mtu)
|
|
||||||
{
|
|
||||||
addr->ssu->mtu = mtu;
|
|
||||||
LogPrint (eLogDebug, "Router: MTU for ", v4 ? "ipv4" : "ipv6", " address ", addr->host.to_string(), " is set to ", mtu);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -102,12 +102,10 @@ namespace garlic
|
|||||||
uint64_t GetTransitBandwidthLimit () const { return (m_BandwidthLimit*m_ShareRatio)/100LL; };
|
uint64_t GetTransitBandwidthLimit () const { return (m_BandwidthLimit*m_ShareRatio)/100LL; };
|
||||||
RouterStatus GetStatus () const { return m_Status; };
|
RouterStatus GetStatus () const { return m_Status; };
|
||||||
void SetStatus (RouterStatus status);
|
void SetStatus (RouterStatus status);
|
||||||
void SetStatusSSU2 (RouterStatus status);
|
|
||||||
RouterError GetError () const { return m_Error; };
|
RouterError GetError () const { return m_Error; };
|
||||||
void SetError (RouterError error) { m_Error = error; };
|
void SetError (RouterError error) { m_Error = error; };
|
||||||
RouterStatus GetStatusV6 () const { return m_StatusV6; };
|
RouterStatus GetStatusV6 () const { return m_StatusV6; };
|
||||||
void SetStatusV6 (RouterStatus status);
|
void SetStatusV6 (RouterStatus status);
|
||||||
void SetStatusV6SSU2 (RouterStatus status);
|
|
||||||
RouterError GetErrorV6 () const { return m_ErrorV6; };
|
RouterError GetErrorV6 () const { return m_ErrorV6; };
|
||||||
void SetErrorV6 (RouterError error) { m_ErrorV6 = error; };
|
void SetErrorV6 (RouterError error) { m_ErrorV6 = error; };
|
||||||
int GetNetID () const { return m_NetID; };
|
int GetNetID () const { return m_NetID; };
|
||||||
@ -123,14 +121,11 @@ namespace garlic
|
|||||||
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
|
void RemoveSSUAddress (); // delete SSU address for older routers
|
||||||
bool AddIntroducer (const i2p::data::RouterInfo::Introducer& introducer);
|
|
||||||
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);
|
||||||
void RemoveSSU2Introducer (const i2p::data::IdentHash& h, bool v4);
|
void RemoveSSU2Introducer (const i2p::data::IdentHash& h, bool v4);
|
||||||
void ClearSSU2Introducers (bool v4);
|
void ClearSSU2Introducers (bool v4);
|
||||||
bool IsUnreachable () const;
|
bool IsUnreachable () const;
|
||||||
void SetUnreachable (bool v4, bool v6);
|
void SetUnreachable (bool v4, bool v6);
|
||||||
void SetUnreachableSSU2 (bool v4, bool v6);
|
|
||||||
void SetReachable (bool v4, bool v6);
|
void SetReachable (bool v4, bool v6);
|
||||||
bool IsFloodfill () const { return m_IsFloodfill; };
|
bool IsFloodfill () const { return m_IsFloodfill; };
|
||||||
void SetFloodfill (bool floodfill);
|
void SetFloodfill (bool floodfill);
|
||||||
|
@ -68,9 +68,8 @@ namespace transport
|
|||||||
if (ssu2Port) port = ssu2Port;
|
if (ssu2Port) port = ssu2Port;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bool ssu; i2p::config::GetOption("ssu", ssu);
|
|
||||||
uint16_t p; i2p::config::GetOption ("port", p);
|
uint16_t p; i2p::config::GetOption ("port", p);
|
||||||
if (p) port = ssu ? (p + 1) : p;
|
if (p) port = p;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (port)
|
if (port)
|
||||||
@ -1068,7 +1067,7 @@ namespace transport
|
|||||||
// we are firewalled
|
// we are firewalled
|
||||||
auto addr = i2p::context.GetRouterInfo ().GetSSU2V4Address ();
|
auto addr = i2p::context.GetRouterInfo ().GetSSU2V4Address ();
|
||||||
if (addr && addr->ssu && addr->ssu->introducers.empty ())
|
if (addr && addr->ssu && addr->ssu->introducers.empty ())
|
||||||
i2p::context.SetUnreachableSSU2 (true, false); // v4
|
i2p::context.SetUnreachable (true, false); // v4
|
||||||
|
|
||||||
UpdateIntroducers (true);
|
UpdateIntroducers (true);
|
||||||
ScheduleIntroducersUpdateTimer ();
|
ScheduleIntroducersUpdateTimer ();
|
||||||
@ -1091,7 +1090,7 @@ namespace transport
|
|||||||
// we are firewalled
|
// we are firewalled
|
||||||
auto addr = i2p::context.GetRouterInfo ().GetSSU2V6Address ();
|
auto addr = i2p::context.GetRouterInfo ().GetSSU2V6Address ();
|
||||||
if (addr && addr->ssu && addr->ssu->introducers.empty ())
|
if (addr && addr->ssu && addr->ssu->introducers.empty ())
|
||||||
i2p::context.SetUnreachableSSU2 (false, true); // v6
|
i2p::context.SetUnreachable (false, true); // v6
|
||||||
|
|
||||||
UpdateIntroducers (false);
|
UpdateIntroducers (false);
|
||||||
ScheduleIntroducersUpdateTimerV6 ();
|
ScheduleIntroducersUpdateTimerV6 ();
|
||||||
|
@ -2266,9 +2266,9 @@ namespace transport
|
|||||||
if (m_Address)
|
if (m_Address)
|
||||||
{
|
{
|
||||||
if (m_Address->IsV4 ())
|
if (m_Address->IsV4 ())
|
||||||
i2p::context.SetStatusSSU2 (status);
|
i2p::context.SetStatus (status);
|
||||||
else if (m_Address->IsV6 ())
|
else if (m_Address->IsV6 ())
|
||||||
i2p::context.SetStatusV6SSU2 (status);
|
i2p::context.SetStatusV6 (status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -616,7 +616,7 @@ namespace transport
|
|||||||
if (router)
|
if (router)
|
||||||
{
|
{
|
||||||
if (i2p::context.GetStatus () != eRouterStatusTesting)
|
if (i2p::context.GetStatus () != eRouterStatusTesting)
|
||||||
i2p::context.SetStatusSSU2 (eRouterStatusTesting);
|
i2p::context.SetStatus (eRouterStatusTesting);
|
||||||
m_SSU2Server->StartPeerTest (router, true);
|
m_SSU2Server->StartPeerTest (router, true);
|
||||||
excluded.insert (router->GetIdentHash ());
|
excluded.insert (router->GetIdentHash ());
|
||||||
}
|
}
|
||||||
@ -635,7 +635,7 @@ namespace transport
|
|||||||
if (router)
|
if (router)
|
||||||
{
|
{
|
||||||
if (i2p::context.GetStatusV6 () != eRouterStatusTesting)
|
if (i2p::context.GetStatusV6 () != eRouterStatusTesting)
|
||||||
i2p::context.SetStatusV6SSU2 (eRouterStatusTesting);
|
i2p::context.SetStatusV6 (eRouterStatusTesting);
|
||||||
m_SSU2Server->StartPeerTest (router, false);
|
m_SSU2Server->StartPeerTest (router, false);
|
||||||
excluded.insert (router->GetIdentHash ());
|
excluded.insert (router->GetIdentHash ());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user