NAME
torrent – bittorrent client

SYNOPSIS
ip/torrent [ –d ] [ –v ] [ –p ] [ –m mtpt ] [ –t tracker–url ] [ –w webseed–url ] [ –s ] [ –c ] [ –i peer–id ] [ –A user–agent ] [ file ]

DESCRIPTION
BitTorrent is a protocol for efficient file distribution over the internet. Files are split into small pieces that are then downloaded by clients in random order. As soon as a client completes a piece, it makes the piece available for others to download.

To find other clients (peers), a tracker–server is contacted.

Before files can be transmitted, a torrent–file needs to be created describing the pieces of the files and other meta–data like network addresses of the trackers.

This is done with the –c option. If provided, torrent reads the file given at the final file argument (or standard–input when omitted) and writes a torrent file to standard–output and exits. A tracker–url should be given with the –t option in that case. A list of trackers can be obtained on the web, see the examples below.

If the files in the torrent are also available from a url, a webseed–url can be passed with the –w option. If webseed–url ends with a slash, the filename, from the torrent, concatenated with the url forms the target url.

Without the –c option, torrent downloads the files that are described in the torrent–file given by the file argument to the current working directory. If no file is given, the torrent is read from standard–input.

Normally, the program exits immediately after all pieces have been completed. The –s option causes it to keep running and serve the remaining clients (also known as seeding).

Trackers use a subset of the HTTP protocol, so an alternative webfs(4) mountpoint can be given with the –m option (defaults to /mnt/web).

The –v option causes torrent to list the files in the torrent–file before downloading.

The –d option produces verbose debug output to standard–error.

To monitor the download progress, the –p option can be given to cause the completed and total number of pieces written as a line of text to standard–output in one second intervals.

The –i option allows you to set the 20–byte peer–id that is sent to trackers and peers. If less than 20 bytes, the peer–id will be padded on the right with random ASCII numbers. The –A option allows setting the http user–agent string that is used to contact the tracker. These options are useful to fool trackers that filter clients based on the peer–id or user–agent

EXAMPLES
Create new torrent file
ip/torrent –t http://exodus.desync.com/announce \
c 9atom.iso >9atom.torrent

Download the latest iso file of the distribution
cd /tmp
hget http://r–36.net/9front/9front.iso.bz2.torrent | \
ip/torrent –pv | \
aux/statusbar 'download...'

Get list of public alive trackers to choose from
hget https://newtrackon.com/api/live

SOURCE
/sys/src/cmd/ip/torrent.c

SEE ALSO
hget(1), webfs(4)

HISTORY
Torrent first appeared in 9front (October, 2011).