use random peer IDs in anonymous mode

This commit is contained in:
Arvid Norberg 2012-07-08 22:47:25 +00:00
parent a348eae42d
commit 3d7dc768da
3 changed files with 15 additions and 3 deletions

View File

@ -1,6 +1,7 @@
* fix uTP edge case where udp socket buffer fills up
* fix nagle implementation in uTP
* use random peer IDs in anonymous mode
* fix move_storage bugs
* fix unnecessary dependency on boost.date_time when building boost.asio as separate compilation
* always use SO_REUSEADDR and deprecate the flag to turn it on

View File

@ -757,10 +757,11 @@ namespace libtorrent
// we have none of the files and go straight to download
bool no_recheck_incomplete_resume;
// when this is true, libtorrent will take actions to make sure any
// when this is true, libtorrent will take actions to make sure no
// privacy sensitive information is leaked out from the client. This
// mode is assumed to be combined with using a proxy for all your
// traffic. With this option, your true IP address will not be exposed
// nor anything that can tie your connection to your true IP
bool anonymous_mode;
// the number of milliseconds between internal ticks. Should be no

View File

@ -755,8 +755,18 @@ namespace libtorrent
ptr += 20;
// peer id
memcpy(ptr, &m_ses.get_peer_id()[0], 20);
// ptr += 20;
if (m_ses.m_settings.anonymous_mode)
{
// in anonymous mode, every peer connection
// has a unique peer-id
for (int i = 0; i < 20; ++i)
*ptr++ = rand();
}
else
{
memcpy(ptr, &m_ses.get_peer_id()[0], 20);
// ptr += 20;
}
#ifdef TORRENT_VERBOSE_LOGGING
peer_log("==> HANDSHAKE [ ih: %s ]", to_hex(ih.to_string()).c_str());