added anonymous mode to disable some particular features that might give away the user's and the client's identity

This commit is contained in:
Arvid Norberg
2010-04-13 04:30:34 +00:00
parent 8e3c5f45e3
commit 384bfdec48
16 changed files with 419 additions and 187 deletions

View File

@@ -103,6 +103,19 @@ namespace libtorrent
return bool(std::strchr(ws, c));
}
// generate a url-safe random string
void url_random(char* begin, char* end)
{
// http-accepted characters:
// excluding ', since some buggy trackers don't support that
static char const printable[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz-_.!~*()";
// the random number
while (begin != end)
*begin++ = printable[rand() % (sizeof(printable)-1)];
}
char to_lower(char c)
{
return (c >= 'A' && c <= 'Z') ? c - 'A' + 'a' : c;