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">
5
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
<meta name="generator" content="Docutils 0.5: http://docutils.sourceforge.net/" />
8
<meta name="author" content="Arvid Norberg, arvid@rasterbar.com" />
9
<link rel="stylesheet" type="text/css" href="../../css/base.css" />
10
<link rel="stylesheet" type="text/css" href="../../css/rst.css" />
11
<link rel="stylesheet" href="style.css" type="text/css" />
12
<style type="text/css">
13
/* Hides from IE-mac \*/
14
* html pre { height: 1%; }
15
/* End hide from IE-mac */
19
<div class="document">
23
<li class="first"><a href="/">Home</a></li>
24
<li><a href="../../products.html">Products</a></li>
25
<li><a href="../../contact.html">Contact</a></li>
29
<h1><span>Rasterbar Software</span></h1>
30
<h2><span>Software developement and consulting</span></h2>
34
<table class="docinfo" frame="void" rules="none">
35
<col class="docinfo-name" />
36
<col class="docinfo-content" />
38
<tr><th class="docinfo-name">Author:</th>
39
<td>Arvid Norberg, <a class="last reference external" href="mailto:arvid@rasterbar.com">arvid@rasterbar.com</a></td></tr>
42
<div class="section" id="mainline-dht-extensions">
43
<h1>Mainline DHT extensions</h1>
44
<p>libtorrent implements a few extensions to the Mainline DHT protocol.</p>
45
<div class="section" id="client-identification">
46
<h2>client identification</h2>
47
<p>In each DHT packet, an extra key is inserted named "v". This is a string
48
describing the client and version used. This can help alot when debugging
49
and finding errors in client implementations. The string is encoded as four
50
characters, two characters describing the client and two characters interpreted
51
as a binary number describing the client version.</p>
52
<p>Currently known clients:</p>
53
<table border="1" class="docutils">
60
<td><tt class="docutils literal"><span class="pre">UT</span></tt></td>
62
<tr><td>libtorrent</td>
63
<td><tt class="docutils literal"><span class="pre">LT</span></tt></td>
65
<tr><td>MooPolice</td>
66
<td><tt class="docutils literal"><span class="pre">MP</span></tt></td>
69
<td><tt class="docutils literal"><span class="pre">GR</span></tt></td>
74
<div class="section" id="ipv6-support">
76
<p>The DHT messages that don't support IPv6 are the <tt class="docutils literal"><span class="pre">nodes</span></tt> replies.
77
They encode all the contacts as 6 bytes packed together in sequence in a
78
string. The problem is that IPv6 endpoints cannot be encoded as 6 bytes, but
79
needs 18 bytes. The extension libtorrent applies is to add another key, called
80
<tt class="docutils literal"><span class="pre">nodes2</span></tt>.</p>
81
<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
82
as a list of strings. Each string represents one contact and is encoded as 20
83
bytes node-id and then a variable length encoded IP address (6 bytes in IPv4 case
84
and 18 bytes in IPv6 case).</p>
85
<p>As an optimization, libtorrent does not include the extra key in case there are
86
only IPv4 nodes present.</p>
91
<span>Copyright © 2005 Rasterbar Software.</span>
94
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
96
<script type="text/javascript">
97
_uacct = "UA-1599045-1";