|
|
|
@ -63,7 +63,6 @@ namespace i2p
@@ -63,7 +63,6 @@ namespace i2p
|
|
|
|
|
bool ipv4; i2p::config::GetOption("ipv4", ipv4); |
|
|
|
|
bool ipv6; i2p::config::GetOption("ipv6", ipv6); |
|
|
|
|
bool ssu; i2p::config::GetOption("ssu", ssu); |
|
|
|
|
bool ntcp; i2p::config::GetOption("ntcp", ntcp); |
|
|
|
|
bool ntcp2; i2p::config::GetOption("ntcp2.enabled", ntcp2); |
|
|
|
|
bool nat; i2p::config::GetOption("nat", nat); |
|
|
|
|
std::string ifname; i2p::config::GetOption("ifname", ifname); |
|
|
|
@ -83,8 +82,6 @@ namespace i2p
@@ -83,8 +82,6 @@ namespace i2p
|
|
|
|
|
|
|
|
|
|
if (ssu) |
|
|
|
|
routerInfo.AddSSUAddress (host.c_str(), port, routerInfo.GetIdentHash ()); |
|
|
|
|
if (ntcp) |
|
|
|
|
routerInfo.AddNTCPAddress (host.c_str(), port); |
|
|
|
|
} |
|
|
|
|
if (ipv6) |
|
|
|
|
{ |
|
|
|
@ -99,8 +96,6 @@ namespace i2p
@@ -99,8 +96,6 @@ namespace i2p
|
|
|
|
|
|
|
|
|
|
if (ssu) |
|
|
|
|
routerInfo.AddSSUAddress (host.c_str(), port, routerInfo.GetIdentHash ()); |
|
|
|
|
if (ntcp) |
|
|
|
|
routerInfo.AddNTCPAddress (host.c_str(), port); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
routerInfo.SetCaps (i2p::data::RouterInfo::eReachable | |
|
|
|
@ -115,8 +110,6 @@ namespace i2p
@@ -115,8 +110,6 @@ namespace i2p
|
|
|
|
|
{ |
|
|
|
|
if (!m_NTCP2Keys) NewNTCP2Keys (); |
|
|
|
|
UpdateNTCP2Address (true); |
|
|
|
|
if (!ntcp) // NTCP2 should replace NTCP
|
|
|
|
|
{ |
|
|
|
|
bool published; i2p::config::GetOption("ntcp2.published", published); |
|
|
|
|
if (published) |
|
|
|
|
{ |
|
|
|
@ -132,7 +125,6 @@ namespace i2p
@@ -132,7 +125,6 @@ namespace i2p
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void RouterContext::UpdateRouterInfo () |
|
|
|
|
{ |
|
|
|
@ -444,16 +436,10 @@ namespace i2p
@@ -444,16 +436,10 @@ namespace i2p
|
|
|
|
|
addr->ssu->introducers.clear (); |
|
|
|
|
port = addr->port; |
|
|
|
|
} |
|
|
|
|
// remove NTCP or NTCP2 v4 address
|
|
|
|
|
bool ntcp; i2p::config::GetOption("ntcp", ntcp); |
|
|
|
|
if (ntcp) |
|
|
|
|
PublishNTCPAddress (false); |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
// remove NTCP2 v4 address
|
|
|
|
|
bool ntcp2; i2p::config::GetOption("ntcp2.enabled", ntcp2); |
|
|
|
|
if (ntcp2) |
|
|
|
|
PublishNTCP2Address (port, false, true); |
|
|
|
|
} |
|
|
|
|
// update
|
|
|
|
|
UpdateRouterInfo (); |
|
|
|
|
} |
|
|
|
@ -477,13 +463,7 @@ namespace i2p
@@ -477,13 +463,7 @@ namespace i2p
|
|
|
|
|
addr->ssu->introducers.clear (); |
|
|
|
|
port = addr->port; |
|
|
|
|
} |
|
|
|
|
// insert NTCP or NTCP2 back
|
|
|
|
|
bool ntcp; i2p::config::GetOption("ntcp", ntcp); |
|
|
|
|
if (ntcp) |
|
|
|
|
PublishNTCPAddress (true); |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
// ntcp2
|
|
|
|
|
// insert NTCP2 back
|
|
|
|
|
bool ntcp2; i2p::config::GetOption("ntcp2.enabled", ntcp2); |
|
|
|
|
if (ntcp2) |
|
|
|
|
{ |
|
|
|
@ -495,7 +475,6 @@ namespace i2p
@@ -495,7 +475,6 @@ namespace i2p
|
|
|
|
|
PublishNTCP2Address (ntcp2Port, true, true); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// update
|
|
|
|
|
UpdateRouterInfo (); |
|
|
|
|
} |
|
|
|
@ -506,7 +485,7 @@ namespace i2p
@@ -506,7 +485,7 @@ namespace i2p
|
|
|
|
|
{ |
|
|
|
|
m_RouterInfo.EnableV6 (); |
|
|
|
|
// insert v6 addresses if necessary
|
|
|
|
|
bool foundSSU = false, foundNTCP = false, foundNTCP2 = false; |
|
|
|
|
bool foundSSU = false, foundNTCP2 = false; |
|
|
|
|
uint16_t port = 0; |
|
|
|
|
auto& addresses = m_RouterInfo.GetAddresses (); |
|
|
|
|
for (auto& addr: addresses) |
|
|
|
@ -515,12 +494,8 @@ namespace i2p
@@ -515,12 +494,8 @@ namespace i2p
|
|
|
|
|
{ |
|
|
|
|
if (addr->transportStyle == i2p::data::RouterInfo::eTransportSSU) |
|
|
|
|
foundSSU = true; |
|
|
|
|
else if (addr->IsNTCP2 ()) |
|
|
|
|
{ |
|
|
|
|
if (addr->IsPublishedNTCP2 ()) foundNTCP2 = true; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
foundNTCP = true; |
|
|
|
|
else if (addr->IsPublishedNTCP2 ()) |
|
|
|
|
foundNTCP2 = true; |
|
|
|
|
} |
|
|
|
|
port = addr->port; |
|
|
|
|
} |
|
|
|
@ -552,16 +527,6 @@ namespace i2p
@@ -552,16 +527,6 @@ namespace i2p
|
|
|
|
|
m_RouterInfo.AddNTCP2Address (m_NTCP2Keys->staticPublicKey, m_NTCP2Keys->iv, boost::asio::ip::address::from_string (ntcp2Host), ntcp2Port); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// NTCP
|
|
|
|
|
if (!foundNTCP) |
|
|
|
|
{ |
|
|
|
|
bool ntcp; i2p::config::GetOption("ntcp", ntcp); |
|
|
|
|
if (ntcp) |
|
|
|
|
{ |
|
|
|
|
std::string host = "::1"; |
|
|
|
|
m_RouterInfo.AddNTCPAddress (host.c_str (), port); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
m_RouterInfo.DisableV6 (); |
|
|
|
|