premiere-libtorrent/docs/dht_extensions.html

72 lines
3.1 KiB
HTML
Raw Normal View History

<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.5: http://docutils.sourceforge.net/" />
<title></title>
<meta name="author" content="Arvid Norberg, arvid&#64;rasterbar.com" />
<link rel="stylesheet" href="style.css" type="text/css" />
</head>
<body>
<div class="document">
<table class="docinfo" frame="void" rules="none">
<col class="docinfo-name" />
<col class="docinfo-content" />
<tbody valign="top">
<tr><th class="docinfo-name">Author:</th>
<td>Arvid Norberg, <a class="last reference" href="mailto:arvid&#64;rasterbar.com">arvid&#64;rasterbar.com</a></td></tr>
</tbody>
</table>
2007-06-06 02:41:20 +02:00
<div class="section">
<h1><a id="mainline-dht-extensions" name="mainline-dht-extensions">Mainline DHT extensions</a></h1>
<p>libtorrent implements a few extensions to the Mainline DHT protocol.</p>
2007-06-06 02:41:20 +02:00
<div class="section">
<h2><a id="client-identification" name="client-identification">client identification</a></h2>
<p>In each DHT packet, an extra key is inserted named &quot;v&quot;. 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
characters, two characters describing the client and two characters interpreted
as a binary number describing the client version.</p>
<p>Currently known clients:</p>
<table border="1" class="docutils">
<colgroup>
<col width="65%" />
<col width="35%" />
</colgroup>
<tbody valign="top">
<tr><td>uTorrent</td>
<td><tt class="docutils literal"><span class="pre">UT</span></tt></td>
</tr>
<tr><td>libtorrent</td>
<td><tt class="docutils literal"><span class="pre">LT</span></tt></td>
</tr>
<tr><td>MooPolice</td>
<td><tt class="docutils literal"><span class="pre">MP</span></tt></td>
</tr>
<tr><td>GetRight</td>
<td><tt class="docutils literal"><span class="pre">GR</span></tt></td>
</tr>
</tbody>
</table>
</div>
2007-06-06 02:41:20 +02:00
<div class="section">
<h2><a id="ipv6-support" name="ipv6-support">IPv6 support</a></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>.</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>
</body>
</html>