|
|
@ -311,9 +311,17 @@ namespace data |
|
|
|
supportedTransports |= eNTCP2V4; |
|
|
|
supportedTransports |= eNTCP2V4; |
|
|
|
} |
|
|
|
} |
|
|
|
else if (!address->ntcp2->isPublished) |
|
|
|
else if (!address->ntcp2->isPublished) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (address->caps) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (address->caps | AddressCaps::eV4) supportedTransports |= eNTCP2V4; |
|
|
|
|
|
|
|
if (address->caps | AddressCaps::eV6) supportedTransports |= eNTCP2V6; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
supportedTransports |= eNTCP2V4; // most likely, since we don't have host
|
|
|
|
supportedTransports |= eNTCP2V4; // most likely, since we don't have host
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
else if (address->transportStyle == eTransportSSU) |
|
|
|
else if (address->transportStyle == eTransportSSU) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (isIntroKey) |
|
|
|
if (isIntroKey) |
|
|
@ -505,10 +513,26 @@ namespace data |
|
|
|
s.write ((const char *)&address.cost, sizeof (address.cost)); |
|
|
|
s.write ((const char *)&address.cost, sizeof (address.cost)); |
|
|
|
s.write ((const char *)&address.date, sizeof (address.date)); |
|
|
|
s.write ((const char *)&address.date, sizeof (address.date)); |
|
|
|
std::stringstream properties; |
|
|
|
std::stringstream properties; |
|
|
|
|
|
|
|
bool isPublished = false; |
|
|
|
if (address.transportStyle == eTransportNTCP) |
|
|
|
if (address.transportStyle == eTransportNTCP) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (address.IsNTCP2 ()) |
|
|
|
if (address.IsNTCP2 ()) |
|
|
|
|
|
|
|
{ |
|
|
|
WriteString ("NTCP2", s); |
|
|
|
WriteString ("NTCP2", s); |
|
|
|
|
|
|
|
if (address.IsPublishedNTCP2 ()) |
|
|
|
|
|
|
|
isPublished = true; |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
WriteString ("caps", properties); |
|
|
|
|
|
|
|
properties << '='; |
|
|
|
|
|
|
|
std::string caps; |
|
|
|
|
|
|
|
if (address.caps & AddressCaps::eV4) caps += CAPS_FLAG_V4; |
|
|
|
|
|
|
|
if (address.caps & AddressCaps::eV6) caps += CAPS_FLAG_V6; |
|
|
|
|
|
|
|
if (caps.empty ()) caps += CAPS_FLAG_V4; |
|
|
|
|
|
|
|
WriteString (caps, properties); |
|
|
|
|
|
|
|
properties << ';'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
continue; // don't write NTCP address
|
|
|
|
continue; // don't write NTCP address
|
|
|
|
} |
|
|
|
} |
|
|
@ -521,13 +545,17 @@ namespace data |
|
|
|
std::string caps; |
|
|
|
std::string caps; |
|
|
|
if (address.IsPeerTesting ()) caps += CAPS_FLAG_SSU_TESTING; |
|
|
|
if (address.IsPeerTesting ()) caps += CAPS_FLAG_SSU_TESTING; |
|
|
|
if (address.IsIntroducer ()) caps += CAPS_FLAG_SSU_INTRODUCER; |
|
|
|
if (address.IsIntroducer ()) caps += CAPS_FLAG_SSU_INTRODUCER; |
|
|
|
|
|
|
|
if (address.ssu && address.ssu->introducers.empty ()) |
|
|
|
|
|
|
|
isPublished = true; |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
caps += CAPS_FLAG_V4; |
|
|
|
WriteString (caps, properties); |
|
|
|
WriteString (caps, properties); |
|
|
|
properties << ';'; |
|
|
|
properties << ';'; |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
WriteString ("", s); |
|
|
|
WriteString ("", s); |
|
|
|
|
|
|
|
|
|
|
|
if (!address.IsNTCP2 () || address.IsPublishedNTCP2 ()) |
|
|
|
if (isPublished) |
|
|
|
{ |
|
|
|
{ |
|
|
|
WriteString ("host", properties); |
|
|
|
WriteString ("host", properties); |
|
|
|
properties << '='; |
|
|
|
properties << '='; |
|
|
@ -537,7 +565,7 @@ namespace data |
|
|
|
if (address.transportStyle == eTransportSSU) |
|
|
|
if (address.transportStyle == eTransportSSU) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// write introducers if any
|
|
|
|
// write introducers if any
|
|
|
|
if (address.ssu->introducers.size () > 0) |
|
|
|
if (!address.ssu->introducers.empty()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int i = 0; |
|
|
|
int i = 0; |
|
|
|
for (const auto& introducer: address.ssu->introducers) |
|
|
|
for (const auto& introducer: address.ssu->introducers) |
|
|
@ -616,7 +644,7 @@ namespace data |
|
|
|
WriteString (address.ntcp2->iv.ToBase64 (), properties); properties << ';'; |
|
|
|
WriteString (address.ntcp2->iv.ToBase64 (), properties); properties << ';'; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!address.IsNTCP2 () || address.IsPublishedNTCP2 ()) |
|
|
|
if (isPublished) |
|
|
|
{ |
|
|
|
{ |
|
|
|
WriteString ("port", properties); |
|
|
|
WriteString ("port", properties); |
|
|
|
properties << '='; |
|
|
|
properties << '='; |
|
|
|