30 06 | 2011

Un nouveau générateur de métainfo BitTorrent

Written by Tanguy

Classified in : Homepage, Auto-hébergement, Debian-FR, Libre, April

Essai de la DHT BitTorrent

Il y a un mois, constatant qu'il manquait un bon logiciel traqueur BitTorrent (bon signifiant « remplissant mes critères arbitraires »), j'envisageai d'écrire un nouveau traqueur. Quelqu'un me fit alors remarquer que je pouvais essayer d'utiliser la table de hachage dynamique ou DHT, une extension BitTorrent qui permet de se passer d'un traqueur, en se reposant sur l'ensemble des clients BitTorrent pour effectuer le travail de traque.

De fait, la DHT pourrait bien être une solution élégante à ce problème, parce qu'elle présente plusieurs avantages :

  • elle repose sur les clients BitTorrent eux-mêmes, qui sont bien plus répandus que les traqueurs, et par conséquent plus développés ;
  • cette fonctionnalité semble être assez bien adoptée par les logiciels clients BitTorrent usuels ;
  • elle existe déjà et semble fonctionner plutôt bien !

J'étais donc parti pour essayer la distribution de torrents sans traqueur en utilisant la DHT. Mais avec BitTorrent, la distribution d'un fichier est amorcée en utilisant des fichiers métainfo, communément appelés « fichiers torrent » ou simplement « torrents » : j'avais donc besoin d'un outil pour générer des fichiers métainfo sans traqueur.

Écriture d'un nouveau générateur de métainfo

Je n'ai pas trouvé de tel outil. Les générateurs que j'ai trouvé n'implémentent pas cette extension et sont codés en C de façon assez complexe, ce dans quoi je ne souhaitais vraiment pas me lancer afin de les compléter. Voici donc gentorrent, un générateur de métainfo BitTorrent écrit en Python 3 et distribué sous licence AGPLv3, ce qui s'est avéré plutôt simple.

Je pense qu'il est assez rapide : il lui faut environ dix secondes pour calculer la métainfo pour un fichier d'un gibioctet. Il implémente toutes les extensions BitTorrent relatives aux fichiers métainfo, comme les torrents sans traqueur, la mise à disposition par HTTP/FTP ou les arbres de Merkle. N'hésitez pas à l'essayer et à m'envoyer des remarques, des critiques ou des suggestion de noms plus sympa.

Maintenant que j'ai un outil pour générer des torrents sans traqueur, je vais essayer la DHT de façon plus extensive et documenter cette façon de publier des fichiers. Si vous êtes intéressé par ce sujet, par exemple si vous maintenez un système de distribution basé sur l'antique BitTornado, restez en ligne.

30 06 | 2011

A new BitTorrent metainfo generator

Written by Tanguy

Classified in : Homepage, Debian

Trying the BitTorrent DHT

A month ago, noticing that there was a lack of a good BitTorrent tracker software (good meaning “complying with my random requirements”), I considered writing a new tracker. Then someone pointed out that I could try using the dynamic hash table or DHT, a BitTorrent extension that removes the need for a tracker, relying on the swarm or BitTorrent clients to do the tracking work.

Indeed, the DHT may be a nice solution to this problem because it has several advantages:

  • it relies on the BitTorrent clients themselves, that are far more commonly used that BitTorrent trackers and thus more developed;
  • this feature seems to be rather well adopted by the common BitTorrent client software;
  • it already exist and seems to work rather well!

So, I went to try distributing trackerless torrents using the DHT. But with BitTorrent, file distribution is initiated using metainfo files, commonly called “torrent files” or simply “torrents”, so I needed a tool to generate trackerless metainfo files.

Writing a new metainfo generator

I did not find such a tool. The generators I found did not implement that extension and they were composed of many lines of C code, which I really did not want to dig into in order to extend them. So here it is, gentorrent, a BitTorrent metainfo generator written in Python 3 and distributed under the license AGPLv3, which proved rather easy.

I think it is fast enough, taking about ten seconds to calculate the metainfo for a file of one gibibyte. It implements all the BitTorrent extensions related to metainfo files, such as trackerless torrents, HTTP/FTP seeding or Merkle trees. Do not hesitate to test it and to send me comments, criticism or suggestions for a cooler name.

Now that I have a tool to generate trackerless torrents, I shall test the DHT more extensively and document this way of publishing files. If you are interested in this topic, e.g. you are maintaining a distribution system based on the antique BitTornado, stay tuned.

Archives