|
|
@ -330,7 +330,7 @@ namespace data |
|
|
|
introducer.iPort = boost::lexical_cast<int>(value); |
|
|
|
introducer.iPort = boost::lexical_cast<int>(value); |
|
|
|
else if (!strcmp (key, "itag")) |
|
|
|
else if (!strcmp (key, "itag")) |
|
|
|
introducer.iTag = boost::lexical_cast<uint32_t>(value); |
|
|
|
introducer.iTag = boost::lexical_cast<uint32_t>(value); |
|
|
|
else if (!strcmp (key, "ikey")) |
|
|
|
else if (!strcmp (key, "ikey") || !strcmp (key, "ih")) |
|
|
|
Base64ToByteStream (value, strlen (value), introducer.iKey, 32); |
|
|
|
Base64ToByteStream (value, strlen (value), introducer.iKey, 32); |
|
|
|
else if (!strcmp (key, "iexp")) |
|
|
|
else if (!strcmp (key, "iexp")) |
|
|
|
introducer.iExp = boost::lexical_cast<uint32_t>(value); |
|
|
|
introducer.iExp = boost::lexical_cast<uint32_t>(value); |
|
|
@ -425,6 +425,9 @@ namespace data |
|
|
|
ssu2addr->date = address->date; ssu2addr->caps = address->caps; |
|
|
|
ssu2addr->date = address->date; ssu2addr->caps = address->caps; |
|
|
|
ssu2addr->published = address->published; |
|
|
|
ssu2addr->published = address->published; |
|
|
|
ssu2addr->ssu.reset (new SSUExt ()); ssu2addr->ssu->mtu = address->ssu->mtu; |
|
|
|
ssu2addr->ssu.reset (new SSUExt ()); ssu2addr->ssu->mtu = address->ssu->mtu; |
|
|
|
|
|
|
|
for (const auto& introducer: address->ssu->introducers) |
|
|
|
|
|
|
|
if (!introducer.iPort) // SSU2
|
|
|
|
|
|
|
|
ssu2addr->ssu->introducers.push_back (introducer); |
|
|
|
addresses->push_back(ssu2addr); |
|
|
|
addresses->push_back(ssu2addr); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -1227,7 +1230,14 @@ namespace data |
|
|
|
WriteString (address.host.to_string (), properties); |
|
|
|
WriteString (address.host.to_string (), properties); |
|
|
|
properties << ';'; |
|
|
|
properties << ';'; |
|
|
|
} |
|
|
|
} |
|
|
|
if (address.transportStyle == eTransportSSU) |
|
|
|
if ((address.IsNTCP2 () && isPublished) || address.IsSSU2 ()) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// publish i for NTCP2 or SSU2
|
|
|
|
|
|
|
|
WriteString ("i", properties); properties << '='; |
|
|
|
|
|
|
|
size_t len = address.IsSSU2 () ? 32 : 16; |
|
|
|
|
|
|
|
WriteString (address.i.ToBase64 (len), properties); properties << ';'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (address.transportStyle == eTransportSSU || address.IsSSU2 ()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// write introducers if any
|
|
|
|
// write introducers if any
|
|
|
|
if (!address.ssu->introducers.empty()) |
|
|
|
if (!address.ssu->introducers.empty()) |
|
|
@ -1244,19 +1254,25 @@ namespace data |
|
|
|
} |
|
|
|
} |
|
|
|
i++; |
|
|
|
i++; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (address.transportStyle == eTransportSSU) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
i = 0; |
|
|
|
|
|
|
|
for (const auto& introducer: address.ssu->introducers) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
WriteString ("ihost" + boost::lexical_cast<std::string>(i), properties); |
|
|
|
|
|
|
|
properties << '='; |
|
|
|
|
|
|
|
WriteString (introducer.iHost.to_string (), properties); |
|
|
|
|
|
|
|
properties << ';'; |
|
|
|
|
|
|
|
i++; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
i = 0; |
|
|
|
i = 0; |
|
|
|
for (const auto& introducer: address.ssu->introducers) |
|
|
|
for (const auto& introducer: address.ssu->introducers) |
|
|
|
{ |
|
|
|
{ |
|
|
|
WriteString ("ihost" + boost::lexical_cast<std::string>(i), properties); |
|
|
|
if (address.IsSSU2 ()) |
|
|
|
properties << '='; |
|
|
|
WriteString ("ih" + boost::lexical_cast<std::string>(i), properties); |
|
|
|
WriteString (introducer.iHost.to_string (), properties); |
|
|
|
else |
|
|
|
properties << ';'; |
|
|
|
WriteString ("ikey" + boost::lexical_cast<std::string>(i), properties); |
|
|
|
i++; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
i = 0; |
|
|
|
|
|
|
|
for (const auto& introducer: address.ssu->introducers) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
WriteString ("ikey" + boost::lexical_cast<std::string>(i), properties); |
|
|
|
|
|
|
|
properties << '='; |
|
|
|
properties << '='; |
|
|
|
char value[64]; |
|
|
|
char value[64]; |
|
|
|
size_t l = ByteStreamToBase64 (introducer.iKey, 32, value, 64); |
|
|
|
size_t l = ByteStreamToBase64 (introducer.iKey, 32, value, 64); |
|
|
@ -1265,15 +1281,18 @@ namespace data |
|
|
|
properties << ';'; |
|
|
|
properties << ';'; |
|
|
|
i++; |
|
|
|
i++; |
|
|
|
} |
|
|
|
} |
|
|
|
i = 0; |
|
|
|
if (address.transportStyle == eTransportSSU) |
|
|
|
for (const auto& introducer: address.ssu->introducers) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
WriteString ("iport" + boost::lexical_cast<std::string>(i), properties); |
|
|
|
i = 0; |
|
|
|
properties << '='; |
|
|
|
for (const auto& introducer: address.ssu->introducers) |
|
|
|
WriteString (boost::lexical_cast<std::string>(introducer.iPort), properties); |
|
|
|
{ |
|
|
|
properties << ';'; |
|
|
|
WriteString ("iport" + boost::lexical_cast<std::string>(i), properties); |
|
|
|
i++; |
|
|
|
properties << '='; |
|
|
|
} |
|
|
|
WriteString (boost::lexical_cast<std::string>(introducer.iPort), properties); |
|
|
|
|
|
|
|
properties << ';'; |
|
|
|
|
|
|
|
i++; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
i = 0; |
|
|
|
i = 0; |
|
|
|
for (const auto& introducer: address.ssu->introducers) |
|
|
|
for (const auto& introducer: address.ssu->introducers) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -1284,6 +1303,9 @@ namespace data |
|
|
|
i++; |
|
|
|
i++; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (address.transportStyle == eTransportSSU) |
|
|
|
|
|
|
|
{ |
|
|
|
// write intro key
|
|
|
|
// write intro key
|
|
|
|
WriteString ("key", properties); |
|
|
|
WriteString ("key", properties); |
|
|
|
properties << '='; |
|
|
|
properties << '='; |
|
|
@ -1292,6 +1314,9 @@ namespace data |
|
|
|
value[l] = 0; |
|
|
|
value[l] = 0; |
|
|
|
WriteString (value, properties); |
|
|
|
WriteString (value, properties); |
|
|
|
properties << ';'; |
|
|
|
properties << ';'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (address.transportStyle == eTransportSSU || address.IsSSU2 ()) |
|
|
|
|
|
|
|
{ |
|
|
|
// write mtu
|
|
|
|
// write mtu
|
|
|
|
if (address.ssu->mtu) |
|
|
|
if (address.ssu->mtu) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -1301,15 +1326,6 @@ namespace data |
|
|
|
properties << ';'; |
|
|
|
properties << ';'; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ((address.IsNTCP2 () && isPublished) || address.IsSSU2 ()) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// publish i for NTCP2 or SSU2
|
|
|
|
|
|
|
|
WriteString ("i", properties); properties << '='; |
|
|
|
|
|
|
|
size_t len = address.IsSSU2 () ? 32 : 16; |
|
|
|
|
|
|
|
WriteString (address.i.ToBase64 (len), properties); properties << ';'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isPublished || (address.ssu && !address.IsSSU2 ())) |
|
|
|
if (isPublished || (address.ssu && !address.IsSSU2 ())) |
|
|
|
{ |
|
|
|
{ |
|
|
|
WriteString ("port", properties); |
|
|
|
WriteString ("port", properties); |
|
|
|