A clone of btpd with my configuration changes.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

4 年之前
4 年之前
4 年之前
4 年之前
4 年之前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. # BTPD
  2. BitTorrent Protocol Daemon
  3. ## Index
  4. 1. [Introduction](#introduction)
  5. * [What is btpd?](#what-is-btpd?)
  6. * [The programs](#the-programs)
  7. * [The btcli commands](#the-btcli-commands)
  8. 2. [Using btpd](#using-btpd)
  9. * [First](#first)
  10. * [Starting btpd](#starting-btpd)
  11. * [Examples](#examples)
  12. * [Troubleshooting](#troubleshooting)
  13. 3. [Building](#building)
  14. * [Requirements](#requirements)
  15. * [Standard build](#standard-build)
  16. 4. [Additional notes](#additional-notes)
  17. * [Upgrade from old versions](#upgrade-from-old-versions)
  18. * [Pre exit mode](#pre-exit-mode)
  19. * [Using both IPv6 and IPv4](#using-both-ipv6-and-ipv4)
  20. 5. [Contact](#contact)
  21. ## Introduction
  22. ### What is btpd?
  23. `btpd` is a utility for sharing files over the BitTorrent network protocol.
  24. It runs in daemon mode, thus needing no controlling terminal or gui.
  25. Instead, the daemon is controlled by btcli, its command line utility,
  26. or other programs capable of sending commands and queries on the control
  27. socket.
  28. ### The programs
  29. `btpd` consists of the following programs:
  30. * `btpd` - The bittorrent client.
  31. * `btcli` - Command line interface to btpd.
  32. * `btinfo` - Shows information from a torrent file.
  33. All programs accept the `--help` option.
  34. ### The btcli commands
  35. The `btcli` utility has several different modes of operation. One of the following commands must be specified when running `btcli`:
  36. * `add` - Add torrents to btpd.
  37. * `del` - Remove torrents from btpd.
  38. * `kill` - Shut down btpd.
  39. * `list` - List torrents.
  40. * `rate` - Set the global up and download rates in KB/s.
  41. * `start` - Activate torrents.
  42. * `stat` - Display stats for active torrents.
  43. * `stop` - Deactivate torrents.
  44. ## Using btpd
  45. ### First
  46. To start sharing a torrent with btpd, the torrent needs to be added to
  47. btpd. This is done with `btcli add`. When you add a torrent btpd automatically (if you didn't specify otherwise) starts to share the torrent
  48. and download any missing data. The content directory you specify when
  49. adding a torrent doesn't need to exist; it will be created by btpd.
  50. You can see which torrents have been added to btpd with `btcli list`.
  51. The list command also displays a number for each added torrent. This number
  52. can be used to specify the target torrent for the btcli commands, so you
  53. don't have to keep the torrent file once you've added it.
  54. The up- and download progress can be followed by using the `btcli stat`
  55. command. Both the list and stat commands use the following indicators to
  56. display the state of a torrent:
  57. * `+` - the torrent is starting. This may take time if btpd needs to test the content of this torrent or one started before it.
  58. * `-` - the torrent is being stopped.
  59. * `I` - the torrent is inactive.
  60. * `S` - btpd is seeding the torrent.
  61. * `L` - btpd is leeching the torrent.
  62. You can stop an active torrent with `btcli stop` and, of course,
  63. start an inactive torrent by using `btcli start`.
  64. The `btcli del` command should only be used when you're totally finished
  65. with sharing a torrent. The command will remove the torrent and its
  66. associated data from btpd. It's an escpecially bad idea to remove a not
  67. fully downloaded torrent and then adding it again, since btpd has lost
  68. information on the not fully downloaded pieces and will need to download
  69. the data again.
  70. To shut down btpd use `btcli kill`. Don't forget to read the help for each
  71. of btcli's commands.
  72. ### Starting btpd
  73. NOTE: You should only need one instance of btpd regardless of how many
  74. torrents you want to share.
  75. To start btpd with default settings you only need to run it. However,
  76. there are many useful options you may want to use. To see a full list
  77. run `btpd --help`. If you didn't specify otherwise, btpd starts with
  78. the same set of active torrents as it had the last time it was shut down.
  79. btdp will store information and write its log in `$HOME/.btpd`. Therefore
  80. it needs to be able to write there during its execution. You can specify
  81. another directory via the `-d` option or the `$BTPD_HOME` variable.
  82. I recommend specifiying the maximum number of uploads. Bittorrent employs a
  83. tit for tat algorithm, so uploading at good rates allows for downloading.
  84. Try to find a balance between uploads/outgoing bandwidth and the number of
  85. active torrents.
  86. ### Examples
  87. Start btpd with all options set to their default values.
  88. ```
  89. # btpd
  90. ```
  91. Start btpd and make it listen on port 12345, limit outgoing bandwidth to
  92. 200kB/s, limit the number of peers to 40 and not start any torrents that
  93. were active the last time btpd was shut down.
  94. ```
  95. # btpd -p 12345 --bw-out 200 --max-peers 40 --empty-start
  96. ```
  97. Display a list btpd's torrents and their number, size, status, etc.
  98. ```
  99. # btcli list
  100. ```
  101. Same as above, but only for torrent 12 and my.little.torrent.
  102. ```
  103. # btcli list 12 my.little.torrent
  104. ```
  105. Same as above but only for active torrents.
  106. ```
  107. # btcli list -a
  108. ```
  109. Same as above, but print using a custom format
  110. ```
  111. # btcli list -a -f "btcli list -f "%n\t%#\t%p%s\t%r\n"
  112. ```
  113. Add foo.torrent, with content dir foo.torrent.d, and start it.
  114. ```
  115. # btcli add -d foo.torrent.d foo.torrent
  116. ```
  117. Same as above without starting it.
  118. ```
  119. # btcli add --no-start -d foo.torrent.d foo.torrent
  120. ```
  121. Start bar.torrent and torrent number 7.
  122. ```
  123. # btcli start bar.torrent 7
  124. ```
  125. Stop torrent number 7.
  126. ```
  127. # btcli stop 7
  128. ```
  129. Stop all active torrents.
  130. ```
  131. # btcli stop -a
  132. ```
  133. Remove bar.torrent and it's associated information from btpd.
  134. ```
  135. # btcli del bar.torrent
  136. ```
  137. Display a summary of up/download stats for the active torrents.
  138. ```
  139. # btcli stat
  140. ```
  141. Display the summary once every five seconds.
  142. ```
  143. # btcli stat -w 5
  144. ```
  145. Same as above, but also display individual stats for each active torrent.
  146. ```
  147. # btcli stat -w 5 -i
  148. ```
  149. Set the global upload rate to 20KB/s and download rate to 1MB/s.
  150. ```
  151. # btcli rate 20K 1M
  152. ```
  153. Shut down btpd.
  154. ```
  155. # btcli kill
  156. ```
  157. ### Troubleshooting
  158. If btpd has shut down for some unknown reason, check the logfile for
  159. possible clues.
  160. ## Building
  161. ### Requirements
  162. You should have a BSD, Linux or sufficiently similar system.
  163. Make sure you have recent versions of the following software:
  164. * OpenSSL - Get at http://www.openssl.org/
  165. You also need a c99 compiler. A non antique GCC should do.
  166. To be able to open the manual located in `doc` you need to have `man-pages` installed.
  167. ### Standard build
  168. ```
  169. # ./configure
  170. # make
  171. # make install
  172. ```
  173. See `./configure --help` for available build options if the above fails.
  174. ## Additional notes
  175. ### Upgrade from old version
  176. The layout of the torrents directory in the btpd directory has changed
  177. since btpd 0.11. Please remove the torrents directory before running
  178. later versions.
  179. ### Pre exit mode
  180. If btpd needs to send stop messages to trackers before shutting down,
  181. it will enter the pre exit mode. A btpd process in this mode can safely
  182. be ignored and will not interfere with any new btpd started in the same
  183. directory.
  184. ### Using both IPv6 and IPv4
  185. Unfortunately enabling both IPv6 and IPv4 in btpd is less useful than it
  186. should be. The problem is that some sites have trackers for both versions
  187. and it's likely that the IPv6 one, which probably has less peers, will be
  188. used in favour of the IPv4 one.
  189. In order to fix this problem, the IP version options should be changed to
  190. be per torrent, in some future version of btpd.
  191. ## Contact
  192. If you wish to get in touch to get help, contribute or just say hi, don't
  193. hesitate to come to our IRC channel [#btpd on freenode](irc://chat.freenode.net/%23btpd).