add Yggdrasil address

This commit is contained in:
orignal 2021-01-31 18:30:53 -05:00
parent ba3acdac75
commit c4fc0f4ecf
3 changed files with 18 additions and 3 deletions

View File

@ -164,7 +164,7 @@ namespace i2p
} }
i2p::context.SetSupportsV6 (ipv6); i2p::context.SetSupportsV6 (ipv6);
i2p::context.SetSupportsV4 (ipv4); i2p::context.SetSupportsV4 (ipv4);
i2p::context.SetSupportsMesh (ygg); i2p::context.SetSupportsMesh (ygg, yggaddr);
i2p::context.RemoveNTCPAddress (!ipv6); // TODO: remove later i2p::context.RemoveNTCPAddress (!ipv6); // TODO: remove later
bool ntcp2; i2p::config::GetOption("ntcp2.enabled", ntcp2); bool ntcp2; i2p::config::GetOption("ntcp2.enabled", ntcp2);

View File

@ -521,10 +521,25 @@ namespace i2p
UpdateRouterInfo (); UpdateRouterInfo ();
} }
void RouterContext::SetSupportsMesh (bool supportsmesh) void RouterContext::SetSupportsMesh (bool supportsmesh, const boost::asio::ip::address_v6& host)
{ {
if (supportsmesh) if (supportsmesh)
{
m_RouterInfo.EnableMesh (); m_RouterInfo.EnableMesh ();
uint16_t port = 0;
i2p::config::GetOption ("ntcp2.port", port);
if (!port) i2p::config::GetOption("port", port);
if (!port)
{
auto& addresses = m_RouterInfo.GetAddresses ();
for (auto& addr: addresses)
{
port = addr->port;
if (port) break;
}
}
m_RouterInfo.AddNTCP2Address (m_NTCP2Keys->staticPublicKey, m_NTCP2Keys->iv, host, port);
}
else else
m_RouterInfo.DisableMesh (); m_RouterInfo.DisableMesh ();
UpdateRouterInfo (); UpdateRouterInfo ();

View File

@ -110,7 +110,7 @@ namespace i2p
bool SupportsMesh () const { return m_RouterInfo.IsMesh (); }; bool SupportsMesh () const { return m_RouterInfo.IsMesh (); };
void SetSupportsV6 (bool supportsV6); void SetSupportsV6 (bool supportsV6);
void SetSupportsV4 (bool supportsV4); void SetSupportsV4 (bool supportsV4);
void SetSupportsMesh (bool supportsmesh); void SetSupportsMesh (bool supportsmesh, const boost::asio::ip::address_v6& host);
bool IsECIES () const { return GetIdentity ()->GetCryptoKeyType () == i2p::data::CRYPTO_KEY_TYPE_ECIES_X25519_AEAD; }; bool IsECIES () const { return GetIdentity ()->GetCryptoKeyType () == i2p::data::CRYPTO_KEY_TYPE_ECIES_X25519_AEAD; };
std::unique_ptr<i2p::crypto::NoiseSymmetricState>& GetCurrentNoiseState () { return m_CurrentNoiseState; }; std::unique_ptr<i2p::crypto::NoiseSymmetricState>& GetCurrentNoiseState () { return m_CurrentNoiseState; };