fix build with boost-1.36
[libtorrent.git] / docs / dht_extensions.html
blob4fda3f42f54d9e972bfc7bd3e642629292972dc4
1 <?xml version="1.0" encoding="utf-8" ?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6 <meta name="generator" content="Docutils 0.5: http://docutils.sourceforge.net/" />
7 <title></title>
8 <meta name="author" content="Arvid Norberg, arvid&#64;rasterbar.com" />
9 <link rel="stylesheet" href="style.css" type="text/css" />
10 </head>
11 <body>
12 <div class="document">
14 <table class="docinfo" frame="void" rules="none">
15 <col class="docinfo-name" />
16 <col class="docinfo-content" />
17 <tbody valign="top">
18 <tr><th class="docinfo-name">Author:</th>
19 <td>Arvid Norberg, <a class="last reference" href="mailto:arvid&#64;rasterbar.com">arvid&#64;rasterbar.com</a></td></tr>
20 </tbody>
21 </table>
22 <div class="section">
23 <h1><a id="mainline-dht-extensions" name="mainline-dht-extensions">Mainline DHT extensions</a></h1>
24 <p>libtorrent implements a few extensions to the Mainline DHT protocol.</p>
25 <div class="section">
26 <h2><a id="client-identification" name="client-identification">client identification</a></h2>
27 <p>In each DHT packet, an extra key is inserted named &quot;v&quot;. This is a string
28 describing the client and version used. This can help alot when debugging
29 and finding errors in client implementations. The string is encoded as four
30 characters, two characters describing the client and two characters interpreted
31 as a binary number describing the client version.</p>
32 <p>Currently known clients:</p>
33 <table border="1" class="docutils">
34 <colgroup>
35 <col width="65%" />
36 <col width="35%" />
37 </colgroup>
38 <tbody valign="top">
39 <tr><td>uTorrent</td>
40 <td><tt class="docutils literal"><span class="pre">UT</span></tt></td>
41 </tr>
42 <tr><td>libtorrent</td>
43 <td><tt class="docutils literal"><span class="pre">LT</span></tt></td>
44 </tr>
45 <tr><td>MooPolice</td>
46 <td><tt class="docutils literal"><span class="pre">MP</span></tt></td>
47 </tr>
48 <tr><td>GetRight</td>
49 <td><tt class="docutils literal"><span class="pre">GR</span></tt></td>
50 </tr>
51 </tbody>
52 </table>
53 </div>
54 <div class="section">
55 <h2><a id="ipv6-support" name="ipv6-support">IPv6 support</a></h2>
56 <p>The DHT messages that don't support IPv6 are the <tt class="docutils literal"><span class="pre">nodes</span></tt> replies.
57 They encode all the contacts as 6 bytes packed together in sequence in a
58 string. The problem is that IPv6 endpoints cannot be encoded as 6 bytes, but
59 needs 18 bytes. The extension libtorrent applies is to add another key, called
60 <tt class="docutils literal"><span class="pre">nodes2</span></tt>.</p>
61 <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
62 as a list of strings. Each string represents one contact and is encoded as 20
63 bytes node-id and then a variable length encoded IP address (6 bytes in IPv4 case
64 and 18 bytes in IPv6 case).</p>
65 <p>As an optimization, libtorrent does not include the extra key in case there are
66 only IPv4 nodes present.</p>
67 </div>
68 </div>
69 </div>
70 </body>
71 </html>