Browse Source

pass NTCP2 ipv6 address

pull/1234/head
orignal 6 years ago
parent
commit
f0d4ee6618
  1. 11
      libi2pd/RouterContext.cpp
  2. 7
      libi2pd/RouterInfo.cpp
  3. 2
      libi2pd/RouterInfo.h

11
libi2pd/RouterContext.cpp

@ -476,15 +476,12 @@ namespace i2p @@ -476,15 +476,12 @@ namespace i2p
}
}
if (!updated)
if (!updated && port) // we have found NTCP2 v4 but not v6
{
if (port) // we have found NTCP2 v4 but not v6
{
m_RouterInfo.AddNTCP2Address (m_NTCP2Keys->staticPublicKey, m_NTCP2Keys->iv);
PublishNTCP2Address (port, true);
}
m_RouterInfo.AddNTCP2Address (m_NTCP2Keys->staticPublicKey, m_NTCP2Keys->iv, host, port);
updated = true;
}
else
if (updated)
UpdateRouterInfo ();
}

7
libi2pd/RouterInfo.cpp

@ -696,12 +696,11 @@ namespace data @@ -696,12 +696,11 @@ namespace data
m_Caps |= eSSUIntroducer;
}
void RouterInfo::AddNTCP2Address (const uint8_t * staticKey, const uint8_t * iv)
void RouterInfo::AddNTCP2Address (const uint8_t * staticKey, const uint8_t * iv, const boost::asio::ip::address& host, int port)
{
for (const auto& it: *m_Addresses) // don't insert one more NTCP2
if (it->ntcp2) return;
auto addr = std::make_shared<Address>();
addr->port = 0;
addr->host = host;
addr->port = port;
addr->transportStyle = eTransportNTCP;
addr->cost = 3;
addr->date = 0;

2
libi2pd/RouterInfo.h

@ -151,7 +151,7 @@ namespace data @@ -151,7 +151,7 @@ namespace data
void AddNTCPAddress (const char * host, int port);
void AddSSUAddress (const char * host, int port, const uint8_t * key, int mtu = 0);
void AddNTCP2Address (const uint8_t * staticKey, const uint8_t * iv);
void AddNTCP2Address (const uint8_t * staticKey, const uint8_t * iv, const boost::asio::ip::address& host = boost::asio::ip::address(), int port = 0);
bool AddIntroducer (const Introducer& introducer);
bool RemoveIntroducer (const boost::asio::ip::udp::endpoint& e);
void SetProperty (const std::string& key, const std::string& value); // called from RouterContext only

Loading…
Cancel
Save