|
|
@ -273,7 +273,7 @@ namespace transport |
|
|
|
s.Insert (payload, 8); // relayTag and signed on time
|
|
|
|
s.Insert (payload, 8); // relayTag and signed on time
|
|
|
|
m_RelayTag = bufbe32toh (payload); |
|
|
|
m_RelayTag = bufbe32toh (payload); |
|
|
|
payload += 4; // relayTag
|
|
|
|
payload += 4; // relayTag
|
|
|
|
if (i2p::context.GetStatus () == eRouterStatusTesting) |
|
|
|
if (ourIP.is_v4 () && i2p::context.GetStatus () == eRouterStatusTesting) |
|
|
|
{ |
|
|
|
{ |
|
|
|
auto ts = i2p::util::GetSecondsSinceEpoch (); |
|
|
|
auto ts = i2p::util::GetSecondsSinceEpoch (); |
|
|
|
uint32_t signedOnTime = bufbe32toh(payload); |
|
|
|
uint32_t signedOnTime = bufbe32toh(payload); |
|
|
@ -358,7 +358,9 @@ namespace transport |
|
|
|
uint8_t * payload = buf + sizeof (SSUHeader); |
|
|
|
uint8_t * payload = buf + sizeof (SSUHeader); |
|
|
|
uint8_t flag = 0; |
|
|
|
uint8_t flag = 0; |
|
|
|
// fill extended options, 3 bytes extended options don't change message size
|
|
|
|
// fill extended options, 3 bytes extended options don't change message size
|
|
|
|
if (i2p::context.GetStatus () == eRouterStatusOK) // we don't need relays
|
|
|
|
bool isV4 = m_RemoteEndpoint.address ().is_v4 (); |
|
|
|
|
|
|
|
if ((isV4 && i2p::context.GetStatus () == eRouterStatusOK) || |
|
|
|
|
|
|
|
(!isV4 && i2p::context.GetStatusV6 () == eRouterStatusOK)) // we don't need relays
|
|
|
|
{ |
|
|
|
{ |
|
|
|
// tell out peer to now assign relay tag
|
|
|
|
// tell out peer to now assign relay tag
|
|
|
|
flag = SSU_HEADER_EXTENDED_OPTIONS_INCLUDED; |
|
|
|
flag = SSU_HEADER_EXTENDED_OPTIONS_INCLUDED; |
|
|
@ -369,7 +371,6 @@ namespace transport |
|
|
|
} |
|
|
|
} |
|
|
|
// fill payload
|
|
|
|
// fill payload
|
|
|
|
memcpy (payload, m_DHKeysPair->GetPublicKey (), 256); // x
|
|
|
|
memcpy (payload, m_DHKeysPair->GetPublicKey (), 256); // x
|
|
|
|
bool isV4 = m_RemoteEndpoint.address ().is_v4 (); |
|
|
|
|
|
|
|
if (isV4) |
|
|
|
if (isV4) |
|
|
|
{ |
|
|
|
{ |
|
|
|
payload[256] = 4; |
|
|
|
payload[256] = 4; |
|
|
@ -657,6 +658,8 @@ namespace transport |
|
|
|
buf += ourSize; len -= ourSize; |
|
|
|
buf += ourSize; len -= ourSize; |
|
|
|
LogPrint (eLogInfo, "SSU: Our external address is ", ourIP.to_string (), ":", ourPort); |
|
|
|
LogPrint (eLogInfo, "SSU: Our external address is ", ourIP.to_string (), ":", ourPort); |
|
|
|
i2p::context.UpdateAddress (ourIP); |
|
|
|
i2p::context.UpdateAddress (ourIP); |
|
|
|
|
|
|
|
if (ourIP.is_v4 ()) |
|
|
|
|
|
|
|
{ |
|
|
|
if (ourPort != m_Server.GetPort ()) |
|
|
|
if (ourPort != m_Server.GetPort ()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (i2p::context.GetStatus () == eRouterStatusTesting) |
|
|
|
if (i2p::context.GetStatus () == eRouterStatusTesting) |
|
|
@ -664,6 +667,7 @@ namespace transport |
|
|
|
} |
|
|
|
} |
|
|
|
else if (i2p::context.GetStatus () == eRouterStatusError && i2p::context.GetError () == eRouterErrorSymmetricNAT) |
|
|
|
else if (i2p::context.GetStatus () == eRouterStatusError && i2p::context.GetError () == eRouterErrorSymmetricNAT) |
|
|
|
i2p::context.SetStatus (eRouterStatusTesting); |
|
|
|
i2p::context.SetStatus (eRouterStatusTesting); |
|
|
|
|
|
|
|
} |
|
|
|
uint32_t nonce = bufbe32toh (buf); |
|
|
|
uint32_t nonce = bufbe32toh (buf); |
|
|
|
buf += 4; // nonce
|
|
|
|
buf += 4; // nonce
|
|
|
|
auto it = m_RelayRequests.find (nonce); |
|
|
|
auto it = m_RelayRequests.find (nonce); |
|
|
|