forked from premiere/premiere-libtorrent
client test now always uses dht. fixed problem with the dht logging and updated dht extension docs.
This commit is contained in:
parent
6f0a0beadb
commit
2dbfa156d3
|
@ -19,11 +19,11 @@
|
|||
<td>Arvid Norberg, <a class="last reference" href="mailto:arvid@rasterbar.com">arvid@rasterbar.com</a></td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="section">
|
||||
<h1><a id="mainline-dht-extensions" name="mainline-dht-extensions">Mainline DHT extensions</a></h1>
|
||||
<div class="section" id="mainline-dht-extensions">
|
||||
<h1>Mainline DHT extensions</h1>
|
||||
<p>libtorrent implements a few extensions to the Mainline DHT protocol.</p>
|
||||
<div class="section">
|
||||
<h2><a id="client-identification" name="client-identification">client identification</a></h2>
|
||||
<div class="section" id="client-identification">
|
||||
<h2>client identification</h2>
|
||||
<p>In each DHT packet, an extra key is inserted named "v". This is a string
|
||||
describing the client and version used. This can help alot when debugging
|
||||
and finding errors in client implementations. The string is encoded as four
|
||||
|
@ -51,15 +51,19 @@ as a binary number describing the client version.</p>
|
|||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="section">
|
||||
<h2><a id="ipv6-support" name="ipv6-support">IPv6 support</a></h2>
|
||||
<p>The only DHT messages that don't support IPv6 is the <tt class="docutils literal"><span class="pre">nodes</span></tt> reply. It
|
||||
encodes all the contacts as 6 bytes sequences packed together in sequence in
|
||||
<div class="section" id="ipv6-support">
|
||||
<h2>IPv6 support</h2>
|
||||
<p>The DHT messages that don't support IPv6 are the <tt class="docutils literal"><span class="pre">nodes</span></tt> replies.
|
||||
They encode all the contacts as 6 bytes packed together in sequence in a
|
||||
string. The problem is that IPv6 endpoints cannot be encoded as 6 bytes, but
|
||||
needs 18 bytes. The extension libtorrent applies is to add another key, called
|
||||
<tt class="docutils literal"><span class="pre">nodes2</span></tt> which is encoded as a list of strings. Each string represents one
|
||||
contact and is encoded as 20 bytes node-id and then a variable length encoded
|
||||
IP address (6 bytes in IPv4 case and 18 bytes in IPv6 case).</p>
|
||||
<tt class="docutils literal"><span class="pre">nodes2</span></tt>.</p>
|
||||
<p><tt class="docutils literal"><span class="pre">nodes2</span></tt> may be present in replies that contains a <tt class="docutils literal"><span class="pre">nodes</span></tt> key. It is encoded
|
||||
as a list of strings. Each string represents one contact and is encoded as 20
|
||||
bytes node-id and then a variable length encoded IP address (6 bytes in IPv4 case
|
||||
and 18 bytes in IPv6 case).</p>
|
||||
<p>As an optimization, libtorrent does not include the extra key in case there are
|
||||
only IPv4 nodes present.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -29,12 +29,17 @@ Currently known clients:
|
|||
IPv6 support
|
||||
------------
|
||||
|
||||
The only DHT messages that don't support IPv6 is the ``nodes`` reply. It
|
||||
encodes all the contacts as 6 bytes sequences packed together in sequence in
|
||||
The DHT messages that don't support IPv6 are the ``nodes`` replies.
|
||||
They encode all the contacts as 6 bytes packed together in sequence in a
|
||||
string. The problem is that IPv6 endpoints cannot be encoded as 6 bytes, but
|
||||
needs 18 bytes. The extension libtorrent applies is to add another key, called
|
||||
``nodes2`` which is encoded as a list of strings. Each string represents one
|
||||
contact and is encoded as 20 bytes node-id and then a variable length encoded
|
||||
IP address (6 bytes in IPv4 case and 18 bytes in IPv6 case).
|
||||
``nodes2``.
|
||||
|
||||
``nodes2`` may be present in replies that contains a ``nodes`` key. It is encoded
|
||||
as a list of strings. Each string represents one contact and is encoded as 20
|
||||
bytes node-id and then a variable length encoded IP address (6 bytes in IPv4 case
|
||||
and 18 bytes in IPv6 case).
|
||||
|
||||
As an optimization, libtorrent does not include the extra key in case there are
|
||||
only IPv4 nodes present.
|
||||
|
||||
|
|
|
@ -588,6 +588,8 @@ int main(int ac, char* av[])
|
|||
ses.add_extension(&create_ut_pex_plugin);
|
||||
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
settings.use_dht_as_fallback = false;
|
||||
|
||||
dht_settings s;
|
||||
s.service_port = listen_port;
|
||||
ses.set_dht_settings(s);
|
||||
|
|
|
@ -133,7 +133,7 @@ public:
|
|||
#define TORRENT_DEFINE_LOG(name) \
|
||||
libtorrent::dht::log& name ## _log() \
|
||||
{ \
|
||||
static std::ofstream log_file("libtorrent_logs/dht.log", std::ios::app); \
|
||||
static std::ofstream log_file("dht.log", std::ios::app); \
|
||||
static libtorrent::dht::log instance(#name, log_file); \
|
||||
return instance; \
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue