Browse Source

random intro key

pull/1583/head
orignal 4 years ago
parent
commit
c875ff923a
  1. 6
      libi2pd/RouterContext.cpp
  2. 5
      libi2pd/RouterInfo.cpp

6
libi2pd/RouterContext.cpp

@ -89,7 +89,7 @@ namespace i2p
host = i2p::util::net::GetInterfaceAddress(ifname4, false).to_string(); host = i2p::util::net::GetInterfaceAddress(ifname4, false).to_string();
if (ssu) if (ssu)
routerInfo.AddSSUAddress (host.c_str(), port, routerInfo.GetIdentHash ()); routerInfo.AddSSUAddress (host.c_str(), port, nullptr);
} }
if (ipv6) if (ipv6)
{ {
@ -103,7 +103,7 @@ namespace i2p
host = i2p::util::net::GetInterfaceAddress(ifname6, true).to_string(); host = i2p::util::net::GetInterfaceAddress(ifname6, true).to_string();
if (ssu) if (ssu)
routerInfo.AddSSUAddress (host.c_str(), port, routerInfo.GetIdentHash ()); routerInfo.AddSSUAddress (host.c_str(), port, nullptr);
} }
routerInfo.SetCaps (i2p::data::RouterInfo::eReachable | routerInfo.SetCaps (i2p::data::RouterInfo::eReachable |
@ -486,7 +486,7 @@ namespace i2p
if (ssu) if (ssu)
{ {
std::string host = "::1"; // TODO: read host std::string host = "::1"; // TODO: read host
m_RouterInfo.AddSSUAddress (host.c_str (), port, GetIdentHash ()); m_RouterInfo.AddSSUAddress (host.c_str (), port, nullptr);
} }
} }
// NTCP2 // NTCP2

5
libi2pd/RouterInfo.cpp

@ -719,7 +719,10 @@ namespace data
addr->date = 0; addr->date = 0;
addr->ssu.reset (new SSUExt ()); addr->ssu.reset (new SSUExt ());
addr->ssu->mtu = mtu; addr->ssu->mtu = mtu;
memcpy (addr->ssu->key, key, 32); if (key)
memcpy (addr->ssu->key, key, 32);
else
RAND_bytes (addr->ssu->key, 32);
for (const auto& it: *m_Addresses) // don't insert same address twice for (const auto& it: *m_Addresses) // don't insert same address twice
if (*it == *addr) return; if (*it == *addr) return;
m_SupportedTransports |= addr->host.is_v6 () ? eSSUV6 : eSSUV4; m_SupportedTransports |= addr->host.is_v6 () ? eSSUV6 : eSSUV4;

Loading…
Cancel
Save