mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-10 00:00:29 +03:00
publish and upublish NTCP2 and yggdrasil addresses separatly
This commit is contained in:
parent
436a3e7f54
commit
43d458cf72
@ -218,7 +218,7 @@ namespace util
|
||||
{
|
||||
uint16_t ntcp2port; i2p::config::GetOption("ntcp2.port", ntcp2port);
|
||||
if (!ntcp2port) ntcp2port = port; // use standard port
|
||||
i2p::context.PublishNTCP2Address (ntcp2port, true); // publish
|
||||
i2p::context.PublishNTCP2Address (ntcp2port, true, ipv4, ipv6, false); // publish
|
||||
if (ipv6)
|
||||
{
|
||||
std::string ipv6Addr; i2p::config::GetOption("ntcp2.addressv6", ipv6Addr);
|
||||
@ -228,12 +228,12 @@ namespace util
|
||||
}
|
||||
}
|
||||
else
|
||||
i2p::context.PublishNTCP2Address (port, false); // unpublish
|
||||
i2p::context.PublishNTCP2Address (port, false, ipv4, ipv6, false); // unpublish
|
||||
}
|
||||
if (ygg)
|
||||
{
|
||||
if (!ntcp2)
|
||||
i2p::context.PublishNTCP2Address (port, true);
|
||||
i2p::context.PublishNTCP2Address (port, true, false, false, true);
|
||||
i2p::context.UpdateNTCP2V6Address (yggaddr);
|
||||
if (!ipv4 && !ipv6)
|
||||
i2p::context.SetStatus (eRouterStatusMesh);
|
||||
|
@ -225,13 +225,15 @@ namespace i2p
|
||||
UpdateRouterInfo ();
|
||||
}
|
||||
|
||||
void RouterContext::PublishNTCP2Address (int port, bool publish, bool v4only)
|
||||
void RouterContext::PublishNTCP2Address (int port, bool publish, bool v4, bool v6, bool ygg)
|
||||
{
|
||||
if (!m_NTCP2Keys) return;
|
||||
bool updated = false;
|
||||
for (auto& address : m_RouterInfo.GetAddresses ())
|
||||
{
|
||||
if (address->IsNTCP2 () && (address->port != port || address->ntcp2->isPublished != publish) && (!v4only || address->IsV4 ()))
|
||||
if (address->IsNTCP2 () && (address->port != port || address->ntcp2->isPublished != publish)
|
||||
&& ((v4 && address->IsV4 ()) || (v6 && address->IsV6 ()) ||
|
||||
(ygg && i2p::util::net::IsYggdrasilAddress (address->host))))
|
||||
{
|
||||
if (!port && !address->port)
|
||||
{
|
||||
@ -457,7 +459,7 @@ namespace i2p
|
||||
// remove NTCP2 v4 address
|
||||
bool ntcp2; i2p::config::GetOption("ntcp2.enabled", ntcp2);
|
||||
if (ntcp2)
|
||||
PublishNTCP2Address (port, false, true);
|
||||
PublishNTCP2Address (port, false, true, false, false); // ipv4 only
|
||||
// update
|
||||
UpdateRouterInfo ();
|
||||
}
|
||||
@ -491,7 +493,7 @@ namespace i2p
|
||||
{
|
||||
uint16_t ntcp2Port; i2p::config::GetOption ("ntcp2.port", ntcp2Port);
|
||||
if (!ntcp2Port) ntcp2Port = port;
|
||||
PublishNTCP2Address (ntcp2Port, true, true);
|
||||
PublishNTCP2Address (ntcp2Port, true, true, false, false); // ipv4 only
|
||||
}
|
||||
}
|
||||
// update
|
||||
|
@ -97,7 +97,7 @@ namespace garlic
|
||||
|
||||
void UpdatePort (int port); // called from Daemon
|
||||
void UpdateAddress (const boost::asio::ip::address& host); // called from SSU or Daemon
|
||||
void PublishNTCP2Address (int port, bool publish = true, bool v4only = false);
|
||||
void PublishNTCP2Address (int port, bool publish, bool v4, bool v6, bool ygg);
|
||||
void UpdateNTCP2Address (bool enable);
|
||||
void RemoveNTCPAddress (bool v4only = true); // delete NTCP address for older routers. TODO: remove later
|
||||
bool AddIntroducer (const i2p::data::RouterInfo::Introducer& introducer);
|
||||
|
Loading…
Reference in New Issue
Block a user