Browse Source

add Yggdrasil address

pull/1634/head
orignal 4 years ago
parent
commit
c4fc0f4ecf
  1. 2
      daemon/Daemon.cpp
  2. 17
      libi2pd/RouterContext.cpp
  3. 2
      libi2pd/RouterContext.h

2
daemon/Daemon.cpp

@ -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);

17
libi2pd/RouterContext.cpp

@ -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 ();

2
libi2pd/RouterContext.h

@ -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; };

Loading…
Cancel
Save