2010-06-17

web で公開しているファイル群を BitTorrent で配布するには

HTTP で公開しているファイル (群) を BitTorrent (BitTorrent プロトコル仕様書) で配布する方法を調べ,特定のクライアントでのダウンロードに成功した.

BitTorrent プロトコルの拡張には,Web Seeding (Wikipedia 英語版) という方法がある.また,トラッカーなしで配布を行なうことができる trackerless と呼ばれる方法もある.ここでは,この 2 つの条件を入れた配布を目指した.

配布したいファイルが大量にあるばあい,command line で torrent ファイルが生成できることが望ましい.command line ツールとしては,Buildtorrent がある.以下のようにして torrent ファイルを生成した.同じく command line ツールの mktorrent - Create BitTorrent metainfo files from command line は試さなかった.

ls -1 directory(s)/file(s) | sed 's:^\(.*\)$:\1|\1:' \
| buildtorrent -q -m -p 0 または 1 -a 'dht://trackerless.dht/announce' -w web site の URL -f - -n name torrent ファイル

web seeding における配布ファイルの URL 指定の方法はトリッキーで,HTTP/FTP WebSeeding Method for BitTorrent - GetRight Download ManagerHow to make torrent file with web seed and multiple files ? - Forums - µTorrent - The Lightweight and Efficient BitTorrent Client で解説されている.上のように生成した torrent は,web site の URL/name/directory(s)/file(s) を URL とするファイル (群) の配布を実現する.

オプション Announce URL -a は Buildtorrent では必須であるが,trackerless torrent ではこのフィールドはない (DHT Protocol).ここでは無効な URL を与えてみた.

Vuze ではこの torrent をダウンロードすることができた (Mac OS 10.6 X および Windows XP).Mainline BitTorrentµTorrent および Transmission のいずれもこれをダウンロードすることはできなかった (すべて Mac OS X 10.6).原因は追及していないが,Announce URL が無効なこと,BitTorrent seeder がないこと,あるいはこれら両方かもしれない.

つづいた.