mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-03-10 11:28:27 +01:00
add Yggdrasil adddress even if NTCP2 is not published. Correct reachable capacity
This commit is contained in:
parent
dc64d1738a
commit
2d0e219197
2 changed files with 21 additions and 13 deletions
|
@ -28,7 +28,7 @@ namespace i2p
|
||||||
|
|
||||||
RouterContext::RouterContext ():
|
RouterContext::RouterContext ():
|
||||||
m_LastUpdateTime (0), m_AcceptsTunnels (true), m_IsFloodfill (false),
|
m_LastUpdateTime (0), m_AcceptsTunnels (true), m_IsFloodfill (false),
|
||||||
m_ShareRatio (100), m_Status (eRouterStatusOK),
|
m_ShareRatio (100), m_Status (eRouterStatusUnknown),
|
||||||
m_Error (eRouterErrorNone), m_NetID (I2PD_NET_ID)
|
m_Error (eRouterErrorNone), m_NetID (I2PD_NET_ID)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -77,6 +77,7 @@ namespace i2p
|
||||||
std::string ifname; i2p::config::GetOption("ifname", ifname);
|
std::string ifname; i2p::config::GetOption("ifname", ifname);
|
||||||
std::string ifname4; i2p::config::GetOption("ifname4", ifname4);
|
std::string ifname4; i2p::config::GetOption("ifname4", ifname4);
|
||||||
std::string ifname6; i2p::config::GetOption("ifname6", ifname6);
|
std::string ifname6; i2p::config::GetOption("ifname6", ifname6);
|
||||||
|
uint8_t caps = 0;
|
||||||
if (ipv4)
|
if (ipv4)
|
||||||
{
|
{
|
||||||
std::string host = "127.0.0.1";
|
std::string host = "127.0.0.1";
|
||||||
|
@ -90,7 +91,10 @@ namespace i2p
|
||||||
host = i2p::util::net::GetInterfaceAddress(ifname4, false).to_string();
|
host = i2p::util::net::GetInterfaceAddress(ifname4, false).to_string();
|
||||||
|
|
||||||
if (ssu)
|
if (ssu)
|
||||||
|
{
|
||||||
routerInfo.AddSSUAddress (host.c_str(), port, nullptr);
|
routerInfo.AddSSUAddress (host.c_str(), port, nullptr);
|
||||||
|
caps |= i2p::data::RouterInfo::eReachable | i2p::data::RouterInfo::eSSUTesting | i2p::data::RouterInfo::eSSUIntroducer; // R, BC
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (ipv6)
|
if (ipv6)
|
||||||
{
|
{
|
||||||
|
@ -104,11 +108,13 @@ namespace i2p
|
||||||
host = i2p::util::net::GetInterfaceAddress(ifname6, true).to_string();
|
host = i2p::util::net::GetInterfaceAddress(ifname6, true).to_string();
|
||||||
|
|
||||||
if (ssu)
|
if (ssu)
|
||||||
|
{
|
||||||
routerInfo.AddSSUAddress (host.c_str(), port, nullptr);
|
routerInfo.AddSSUAddress (host.c_str(), port, nullptr);
|
||||||
|
caps |= i2p::data::RouterInfo::eReachable; // R
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
routerInfo.SetCaps (i2p::data::RouterInfo::eReachable |
|
routerInfo.SetCaps (caps); // caps + L
|
||||||
i2p::data::RouterInfo::eSSUTesting | i2p::data::RouterInfo::eSSUIntroducer); // LR, BC
|
|
||||||
routerInfo.SetProperty ("netId", std::to_string (m_NetID));
|
routerInfo.SetProperty ("netId", std::to_string (m_NetID));
|
||||||
routerInfo.SetProperty ("router.version", I2P_VERSION);
|
routerInfo.SetProperty ("router.version", I2P_VERSION);
|
||||||
routerInfo.CreateBuffer (m_Keys);
|
routerInfo.CreateBuffer (m_Keys);
|
||||||
|
@ -132,15 +138,16 @@ namespace i2p
|
||||||
i2p::config::GetOption ("ntcp2.addressv6", host);
|
i2p::config::GetOption ("ntcp2.addressv6", host);
|
||||||
m_RouterInfo.AddNTCP2Address (m_NTCP2Keys->staticPublicKey, m_NTCP2Keys->iv, boost::asio::ip::address_v6::from_string (host), port);
|
m_RouterInfo.AddNTCP2Address (m_NTCP2Keys->staticPublicKey, m_NTCP2Keys->iv, boost::asio::ip::address_v6::from_string (host), port);
|
||||||
}
|
}
|
||||||
if (ygg)
|
}
|
||||||
{
|
}
|
||||||
auto yggaddr = i2p::util::net::GetYggdrasilAddress ();
|
if (ygg)
|
||||||
if (!yggaddr.is_unspecified ())
|
{
|
||||||
{
|
auto yggaddr = i2p::util::net::GetYggdrasilAddress ();
|
||||||
m_RouterInfo.AddNTCP2Address (m_NTCP2Keys->staticPublicKey, m_NTCP2Keys->iv, yggaddr, port);
|
if (!yggaddr.is_unspecified ())
|
||||||
UpdateRouterInfo ();
|
{
|
||||||
}
|
if (!m_NTCP2Keys) NewNTCP2Keys ();
|
||||||
}
|
m_RouterInfo.AddNTCP2Address (m_NTCP2Keys->staticPublicKey, m_NTCP2Keys->iv, yggaddr, port);
|
||||||
|
UpdateRouterInfo ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,8 @@ namespace i2p
|
||||||
eRouterStatusOK = 0,
|
eRouterStatusOK = 0,
|
||||||
eRouterStatusTesting = 1,
|
eRouterStatusTesting = 1,
|
||||||
eRouterStatusFirewalled = 2,
|
eRouterStatusFirewalled = 2,
|
||||||
eRouterStatusError = 3
|
eRouterStatusError = 3,
|
||||||
|
eRouterStatusUnknown = 4
|
||||||
};
|
};
|
||||||
|
|
||||||
enum RouterError
|
enum RouterError
|
||||||
|
|
Loading…
Add table
Reference in a new issue