mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-10 00:00:29 +03:00
ssu2.published and update SSU2 ipv4
This commit is contained in:
parent
7923ed9567
commit
064b8042a5
@ -273,6 +273,7 @@ namespace config {
|
||||
options_description ssu2("SSU2 Options");
|
||||
ntcp2.add_options()
|
||||
("ssu2.enabled", value<bool>()->default_value(false), "Enable SSU2 (default: disabled)")
|
||||
("ssu2.published", value<bool>()->default_value(false), "Publish SSU2 (default: disabled)")
|
||||
("ssu2.port", value<uint16_t>()->default_value(0), "Port to listen for incoming SSU2 packets (default: auto)")
|
||||
;
|
||||
|
||||
|
@ -696,7 +696,7 @@ namespace i2p
|
||||
// update
|
||||
if (supportsV4)
|
||||
{
|
||||
bool foundSSU = false, foundNTCP2 = false;
|
||||
bool foundSSU = false, foundNTCP2 = false, foundSSU2 = false;
|
||||
std::string host = "127.0.0.1";
|
||||
uint16_t port = 0;
|
||||
auto& addresses = m_RouterInfo.GetAddresses ();
|
||||
@ -704,10 +704,19 @@ namespace i2p
|
||||
{
|
||||
if (addr->IsV4 ())
|
||||
{
|
||||
if (addr->transportStyle == i2p::data::RouterInfo::eTransportSSU)
|
||||
foundSSU = true;
|
||||
else if (addr->transportStyle == i2p::data::RouterInfo::eTransportNTCP)
|
||||
foundNTCP2 = true;
|
||||
switch (addr->transportStyle)
|
||||
{
|
||||
case i2p::data::RouterInfo::eTransportSSU:
|
||||
foundSSU = true;
|
||||
break;
|
||||
case i2p::data::RouterInfo::eTransportNTCP:
|
||||
foundNTCP2 = true;
|
||||
break;
|
||||
case i2p::data::RouterInfo::eTransportSSU2:
|
||||
foundSSU2 = true;
|
||||
break;
|
||||
default: ;
|
||||
}
|
||||
}
|
||||
if (addr->port) port = addr->port;
|
||||
}
|
||||
@ -736,6 +745,19 @@ namespace i2p
|
||||
m_RouterInfo.AddNTCP2Address (m_NTCP2Keys->staticPublicKey, m_NTCP2Keys->iv, boost::asio::ip::address(), 0, i2p::data::RouterInfo::eV4);
|
||||
}
|
||||
}
|
||||
// SSU2
|
||||
if (!foundSSU2)
|
||||
{
|
||||
bool ssu2; i2p::config::GetOption("ssu2.enabled", ssu2);
|
||||
bool ssu2Published; i2p::config::GetOption("ssu2.published", ssu2Published);
|
||||
if (ssu2Published)
|
||||
{
|
||||
uint16_t ssu2Port; i2p::config::GetOption ("ssu2.port", ssu2Port);
|
||||
m_RouterInfo.AddSSU2Address (m_SSU2Keys->staticPublicKey, m_SSU2Keys->intro, boost::asio::ip::address::from_string ("127.0.0.1"), ssu2Port);
|
||||
}
|
||||
else
|
||||
m_RouterInfo.AddSSU2Address (m_SSU2Keys->staticPublicKey, m_SSU2Keys->intro, i2p::data::RouterInfo::eV6);
|
||||
}
|
||||
m_RouterInfo.EnableV4 ();
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user