Merge pull request #1681 from deepwell/1363-add-unrecognized-client-names

Add unrecognized client names #1363
This commit is contained in:
Mitch Livingston 2021-05-14 17:27:17 -04:00 committed by GitHub
commit 8dd2928976
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 56 additions and 2 deletions

View File

@ -234,6 +234,11 @@ char* tr_clientForId(char* buf, size_t buflen, void const* id_in)
tr_snprintf(buf, buflen, "\xc2\xb5Torrent Embedded %d.%d.%d%s", strint(id + 3, 1), strint(id + 4, 1),
strint(id + 5, 1), getMnemonicEnd(id[6]));
}
else if (strncmp(chid + 1, "UW", 2) == 0)
{
tr_snprintf(buf, buflen, "\xc2\xb5Torrent Web %d.%d.%d%s", strint(id + 3, 1), strint(id + 4, 1), strint(id + 5,
1), getMnemonicEnd(id[6]));
}
/* */
else if (strncmp(chid + 1, "AZ", 2) == 0)
{
@ -291,6 +296,10 @@ char* tr_clientForId(char* buf, size_t buflen, void const* id_in)
{
four_digits(buf, buflen, "BitZilla", id + 3);
}
else if (strncmp(chid + 1, "BI", 2) == 0)
{
four_digits(buf, buflen, "BiglyBT", id + 3);
}
else if (strncmp(chid + 1, "BM", 2) == 0)
{
four_digits(buf, buflen, "BitMagnet", id + 3);
@ -467,6 +476,10 @@ char* tr_clientForId(char* buf, size_t buflen, void const* id_in)
{
four_digits(buf, buflen, "FireTorrent", id + 3);
}
else if (strncmp(chid + 1, "WW", 2) == 0)
{
four_digits(buf, buflen, "WebTorrent", id + 3);
}
else if (strncmp(chid + 1, "XL", 2) == 0)
{
four_digits(buf, buflen, "Xunlei", id + 3);
@ -500,6 +513,10 @@ char* tr_clientForId(char* buf, size_t buflen, void const* id_in)
{
three_digits(buf, buflen, "Electric Sheep", id + 3);
}
else if (strncmp(chid + 1, "FW", 2) == 0)
{
three_digits(buf, buflen, "FrostWire", id + 3);
}
else if (strncmp(chid + 1, "HL", 2) == 0)
{
three_digits(buf, buflen, "Halite", id + 3);
@ -622,6 +639,10 @@ char* tr_clientForId(char* buf, size_t buflen, void const* id_in)
{
tr_snprintf(buf, buflen, "Baidu Netdisk");
}
else if (strncmp(chid + 1, "WS", 2) == 0)
{
no_version(buf, buflen, "HTTP Seed");
}
if (!tr_str_is_empty(buf))
{
@ -647,6 +668,11 @@ char* tr_clientForId(char* buf, size_t buflen, void const* id_in)
tr_snprintf(buf, buflen, "\xc2\xb5Torrent Embedded %d.%d.%d%s", strint(id + 3, 1), strint(id + 4, 1),
strint(id + 5, 2), getMnemonicEnd(id[7]));
}
else if (strncmp(chid + 1, "UW", 2) == 0)
{
tr_snprintf(buf, buflen, "\xc2\xb5Torrent Web %d.%d.%d%s", strint(id + 3, 1), strint(id + 4, 1), strint(id + 5,
2), getMnemonicEnd(id[7]));
}
if (!tr_str_is_empty(buf))
{
@ -788,6 +814,25 @@ char* tr_clientForId(char* buf, size_t buflen, void const* id_in)
{
two_major_two_minor(buf, buflen, "Tixati", id + 3);
}
else if (strncmp(chid, "A2", 2) == 0)
{
if (id[4] == '-' && id[6] == '-' && id[8] == '-')
{
tr_snprintf(buf, buflen, "aria2 %c.%c.%c", id[3], id[5], id[7]);
}
else if (id[4] == '-' && id[7] == '-' && id[9] == '-')
{
tr_snprintf(buf, buflen, "aria2 %c.%c%c.%c", id[3], id[5], id[6], id[8]);
}
else
{
no_version(buf, buflen, "aria2");
}
}
else if (strncmp(chid, "-BL", 3) == 0)
{
tr_snprintf(buf, buflen, "BitLord %c.%c.%c-%c%c%c", id[3], id[4], id[5], id[6], id[7], id[8]);
}
/* Shad0w-style */
if (tr_str_is_empty(buf))

View File

@ -21,7 +21,7 @@ TEST(Client, clientForId)
char const* expected_client;
};
auto const tests = std::array<LocalTest, 24>{
auto const tests = std::array<LocalTest, 32>{
LocalTest{ "-BT791B-", "BitTorrent 7.9.1 (Beta)" },
{ "-BT791\0-", "BitTorrent 7.9.1" },
{ "-FC1013-", "FileCroc 1.0.1.3" },
@ -60,7 +60,16 @@ TEST(Client, clientForId)
{ "-I\05O\x08\x03\x01-", "-I%05O%08%03%01-" },
{ "\x65\x78\x62\x63\x00\x38\x7A\x44\x63\x10\x2D\x6E\x9A\xD6\x72\x3B\x33\x9F\x35\xA9", "BitComet 0.56" },
{ "\x65\x78\x62\x63\x00\x38\x4C\x4F\x52\x44\x32\x00\x04\x8E\xCE\xD5\x7B\xD7\x10\x28", "BitLord 0.56" }
{ "\x65\x78\x62\x63\x00\x38\x4C\x4F\x52\x44\x32\x00\x04\x8E\xCE\xD5\x7B\xD7\x10\x28", "BitLord 0.56" },
{ "-UW110Q-", "\xc2\xb5Torrent Web 1.1.0" },
{ "-FW6830-", "FrostWire 6.8.3" },
{ "-BI2300-", "BiglyBT 2.3.0.0" },
{ "A2-1-18-8-", "aria2 1.18.8" },
{ "A2-1-2-0-", "aria2 1.2.0" },
{ "-BL246326", "BitLord 2.4.6-326" }, // Style used after BitLord 0.59
{ "-WW0007-", "WebTorrent 0.0.0.7" },
{ "-WS1000-", "HTTP Seed" }
};
for (auto const& test : tests)