|
|
@ -131,8 +131,8 @@ namespace transport |
|
|
|
Transports transports; |
|
|
|
Transports transports; |
|
|
|
|
|
|
|
|
|
|
|
Transports::Transports (): |
|
|
|
Transports::Transports (): |
|
|
|
m_IsOnline (true), m_IsRunning (false), m_IsNAT (true), m_Thread (nullptr), m_Service (nullptr), |
|
|
|
m_IsOnline (true), m_IsRunning (false), m_IsNAT (true), m_СheckReserved(true), m_Thread (nullptr), |
|
|
|
m_Work (nullptr), m_PeerCleanupTimer (nullptr), m_PeerTestTimer (nullptr), |
|
|
|
m_Service (nullptr), m_Work (nullptr), m_PeerCleanupTimer (nullptr), m_PeerTestTimer (nullptr), |
|
|
|
m_SSUServer (nullptr), m_NTCP2Server (nullptr), |
|
|
|
m_SSUServer (nullptr), m_NTCP2Server (nullptr), |
|
|
|
m_DHKeysPairSupplier (5), m_X25519KeysPairSupplier (5), // 5 pre-generated keys
|
|
|
|
m_DHKeysPairSupplier (5), m_X25519KeysPairSupplier (5), // 5 pre-generated keys
|
|
|
|
m_TotalSentBytes(0), m_TotalReceivedBytes(0), m_TotalTransitTransmittedBytes (0), |
|
|
|
m_TotalSentBytes(0), m_TotalReceivedBytes(0), m_TotalTransitTransmittedBytes (0), |
|
|
@ -393,7 +393,7 @@ namespace transport |
|
|
|
{ |
|
|
|
{ |
|
|
|
// NTCP2 have priority over NTCP
|
|
|
|
// NTCP2 have priority over NTCP
|
|
|
|
auto address = peer.router->GetNTCP2Address (true, !context.SupportsV6 ()); // published only
|
|
|
|
auto address = peer.router->GetNTCP2Address (true, !context.SupportsV6 ()); // published only
|
|
|
|
if (address && !peer.router->IsUnreachable ()) |
|
|
|
if (address && !peer.router->IsUnreachable () && (!m_СheckReserved || !i2p::util::net::IsInReservedRange(address->host))) |
|
|
|
{ |
|
|
|
{ |
|
|
|
auto s = std::make_shared<NTCP2Session> (*m_NTCP2Server, peer.router); |
|
|
|
auto s = std::make_shared<NTCP2Session> (*m_NTCP2Server, peer.router); |
|
|
|
|
|
|
|
|
|
|
@ -419,8 +419,11 @@ namespace transport |
|
|
|
if (m_SSUServer && peer.router->IsSSU (!context.SupportsV6 ())) |
|
|
|
if (m_SSUServer && peer.router->IsSSU (!context.SupportsV6 ())) |
|
|
|
{ |
|
|
|
{ |
|
|
|
auto address = peer.router->GetSSUAddress (!context.SupportsV6 ()); |
|
|
|
auto address = peer.router->GetSSUAddress (!context.SupportsV6 ()); |
|
|
|
m_SSUServer->CreateSession (peer.router, address->host, address->port); |
|
|
|
if (!m_СheckReserved || !i2p::util::net::IsInReservedRange(address->host)) |
|
|
|
return true; |
|
|
|
{ |
|
|
|
|
|
|
|
m_SSUServer->CreateSession (peer.router, address->host, address->port); |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
LogPrint (eLogInfo, "Transports: No NTCP or SSU addresses available"); |
|
|
|
LogPrint (eLogInfo, "Transports: No NTCP or SSU addresses available"); |
|
|
|