|
|
@ -221,9 +221,9 @@ namespace data |
|
|
|
ReadString (transportStyle, 6, s); |
|
|
|
ReadString (transportStyle, 6, s); |
|
|
|
if (!strncmp (transportStyle, "NTCP", 4)) // NTCP or NTCP2
|
|
|
|
if (!strncmp (transportStyle, "NTCP", 4)) // NTCP or NTCP2
|
|
|
|
address->transportStyle = eTransportNTCP; |
|
|
|
address->transportStyle = eTransportNTCP; |
|
|
|
else if (!strcmp (transportStyle, "SSU")) |
|
|
|
else if (!strncmp (transportStyle, "SSU", 3)) // SSU or SSU2
|
|
|
|
{ |
|
|
|
{ |
|
|
|
address->transportStyle = eTransportSSU; |
|
|
|
address->transportStyle = (transportStyle[3] == '2') ? eTransportSSU2 : eTransportSSU; |
|
|
|
address->ssu.reset (new SSUExt ()); |
|
|
|
address->ssu.reset (new SSUExt ()); |
|
|
|
address->ssu->mtu = 0; |
|
|
|
address->ssu->mtu = 0; |
|
|
|
} |
|
|
|
} |
|
|
@ -266,12 +266,12 @@ namespace data |
|
|
|
} |
|
|
|
} |
|
|
|
else if (!strcmp (key, "caps")) |
|
|
|
else if (!strcmp (key, "caps")) |
|
|
|
address->caps = ExtractAddressCaps (value); |
|
|
|
address->caps = ExtractAddressCaps (value); |
|
|
|
else if (!strcmp (key, "s")) // ntcp2 static key
|
|
|
|
else if (!strcmp (key, "s")) // ntcp2 or ssu2 static key
|
|
|
|
{ |
|
|
|
{ |
|
|
|
Base64ToByteStream (value, strlen (value), address->s, 32); |
|
|
|
Base64ToByteStream (value, strlen (value), address->s, 32); |
|
|
|
isStaticKey = true; |
|
|
|
isStaticKey = true; |
|
|
|
} |
|
|
|
} |
|
|
|
else if (!strcmp (key, "i")) // ntcp2 iv
|
|
|
|
else if (!strcmp (key, "i")) // ntcp2 iv or ssu2 intro
|
|
|
|
{ |
|
|
|
{ |
|
|
|
Base64ToByteStream (value, strlen (value), address->i, 16); |
|
|
|
Base64ToByteStream (value, strlen (value), address->i, 16); |
|
|
|
address->published = true; // presence if "i" means "published"
|
|
|
|
address->published = true; // presence if "i" means "published"
|
|
|
@ -378,6 +378,10 @@ namespace data |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
else if (address->transportStyle == eTransportSSU2) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// TODO:
|
|
|
|
|
|
|
|
} |
|
|
|
if (supportedTransports) |
|
|
|
if (supportedTransports) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (!(m_SupportedTransports & supportedTransports)) // avoid duplicates
|
|
|
|
if (!(m_SupportedTransports & supportedTransports)) // avoid duplicates
|
|
|
@ -1104,6 +1108,19 @@ namespace data |
|
|
|
WriteString (caps, properties); |
|
|
|
WriteString (caps, properties); |
|
|
|
properties << ';'; |
|
|
|
properties << ';'; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
else if (address.transportStyle == eTransportSSU2) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
WriteString ("SSU2", s); |
|
|
|
|
|
|
|
// caps
|
|
|
|
|
|
|
|
WriteString ("caps", properties); |
|
|
|
|
|
|
|
properties << '='; |
|
|
|
|
|
|
|
std::string caps; |
|
|
|
|
|
|
|
if (address.IsV4 ()) caps += CAPS_FLAG_V4; |
|
|
|
|
|
|
|
if (address.IsV6 ()) caps += CAPS_FLAG_V6; |
|
|
|
|
|
|
|
if (caps.empty ()) caps += CAPS_FLAG_V4; |
|
|
|
|
|
|
|
WriteString (caps, properties); |
|
|
|
|
|
|
|
properties << ';'; |
|
|
|
|
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
WriteString ("", s); |
|
|
|
WriteString ("", s); |
|
|
|
|
|
|
|
|
|
|
@ -1203,9 +1220,9 @@ namespace data |
|
|
|
WriteString (boost::lexical_cast<std::string>(address.port), properties); |
|
|
|
WriteString (boost::lexical_cast<std::string>(address.port), properties); |
|
|
|
properties << ';'; |
|
|
|
properties << ';'; |
|
|
|
} |
|
|
|
} |
|
|
|
if (address.IsNTCP2 ()) |
|
|
|
if (address.IsNTCP2 () || address.IsSSU2 ()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// publish s and v for NTCP2
|
|
|
|
// publish s and v for NTCP2 or SSU2
|
|
|
|
WriteString ("s", properties); properties << '='; |
|
|
|
WriteString ("s", properties); properties << '='; |
|
|
|
WriteString (address.s.ToBase64 (), properties); properties << ';'; |
|
|
|
WriteString (address.s.ToBase64 (), properties); properties << ';'; |
|
|
|
WriteString ("v", properties); properties << '='; |
|
|
|
WriteString ("v", properties); properties << '='; |
|
|
|