| 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 | <link rel="stylesheet" href="../css/bep.css" type="text/css" /> |
|---|
| 9 | </head> |
|---|
| 10 | <body> |
|---|
| 11 | <div class="document"> |
|---|
| 12 | |
|---|
| 13 | <div id="upper" class="clear"> |
|---|
| 14 | <div id="wrap"> |
|---|
| 15 | <div id="header"> |
|---|
| 16 | <h1><a href="../index.html">BitTorrent<span>.org</span></a></h1> |
|---|
| 17 | </div> |
|---|
| 18 | <div id="nav"> |
|---|
| 19 | <ul> |
|---|
| 20 | <li><a href="../index.html">Home</a></li> |
|---|
| 21 | <li><a href="../introduction.html">For Users</a></li> |
|---|
| 22 | <li><a href="bep_0000.html"><span>For Developers</span></a></li> |
|---|
| 23 | <!-- <li><a href="./blog">Blog</a></li> --> |
|---|
| 24 | <li><a href="http://forum.bittorrent.org"> Forums </li> |
|---|
| 25 | <li><a href="../donate.html">Donate!</a></li> |
|---|
| 26 | </ul> |
|---|
| 27 | </div> <!-- nav --> |
|---|
| 28 | <!-- ### Begin Content ### --> |
|---|
| 29 | <div id="second"> |
|---|
| 30 | |
|---|
| 31 | |
|---|
| 32 | |
|---|
| 33 | <table class="rfc2822 docutils field-list" frame="void" rules="none"> |
|---|
| 34 | <col class="field-name" /> |
|---|
| 35 | <col class="field-body" /> |
|---|
| 36 | <tbody valign="top"> |
|---|
| 37 | <tr class="field"><th class="field-name">BEP:</th><td class="field-body">26</td> |
|---|
| 38 | </tr> |
|---|
| 39 | <tr class="field"><th class="field-name">Title:</th><td class="field-body">Zeroconf Peer Advertising and Discovery</td> |
|---|
| 40 | </tr> |
|---|
| 41 | <tr class="field"><th class="field-name">Version:</th><td class="field-body">11105</td> |
|---|
| 42 | </tr> |
|---|
| 43 | <tr class="field"><th class="field-name">Last-Modified:</th><td class="field-body"><a class="reference external" href="http://bittorrent.org/trac/browser/dotorg/trunk/html/beps/bep_0026.rst">2008-05-27 20:57:09 -0700 (Tue, 27 May 2008)</a></td> |
|---|
| 44 | </tr> |
|---|
| 45 | <tr class="field"><th class="field-name">Author:</th><td class="field-body">Robin Perkins <robin DOT perkins AT internode DOT on DOT net></td> |
|---|
| 46 | </tr> |
|---|
| 47 | <tr class="field"><th class="field-name">Status:</th><td class="field-body">Draft</td> |
|---|
| 48 | </tr> |
|---|
| 49 | <tr class="field"><th class="field-name">Type:</th><td class="field-body">Standards Track</td> |
|---|
| 50 | </tr> |
|---|
| 51 | <tr class="field"><th class="field-name">Content-Type:</th><td class="field-body"><a class="reference external" href="http://www.bittorrent.org/beps/bep-0012">text/x-rst</a></td> |
|---|
| 52 | </tr> |
|---|
| 53 | <tr class="field"><th class="field-name">Created:</th><td class="field-body">10-May-2008</td> |
|---|
| 54 | </tr> |
|---|
| 55 | <tr class="field"><th class="field-name">Post-History:</th><td class="field-body"></td> |
|---|
| 56 | </tr> |
|---|
| 57 | </tbody> |
|---|
| 58 | </table> |
|---|
| 59 | <hr /> |
|---|
| 60 | <div class="contents topic" id="contents"> |
|---|
| 61 | <p class="topic-title first">Contents</p> |
|---|
| 62 | <ul class="simple"> |
|---|
| 63 | <li><a class="reference internal" href="#abstract" id="id16">Abstract</a></li> |
|---|
| 64 | <li><a class="reference internal" href="#rationale" id="id17">Rationale</a></li> |
|---|
| 65 | <li><a class="reference internal" href="#requirements" id="id18">Requirements</a></li> |
|---|
| 66 | <li><a class="reference internal" href="#method" id="id19">Method</a></li> |
|---|
| 67 | <li><a class="reference internal" href="#considerations" id="id20">Considerations</a></li> |
|---|
| 68 | <li><a class="reference internal" href="#thoughts" id="id21">Thoughts</a></li> |
|---|
| 69 | <li><a class="reference internal" href="#references" id="id22">References</a></li> |
|---|
| 70 | <li><a class="reference internal" href="#copyright" id="id23">Copyright</a></li> |
|---|
| 71 | </ul> |
|---|
| 72 | </div> |
|---|
| 73 | <div class="section" id="abstract"> |
|---|
| 74 | <h1>Abstract</h1> |
|---|
| 75 | <p><a class="reference external" href="ZeroConfigurationNetworking(Zeroconf)http://www.zeroconf.org">Zeroconf</a> <a class="footnote-reference" href="#id1" id="id2">[1]</a> is a collection of protocols including ipv4 link local |
|---|
| 76 | networking, <a class="reference external" href="MulticastDomainNameSystem(mDNS)http://www.multicastdns.org">mDNS</a> <a class="footnote-reference" href="#id3" id="id4">[2]</a>, and <a class="reference external" href="DNSservice-discovery(DNS-SD)http://www.dns-sd.org">DNS service-discovery</a> <a class="footnote-reference" href="#id5" id="id6">[3]</a>. This document aims |
|---|
| 77 | to outline an extension for BitTorrent clients to allow them to find |
|---|
| 78 | peers on a local-link network using the zeroconf <a class="reference external" href="DNSservice-discovery(DNS-SD)http://www.dns-sd.org">DNS |
|---|
| 79 | service-discovery</a> <a class="footnote-reference" href="#id5" id="id7">[3]</a> system. It was written in the hope that clients |
|---|
| 80 | could standardise the way in which they found peers on the local-link |
|---|
| 81 | in order to maximize the functionality of the BitTorrent protocol.</p> |
|---|
| 82 | </div> |
|---|
| 83 | <div class="section" id="rationale"> |
|---|
| 84 | <h1>Rationale</h1> |
|---|
| 85 | <p>Many networks today consist of computers that have a fast network |
|---|
| 86 | connection (tens or hundreds of megabits/s) to a local area network, |
|---|
| 87 | in addition to a relatively slower (hundreds of kilobits/s or a few |
|---|
| 88 | megabits/s) connection to the wider internet. Such networks exist in |
|---|
| 89 | places such as university colleges, defence barracks and community |
|---|
| 90 | wifi networks. If two hosts on the same (fast) local-link network |
|---|
| 91 | wish to download the same torrent at the moment they only share |
|---|
| 92 | packets across their slow internet connection. The BitTorrent Zeroconf |
|---|
| 93 | Peer Advertising and Discovery Extension will allow automatic |
|---|
| 94 | discovery of these peers to each other so that packets can be quickly |
|---|
| 95 | transfered across the fast local network as opposed to across their |
|---|
| 96 | slow internet connections. Effectively the effort of downloading the |
|---|
| 97 | torrent can now be distributed between the hosts on a local-link |
|---|
| 98 | network.</p> |
|---|
| 99 | </div> |
|---|
| 100 | <div class="section" id="requirements"> |
|---|
| 101 | <h1>Requirements</h1> |
|---|
| 102 | <p>In order to facilitate the BitTorrent Zeroconf Peer Advertising and |
|---|
| 103 | Discovery Extension each host is going to be required to run a |
|---|
| 104 | zeroconf service discovery daemon. This is relatively trivial as there |
|---|
| 105 | are many available for free but two particularly good zeroconf |
|---|
| 106 | implementations are:</p> |
|---|
| 107 | <ol class="arabic simple"> |
|---|
| 108 | <li>Apple's <a class="reference external" href="Apple'sBonjourhttp://developer.apple.com/networking/bonjour/">Bonjour</a> <a class="footnote-reference" href="#id11" id="id12">[5]</a> for Mac OS X (included by default), Windows and POSIX systems</li> |
|---|
| 109 | <li><a class="reference external" href="Avahihttp://www.avahi.org">Avahi</a> <a class="footnote-reference" href="#id8" id="id9">[4]</a> recommended for Linux and BSD clients and already available in many Linux and BSD distributions.</li> |
|---|
| 110 | </ol> |
|---|
| 111 | <p>Note that you can only run one zeroconf instance per host due to it |
|---|
| 112 | binding to specific ports on your network interfaces, so it is <strong>not</strong> |
|---|
| 113 | recommended to build the whole zeroconf daemon/server into your |
|---|
| 114 | client. It is much better plug into a system wide service using the |
|---|
| 115 | API's: it cuts down your code and allows other services e.g. http, ftp |
|---|
| 116 | to advertise themselves using the same daemon.</p> |
|---|
| 117 | </div> |
|---|
| 118 | <div class="section" id="method"> |
|---|
| 119 | <h1>Method</h1> |
|---|
| 120 | <p>Each host will be required to publish (via zeroconf) the service type |
|---|
| 121 | _bittorrent._tcp. with the instance name as the torrent peer-id (in |
|---|
| 122 | hex).</p> |
|---|
| 123 | <p><tt class="docutils literal"><span class="pre"><peer-id>._bittorrent._tcp.</span></tt></p> |
|---|
| 124 | <p>Then clients need publish a subservice that is the torrent info hash (in hex). The result will be something in the form of:</p> |
|---|
| 125 | <p><tt class="docutils literal"><span class="pre"><peer-id>._<info-hash>._sub._bittorrent._tcp.</span></tt> |
|---|
| 126 | e.g. |
|---|
| 127 | <tt class="docutils literal"><span class="pre">4d336d342d312d2d343834616435313564343437._32f17bbf96bdc77de85bb91ff8d56f124e817c0a._sub._bittorrent._tcp.</span></tt></p> |
|---|
| 128 | <p>The above-mentioned zeroconf implementations provide good |
|---|
| 129 | documentation for developers on how to do this. If the client uses the |
|---|
| 130 | same peer-id for all torrents it has loaded, then for each additional |
|---|
| 131 | torrent file, only the subservice needs to be added. If the client |
|---|
| 132 | uses a different peer-id for each torrent then a |
|---|
| 133 | _bittorrent._tcp. service will have to be added for each torrent file |
|---|
| 134 | with the respective subservice. This is also true if each torrent uses |
|---|
| 135 | a different port.</p> |
|---|
| 136 | <p>In simple terms you can publish subtypes using the Apple Bonjour API |
|---|
| 137 | by passing them as a comma separated list after the service type (you |
|---|
| 138 | don't need to pass in the "_sub" label, since mDNSResponder will |
|---|
| 139 | automatically add it for you).</p> |
|---|
| 140 | <p><tt class="docutils literal"><span class="pre">"_bittorrent._tcp,_info-hash1,_info-hash2,_info-hash3"</span></tt></p> |
|---|
| 141 | <p>For the Avahi C API use the function |
|---|
| 142 | <tt class="docutils literal"><span class="pre">avahi_entry_group_add_service()</span></tt> to establish the parent |
|---|
| 143 | _bittorrent._tcp service and |
|---|
| 144 | <tt class="docutils literal"><span class="pre">avahi_entry_group_add_service_subtype()</span></tt> with |
|---|
| 145 | <tt class="docutils literal"><span class="pre">_<info-hash>._sub._bittorrent._tcp.</span></tt> as the 'type' parameter to |
|---|
| 146 | establish the subservices. For both functions the <peer-id> should be |
|---|
| 147 | used for the 'name' parameter.</p> |
|---|
| 148 | <p>Clients will need to browse for _<info-hash>._sub._bittorrent._tcp in |
|---|
| 149 | order to discover peers participating in the same torrent. Once again |
|---|
| 150 | good documentation is provided on how to browse for zeroconf services |
|---|
| 151 | in the above implementations. The replies will be in the form of |
|---|
| 152 | <peer-id>._bittorrent._tcp. Note: Some Macintosh official bittorrent |
|---|
| 153 | clients have a zeroconf implementation built in that publishes its |
|---|
| 154 | services in the form of:</p> |
|---|
| 155 | <p><tt class="docutils literal"><span class="pre">_bittorrent-<info-hash>._tcp.</span></tt> |
|---|
| 156 | i.e. |
|---|
| 157 | <tt class="docutils literal"><span class="pre">_bittorrent-32f17bbf96bdc77de85bb91ff8d56f124e817c0a._tcp.</span></tt></p> |
|---|
| 158 | <p>However this does not comply with <a class="reference external" href="http://www.faqs.org/rfcs/rfc2782.html">RFC 2782</a> as the service name needs |
|---|
| 159 | to be 14 characters or less in addition to the fact that it is not a |
|---|
| 160 | service type but in fact a service instance it is advertising. Clients |
|---|
| 161 | may choose to also browse for these services for backwards |
|---|
| 162 | compatibility purposes (minimal effect - only one client is known to |
|---|
| 163 | do this) however they should not publish in this format.</p> |
|---|
| 164 | </div> |
|---|
| 165 | <div class="section" id="considerations"> |
|---|
| 166 | <h1>Considerations</h1> |
|---|
| 167 | <p>Clients should consider a couple of options when implementing the |
|---|
| 168 | BitTorrent Zeroconf Peer Advertising and Discovery Extension |
|---|
| 169 | specifically:</p> |
|---|
| 170 | <ul class="simple"> |
|---|
| 171 | <li>an option to not advertise torrents via zeroconf</li> |
|---|
| 172 | <li>an option not to upload limit local-link peers (or possibly have a separate rule).</li> |
|---|
| 173 | </ul> |
|---|
| 174 | </div> |
|---|
| 175 | <div class="section" id="thoughts"> |
|---|
| 176 | <h1>Thoughts</h1> |
|---|
| 177 | <ul class="simple"> |
|---|
| 178 | <li>I suspect the published peer-id need not be the hexed string as I |
|---|
| 179 | have it now. A simple unique string may be all that is required |
|---|
| 180 | (i.e. a hostname or a human readable computer name) with any |
|---|
| 181 | uniqueness conflicts handled by zeroconf automatically. We |
|---|
| 182 | ultimately only need to know what is on offer (as denoted by the |
|---|
| 183 | info-hash) and where to get it (the resolved IP address).</li> |
|---|
| 184 | <li>The mainline client and others may like to examine |
|---|
| 185 | <a class="reference external" href="pybonjourhttp://o2s.csail.mit.edu/o2s-wiki/pybonjour">pybonjour</a> <a class="footnote-reference" href="#id14" id="id15">[6]</a>. pybonjour provides a pure-Python interface to Apple |
|---|
| 186 | <a class="reference external" href="Apple'sBonjourhttp://developer.apple.com/networking/bonjour/">Bonjour</a> <a class="footnote-reference" href="#id11" id="id13">[5]</a> and compatible DNS-SD libraries (such as <a class="reference external" href="Avahihttp://www.avahi.org">Avahi</a> <a class="footnote-reference" href="#id8" id="id10">[4]</a>).</li> |
|---|
| 187 | <li>Newer zeroconf implementations such as Bonjour include support for |
|---|
| 188 | wide area service discovery. (Avahi can browse but not publish these |
|---|
| 189 | yet). This may be another consideration in support of this BEP.</li> |
|---|
| 190 | <li>May make a nice companion to BEP 9.</li> |
|---|
| 191 | </ul> |
|---|
| 192 | </div> |
|---|
| 193 | <div class="section" id="references"> |
|---|
| 194 | <h1>References</h1> |
|---|
| 195 | <table class="docutils footnote" frame="void" id="id1" rules="none"> |
|---|
| 196 | <colgroup><col class="label" /><col /></colgroup> |
|---|
| 197 | <tbody valign="top"> |
|---|
| 198 | <tr><td class="label"><a class="fn-backref" href="#id2">[1]</a></td><td><a class="reference external" href="ZeroConfigurationNetworking(Zeroconf)http://www.zeroconf.org">ZeroConfigurationNetworking(Zeroconf)http://www.zeroconf.org</a></td></tr> |
|---|
| 199 | </tbody> |
|---|
| 200 | </table> |
|---|
| 201 | <table class="docutils footnote" frame="void" id="id3" rules="none"> |
|---|
| 202 | <colgroup><col class="label" /><col /></colgroup> |
|---|
| 203 | <tbody valign="top"> |
|---|
| 204 | <tr><td class="label"><a class="fn-backref" href="#id4">[2]</a></td><td><a class="reference external" href="MulticastDomainNameSystem(mDNS)http://www.multicastdns.org">MulticastDomainNameSystem(mDNS)http://www.multicastdns.org</a></td></tr> |
|---|
| 205 | </tbody> |
|---|
| 206 | </table> |
|---|
| 207 | <table class="docutils footnote" frame="void" id="id5" rules="none"> |
|---|
| 208 | <colgroup><col class="label" /><col /></colgroup> |
|---|
| 209 | <tbody valign="top"> |
|---|
| 210 | <tr><td class="label">[3]</td><td><em>(<a class="fn-backref" href="#id6">1</a>, <a class="fn-backref" href="#id7">2</a>)</em> <a class="reference external" href="DNSservice-discovery(DNS-SD)http://www.dns-sd.org">DNSservice-discovery(DNS-SD)http://www.dns-sd.org</a></td></tr> |
|---|
| 211 | </tbody> |
|---|
| 212 | </table> |
|---|
| 213 | <table class="docutils footnote" frame="void" id="id8" rules="none"> |
|---|
| 214 | <colgroup><col class="label" /><col /></colgroup> |
|---|
| 215 | <tbody valign="top"> |
|---|
| 216 | <tr><td class="label">[4]</td><td><em>(<a class="fn-backref" href="#id9">1</a>, <a class="fn-backref" href="#id10">2</a>)</em> <a class="reference external" href="Avahihttp://www.avahi.org">Avahihttp://www.avahi.org</a></td></tr> |
|---|
| 217 | </tbody> |
|---|
| 218 | </table> |
|---|
| 219 | <table class="docutils footnote" frame="void" id="id11" rules="none"> |
|---|
| 220 | <colgroup><col class="label" /><col /></colgroup> |
|---|
| 221 | <tbody valign="top"> |
|---|
| 222 | <tr><td class="label">[5]</td><td><em>(<a class="fn-backref" href="#id12">1</a>, <a class="fn-backref" href="#id13">2</a>)</em> <a class="reference external" href="Apple'sBonjourhttp://developer.apple.com/networking/bonjour/">Apple'sBonjourhttp://developer.apple.com/networking/bonjour/</a></td></tr> |
|---|
| 223 | </tbody> |
|---|
| 224 | </table> |
|---|
| 225 | <table class="docutils footnote" frame="void" id="id14" rules="none"> |
|---|
| 226 | <colgroup><col class="label" /><col /></colgroup> |
|---|
| 227 | <tbody valign="top"> |
|---|
| 228 | <tr><td class="label"><a class="fn-backref" href="#id15">[6]</a></td><td><a class="reference external" href="pybonjourhttp://o2s.csail.mit.edu/o2s-wiki/pybonjour">pybonjourhttp://o2s.csail.mit.edu/o2s-wiki/pybonjour</a></td></tr> |
|---|
| 229 | </tbody> |
|---|
| 230 | </table> |
|---|
| 231 | </div> |
|---|
| 232 | <div class="section" id="copyright"> |
|---|
| 233 | <h1>Copyright</h1> |
|---|
| 234 | <p>This document has been placed in the public domain.</p> |
|---|
| 235 | <!-- Local Variables: |
|---|
| 236 | mode: indented-text |
|---|
| 237 | indent-tabs-mode: nil |
|---|
| 238 | sentence-end-double-space: t |
|---|
| 239 | fill-column: 70 |
|---|
| 240 | coding: utf-8 |
|---|
| 241 | End: --> |
|---|
| 242 | </div> |
|---|
| 243 | |
|---|
| 244 | |
|---|
| 245 | </div> |
|---|
| 246 | <div id="footer"> |
|---|
| 247 | <hr/> |
|---|
| 248 | </div> |
|---|
| 249 | |
|---|
| 250 | </div> |
|---|
| 251 | </body> |
|---|
| 252 | </html> |
|---|