From 58b373f73d3cd290122c1ea107d54e037b0239b1 Mon Sep 17 00:00:00 2001 From: Eudald Gubert i Roldan Date: Tue, 7 Apr 2020 09:46:38 +0200 Subject: Uncial script --- CHANGES | 207 ++++++++++++++++++++++++++++++++++++++++++++++++++ LICENSE | 57 ++++++++++++++ README.md | 253 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ changes | 207 -------------------------------------------------- license | 57 -------------- readme.md | 253 -------------------------------------------------------------- 6 files changed, 517 insertions(+), 517 deletions(-) create mode 100644 CHANGES create mode 100644 LICENSE create mode 100644 README.md delete mode 100644 changes delete mode 100644 license delete mode 100644 readme.md diff --git a/CHANGES b/CHANGES new file mode 100644 index 0000000..503addb --- /dev/null +++ b/CHANGES @@ -0,0 +1,207 @@ +btpd 0.16: +---------- + +Misc: +- Added "start all" (start -a) command. +- Allow adding multiple torrents at once. +- Custom list formatting options. +- Man pages for btpd, btcli, and btinfo. + +Bug fixes: +- Handle .torrent files larger than 2MB. +- http parsing and addrinfo freeing fixes. + +btpd 0.15: +---------- + +Bug fixes: +- The event loop could busy loop for up to a millisecond sometimes. +- On some platforms btpd couldn't initiate connections to other peers. +- The timer code was broken on MacOS X. + +btpd 0.14: +---------- + +Misc: +- IPv6 support. +- Bans peers with bad data. +- Better tracker compatability and more reliable tracker communication. +- Show tracker counts in btcli stat. +- Compiles on Solaris 10. +- Btpd will now signal startup failures via the process exit value and + print the failure reason to stdout. +- Better shutdown and torrent stop behaviour. +- Needs pthreads again. +- Removed libevent in favour of own event loop code. + +Bug fixes: +- An integer array was misaligned, which could cause crashes on systems + with alignment requirements. E.g., on XScale arm. +- An error in the torrent parsing code could cause crashes. +- The '--topdir' option to btcli add didn't work properly for single file + torrents. +- The system name lookup scheme is now used. In btpd 0.13 only dns lookups + were performed. + +btpd 0.13: +---------- + +Misc: +- cURL is no longer required. btpd now uses its own http client. +- btpd doesn't use threads anymore, so pthreads are not required. +- Needed parts of libevent are now included in btpd. +- I/O errors for torrents no longer make btpd shut down. Instead the + problematic torrent is stopped. +- Added the option '--ip' to specify the ip address btpd will report + to trackers. +- Resume file format changed. Already added torrents will be retested once. +- The torrent info (ratio etc.) are now saved regularly. +- Reduced the amount of outgoing data kept in memory. + +btpd 0.12: +---------- + +Misc: +- btpd now starts with the same set of active torrents as it had when it was + last shut down. The new '--empty-start' option disables this feature. +- btpd now supports the key tracker extension. +- btpd now supports the multi tracker extension. +- btcli list and stat print headers for the presented data. Both commands + displays more data than before. +- Torrent management has changed, with changes to the add and del commands + and two new commands, start and stop, as a result. Operation on torrents + can now be done by number as well as torrent file. +- A small delay has been added for contacting the same announce URL. +- btpd sends keepalive messages. +- The number of have messages sent has been reduced by not sending them to + peers that already have the piece. +- The structure of the torrents directory in the btpd directory has changed. + It is best to remove it before running btpd 0.12. + +Bug fixes: +- Zero sized files in a torrent were not always created. + +btpd 0.11: +---------- + +Bug fixes: +- A file descriptor was closed too early, which could cause btpd to exit + with an error message on systems using epoll. + +btpd 0.10: +---------- + +Misc: +- The protection mode of the ipc socket can now be specified via the new + "--ipcprot" option for btpd. + +Bug fixes: +- The pid file is now written correctly. +- btpd's "-d" option now works for relative paths too. +- Add a time out for handshake completion. Prevously btpd could slowly + fill with unused incoming connections. + +btpd 0.9: +--------- + +Misc: +- Small changes to 'btcli stat' output. + +Bug fixes: +- Use correct value for '--prealloc' default. +- Stopped torrents now show correct rates (0kB/s). +- The test of content that has been modified between runs was broken. + +btpd 0.8: +--------- + +Misc: +- btpd now requires pthreads. +- btpd keeps its logs and other information it needs in its own directory. + $HOME/.btpd is the default location. +- Various changes in btpd options ant btcli use. See '--help'. +- The user chooses where to place content for each torrent. +- Better disk IO performance. +- Configureable disk preallocation to reduce file fragmentation. +- The unchoke algorithm is global instead of per torrent. The number + of peers to upload to is configurable. +- Tracker errors are displayed in 'btcli stat' and most importantly don't + make torrents unload on startup. +- The rates displayed by btcli are now computed in btpd and are averaged + over the last 20 seconds. +- btpd now compares size and mtime of content to see if the resume file is + valid. + +Bug fixes: +- Double uninterest messages could be sent to some peers in endgame mode. +- A function was called prematurely which could trigger an assert in rare + cases. + +btpd 0.7: +--------- + +Bug fixes: +- Some communication stupidities was fixed, resulting in better download + performance. + +btpd 0.6: +--------- + +Misc: +- Set an upper limit on how much data a peer can request at once. + This protects from running out of memory because of a greedy peer. +- End game is more efficient and uses much less memory. + +btpd 0.5: +--------- + +Bug fixes: +- The bitfield could be sent too late. This could cause the receiving + peer to close the connection. + +btpd 0.4: +--------- + +Misc: +- The 0.1 rate limiter is back. It runs at a configurable hz now. +- Added "--bw-hz" option to btpd. +- Multiple have messages can be sent in place of a bitfield. +- If btpd can't write to a peer for 60s, it will be disconnected. + +Bug fixes: +- A calculation error made btpd buggy with small torrents. + This caused strange crashes and many reports on bad hashes in the log. +- The bitfield was sent too early. A peer could miss pieces btpd got + while the peer was in handshake. +- Some situations in end game or with bad hashes could cause a crash. + +btpd 0.3: +--------- + +Misc: +- New download strategy. +- Pipe ten requests instead of five. +- "-d" option added to btpd. +- "--with-warn" option added to configure. The default is now + to compile with warnings off. + +Bug fixes: +- It was possible for blocks to remain marked as busy when a peer + choked or was lost, causing a piece download to wait until end game. +- The peer wanted level could get too high during end game. + +btpd 0.2: +--------- + +Misc: +- A new way to do rate limiting. +- Compact mode is now used when talking to the tracker. + +Bug fixes: +- A buffer was too small by four bytes, causing a buffer overflow + on the heap in certain conditions. +- An iteration over a list was unsafe and could cause a crash. +- Unloading a torrent didn't kill peers in handshake for that torrent, + and a crash was possible when the handshake finished. +- The counter for uploaded data was updated too early. +- Fixed illegal operator for test(1) in configure. diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..bc1368f --- /dev/null +++ b/LICENSE @@ -0,0 +1,57 @@ +The btpd software is distributed under the following terms: + +Copyright (c) 2005-2009 + Richard Nyberg . All rights reserved. +Copyright (c) 2010 + Marq Schneider . All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + +Additionally, the part of the btpd code contained in misc/queue.h is +covered by the following license: + +Copyright (c) 1991, 1993 +The Regents of the University of California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +4. Neither the name of the University nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..438da71 --- /dev/null +++ b/README.md @@ -0,0 +1,253 @@ +# BTPD + +BitTorrent Protocol Daemon + +## Index + +1. [Introduction](#introduction) + * [What is btpd?](#what-is-btpd?) + * [The programs](#the-programs) + * [The btcli commands](#the-btcli-commands) +2. [Using btpd](#using-btpd) + * [First](#first) + * [Starting btpd](#starting-btpd) + * [Examples](#examples) + * [Troubleshooting](#troubleshooting) +3. [Building](#building) + * [Requirements](#requirements) + * [Standard build](#standard-build) +4. [Additional notes](#additional-notes) + * [Upgrade from old versions](#upgrade-from-old-versions) + * [Pre exit mode](#pre-exit-mode) + * [Using both IPv6 and IPv4](#using-both-ipv6-and-ipv4) + +## Introduction + +### What is btpd? + +`btpd` is a utility for sharing files over the BitTorrent network protocol. +It runs in daemon mode, thus needing no controlling terminal or gui. +Instead, the daemon is controlled by btcli, its command line utility, +or other programs capable of sending commands and queries on the control +socket. + +### The programs + +`btpd` consists of the following programs: +* `btpd` - The bittorrent client. +* `btcli` - Command line interface to btpd. +* `btinfo` - Shows information from a torrent file. + +All programs accept the `--help` option. + +### The btcli commands + +The `btcli` utility has several different modes of operation. One of the following commands must be specified when running `btcli`: +* `add` - Add torrents to btpd. +* `del` - Remove torrents from btpd. +* `kill` - Shut down btpd. +* `list` - List torrents. +* `rate` - Set the global up and download rates in KB/s. +* `start` - Activate torrents. +* `stat` - Display stats for active torrents. +* `stop` - Deactivate torrents. + +## Using btpd + +### First + +To start sharing a torrent with btpd, the torrent needs to be added to +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 +and download any missing data. The content directory you specify when +adding a torrent doesn't need to exist; it will be created by btpd. + +You can see which torrents have been added to btpd with `btcli list`. +The list command also displays a number for each added torrent. This number +can be used to specify the target torrent for the btcli commands, so you +don't have to keep the torrent file once you've added it. + +The up- and download progress can be followed by using the `btcli stat` +command. Both the list and stat commands use the following indicators to +display the state of a torrent: +``` ++ the torrent is starting. This may take time if btpd needs to test + the content of this torrent or one started before it. +- the torrent is being stopped. +I the torrent is inactive. +S btpd is seeding the torrent. +L btpd is leeching the torrent. +``` + +You can stop an active torrent with `btcli stop` and, of course, +start an inactive torrent by using `btcli start`. + +The `btcli del` command should only be used when you're totally finished +with sharing a torrent. The command will remove the torrent and its +associated data from btpd. It's an escpecially bad idea to remove a not +fully downloaded torrent and then adding it again, since btpd has lost +information on the not fully downloaded pieces and will need to download +the data again. + +To shut down btpd use `btcli kill`. Don't forget to read the help for each +of btcli's commands. + +### Starting btpd + +NOTE: You should only need one instance of btpd regardless of how many +torrents you want to share. + +To start btpd with default settings you only need to run it. However, +there are many useful options you may want to use. To see a full list +run `btpd --help`. If you didn't specify otherwise, btpd starts with +the same set of active torrents as it had the last time it was shut down. + +btdp will store information and write its log in `$HOME/.btpd`. Therefore +it needs to be able to write there during its execution. You can specify +another directory via the `-d` option or the `$BTPD_HOME` variable. + +I recommend specifiying the maximum number of uploads. Bittorrent employs a +tit for tat algorithm, so uploading at good rates allows for downloading. +Try to find a balance between uploads/outgoing bandwidth and the number of +active torrents. + +### Examples + +Start btpd with all options set to their default values. +``` +# btpd +``` + +Start btpd and make it listen on port 12345, limit outgoing bandwidth to +200kB/s, limit the number of peers to 40 and not start any torrents that +were active the last time btpd was shut down. +``` +# btpd -p 12345 --bw-out 200 --max-peers 40 --empty-start +``` + +Display a list btpd's torrents and their number, size, status, etc. +``` +# btcli list +``` + +Same as above, but only for torrent 12 and my.little.torrent. +``` +# btcli list 12 my.little.torrent +``` + +Same as above but only for active torrents. +``` +# btcli list -a +``` + +Same as above, but print using a custom format +``` +# btcli list -a -f "btcli list -f "%n\t%#\t%p%s\t%r\n" +``` + +Add foo.torrent, with content dir foo.torrent.d, and start it. +``` +# btcli add -d foo.torrent.d foo.torrent +``` + +Same as above without starting it. +``` +# btcli add --no-start -d foo.torrent.d foo.torrent +``` + +Start bar.torrent and torrent number 7. +``` +# btcli start bar.torrent 7 +``` + +Stop torrent number 7. +``` +# btcli stop 7 +``` + +Stop all active torrents. +``` +# btcli stop -a +``` + +Remove bar.torrent and it's associated information from btpd. +``` +# btcli del bar.torrent +``` + +Display a summary of up/download stats for the active torrents. +``` +# btcli stat +``` + +Display the summary once every five seconds. +``` +# btcli stat -w 5 +``` + +Same as above, but also display individual stats for each active torrent. +``` +# btcli stat -w 5 -i +``` + +Set the global upload rate to 20KB/s and download rate to 1MB/s. +``` +# btcli rate 20K 1M +``` + +Shut down btpd. +``` +# btcli kill +``` + +### Troubleshooting + +If btpd has shut down for some unknown reason, check the logfile for +possible clues. + +## Building + +### Requirements + +You should have a *BSD, Linux or sufficiently similar system. + +Make sure you have recent versions of the following software: +* OpenSSL - Get at http://www.openssl.org/ + +You also need a c99 compiler. A non antique GCC should do. + +To be able to open the manual located in `doc` you need to have `man-pages` installed. + +### Standard build + +``` +# ./configure +# make +# make install +``` + +See `./configure --help` for available build options if the above fails. + +## Additional notes + +### Upgrade from old version + +The layout of the torrents directory in the btpd directory has changed +since btpd 0.11. Please remove the torrents directory before running +later versions. + +### Pre exit mode + +If btpd needs to send stop messages to trackers before shutting down, +it will enter the pre exit mode. A btpd process in this mode can safely +be ignored and will not interfere with any new btpd started in the same +directory. + +### Using both IPv6 and IPv4 + +Unfortunately enabling both IPv6 and IPv4 in btpd is less useful than it +should be. The problem is that some sites have trackers for both versions +and it's likely that the IPv6 one, which probably has less peers, will be +used in favour of the IPv4 one. + +In order to fix this problem, the IP version options should be changed to +be per torrent, in some future version of btpd. diff --git a/changes b/changes deleted file mode 100644 index 503addb..0000000 --- a/changes +++ /dev/null @@ -1,207 +0,0 @@ -btpd 0.16: ----------- - -Misc: -- Added "start all" (start -a) command. -- Allow adding multiple torrents at once. -- Custom list formatting options. -- Man pages for btpd, btcli, and btinfo. - -Bug fixes: -- Handle .torrent files larger than 2MB. -- http parsing and addrinfo freeing fixes. - -btpd 0.15: ----------- - -Bug fixes: -- The event loop could busy loop for up to a millisecond sometimes. -- On some platforms btpd couldn't initiate connections to other peers. -- The timer code was broken on MacOS X. - -btpd 0.14: ----------- - -Misc: -- IPv6 support. -- Bans peers with bad data. -- Better tracker compatability and more reliable tracker communication. -- Show tracker counts in btcli stat. -- Compiles on Solaris 10. -- Btpd will now signal startup failures via the process exit value and - print the failure reason to stdout. -- Better shutdown and torrent stop behaviour. -- Needs pthreads again. -- Removed libevent in favour of own event loop code. - -Bug fixes: -- An integer array was misaligned, which could cause crashes on systems - with alignment requirements. E.g., on XScale arm. -- An error in the torrent parsing code could cause crashes. -- The '--topdir' option to btcli add didn't work properly for single file - torrents. -- The system name lookup scheme is now used. In btpd 0.13 only dns lookups - were performed. - -btpd 0.13: ----------- - -Misc: -- cURL is no longer required. btpd now uses its own http client. -- btpd doesn't use threads anymore, so pthreads are not required. -- Needed parts of libevent are now included in btpd. -- I/O errors for torrents no longer make btpd shut down. Instead the - problematic torrent is stopped. -- Added the option '--ip' to specify the ip address btpd will report - to trackers. -- Resume file format changed. Already added torrents will be retested once. -- The torrent info (ratio etc.) are now saved regularly. -- Reduced the amount of outgoing data kept in memory. - -btpd 0.12: ----------- - -Misc: -- btpd now starts with the same set of active torrents as it had when it was - last shut down. The new '--empty-start' option disables this feature. -- btpd now supports the key tracker extension. -- btpd now supports the multi tracker extension. -- btcli list and stat print headers for the presented data. Both commands - displays more data than before. -- Torrent management has changed, with changes to the add and del commands - and two new commands, start and stop, as a result. Operation on torrents - can now be done by number as well as torrent file. -- A small delay has been added for contacting the same announce URL. -- btpd sends keepalive messages. -- The number of have messages sent has been reduced by not sending them to - peers that already have the piece. -- The structure of the torrents directory in the btpd directory has changed. - It is best to remove it before running btpd 0.12. - -Bug fixes: -- Zero sized files in a torrent were not always created. - -btpd 0.11: ----------- - -Bug fixes: -- A file descriptor was closed too early, which could cause btpd to exit - with an error message on systems using epoll. - -btpd 0.10: ----------- - -Misc: -- The protection mode of the ipc socket can now be specified via the new - "--ipcprot" option for btpd. - -Bug fixes: -- The pid file is now written correctly. -- btpd's "-d" option now works for relative paths too. -- Add a time out for handshake completion. Prevously btpd could slowly - fill with unused incoming connections. - -btpd 0.9: ---------- - -Misc: -- Small changes to 'btcli stat' output. - -Bug fixes: -- Use correct value for '--prealloc' default. -- Stopped torrents now show correct rates (0kB/s). -- The test of content that has been modified between runs was broken. - -btpd 0.8: ---------- - -Misc: -- btpd now requires pthreads. -- btpd keeps its logs and other information it needs in its own directory. - $HOME/.btpd is the default location. -- Various changes in btpd options ant btcli use. See '--help'. -- The user chooses where to place content for each torrent. -- Better disk IO performance. -- Configureable disk preallocation to reduce file fragmentation. -- The unchoke algorithm is global instead of per torrent. The number - of peers to upload to is configurable. -- Tracker errors are displayed in 'btcli stat' and most importantly don't - make torrents unload on startup. -- The rates displayed by btcli are now computed in btpd and are averaged - over the last 20 seconds. -- btpd now compares size and mtime of content to see if the resume file is - valid. - -Bug fixes: -- Double uninterest messages could be sent to some peers in endgame mode. -- A function was called prematurely which could trigger an assert in rare - cases. - -btpd 0.7: ---------- - -Bug fixes: -- Some communication stupidities was fixed, resulting in better download - performance. - -btpd 0.6: ---------- - -Misc: -- Set an upper limit on how much data a peer can request at once. - This protects from running out of memory because of a greedy peer. -- End game is more efficient and uses much less memory. - -btpd 0.5: ---------- - -Bug fixes: -- The bitfield could be sent too late. This could cause the receiving - peer to close the connection. - -btpd 0.4: ---------- - -Misc: -- The 0.1 rate limiter is back. It runs at a configurable hz now. -- Added "--bw-hz" option to btpd. -- Multiple have messages can be sent in place of a bitfield. -- If btpd can't write to a peer for 60s, it will be disconnected. - -Bug fixes: -- A calculation error made btpd buggy with small torrents. - This caused strange crashes and many reports on bad hashes in the log. -- The bitfield was sent too early. A peer could miss pieces btpd got - while the peer was in handshake. -- Some situations in end game or with bad hashes could cause a crash. - -btpd 0.3: ---------- - -Misc: -- New download strategy. -- Pipe ten requests instead of five. -- "-d" option added to btpd. -- "--with-warn" option added to configure. The default is now - to compile with warnings off. - -Bug fixes: -- It was possible for blocks to remain marked as busy when a peer - choked or was lost, causing a piece download to wait until end game. -- The peer wanted level could get too high during end game. - -btpd 0.2: ---------- - -Misc: -- A new way to do rate limiting. -- Compact mode is now used when talking to the tracker. - -Bug fixes: -- A buffer was too small by four bytes, causing a buffer overflow - on the heap in certain conditions. -- An iteration over a list was unsafe and could cause a crash. -- Unloading a torrent didn't kill peers in handshake for that torrent, - and a crash was possible when the handshake finished. -- The counter for uploaded data was updated too early. -- Fixed illegal operator for test(1) in configure. diff --git a/license b/license deleted file mode 100644 index bc1368f..0000000 --- a/license +++ /dev/null @@ -1,57 +0,0 @@ -The btpd software is distributed under the following terms: - -Copyright (c) 2005-2009 - Richard Nyberg . All rights reserved. -Copyright (c) 2010 - Marq Schneider . All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -SUCH DAMAGE. - -Additionally, the part of the btpd code contained in misc/queue.h is -covered by the following license: - -Copyright (c) 1991, 1993 -The Regents of the University of California. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. -4. Neither the name of the University nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -SUCH DAMAGE. diff --git a/readme.md b/readme.md deleted file mode 100644 index 438da71..0000000 --- a/readme.md +++ /dev/null @@ -1,253 +0,0 @@ -# BTPD - -BitTorrent Protocol Daemon - -## Index - -1. [Introduction](#introduction) - * [What is btpd?](#what-is-btpd?) - * [The programs](#the-programs) - * [The btcli commands](#the-btcli-commands) -2. [Using btpd](#using-btpd) - * [First](#first) - * [Starting btpd](#starting-btpd) - * [Examples](#examples) - * [Troubleshooting](#troubleshooting) -3. [Building](#building) - * [Requirements](#requirements) - * [Standard build](#standard-build) -4. [Additional notes](#additional-notes) - * [Upgrade from old versions](#upgrade-from-old-versions) - * [Pre exit mode](#pre-exit-mode) - * [Using both IPv6 and IPv4](#using-both-ipv6-and-ipv4) - -## Introduction - -### What is btpd? - -`btpd` is a utility for sharing files over the BitTorrent network protocol. -It runs in daemon mode, thus needing no controlling terminal or gui. -Instead, the daemon is controlled by btcli, its command line utility, -or other programs capable of sending commands and queries on the control -socket. - -### The programs - -`btpd` consists of the following programs: -* `btpd` - The bittorrent client. -* `btcli` - Command line interface to btpd. -* `btinfo` - Shows information from a torrent file. - -All programs accept the `--help` option. - -### The btcli commands - -The `btcli` utility has several different modes of operation. One of the following commands must be specified when running `btcli`: -* `add` - Add torrents to btpd. -* `del` - Remove torrents from btpd. -* `kill` - Shut down btpd. -* `list` - List torrents. -* `rate` - Set the global up and download rates in KB/s. -* `start` - Activate torrents. -* `stat` - Display stats for active torrents. -* `stop` - Deactivate torrents. - -## Using btpd - -### First - -To start sharing a torrent with btpd, the torrent needs to be added to -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 -and download any missing data. The content directory you specify when -adding a torrent doesn't need to exist; it will be created by btpd. - -You can see which torrents have been added to btpd with `btcli list`. -The list command also displays a number for each added torrent. This number -can be used to specify the target torrent for the btcli commands, so you -don't have to keep the torrent file once you've added it. - -The up- and download progress can be followed by using the `btcli stat` -command. Both the list and stat commands use the following indicators to -display the state of a torrent: -``` -+ the torrent is starting. This may take time if btpd needs to test - the content of this torrent or one started before it. -- the torrent is being stopped. -I the torrent is inactive. -S btpd is seeding the torrent. -L btpd is leeching the torrent. -``` - -You can stop an active torrent with `btcli stop` and, of course, -start an inactive torrent by using `btcli start`. - -The `btcli del` command should only be used when you're totally finished -with sharing a torrent. The command will remove the torrent and its -associated data from btpd. It's an escpecially bad idea to remove a not -fully downloaded torrent and then adding it again, since btpd has lost -information on the not fully downloaded pieces and will need to download -the data again. - -To shut down btpd use `btcli kill`. Don't forget to read the help for each -of btcli's commands. - -### Starting btpd - -NOTE: You should only need one instance of btpd regardless of how many -torrents you want to share. - -To start btpd with default settings you only need to run it. However, -there are many useful options you may want to use. To see a full list -run `btpd --help`. If you didn't specify otherwise, btpd starts with -the same set of active torrents as it had the last time it was shut down. - -btdp will store information and write its log in `$HOME/.btpd`. Therefore -it needs to be able to write there during its execution. You can specify -another directory via the `-d` option or the `$BTPD_HOME` variable. - -I recommend specifiying the maximum number of uploads. Bittorrent employs a -tit for tat algorithm, so uploading at good rates allows for downloading. -Try to find a balance between uploads/outgoing bandwidth and the number of -active torrents. - -### Examples - -Start btpd with all options set to their default values. -``` -# btpd -``` - -Start btpd and make it listen on port 12345, limit outgoing bandwidth to -200kB/s, limit the number of peers to 40 and not start any torrents that -were active the last time btpd was shut down. -``` -# btpd -p 12345 --bw-out 200 --max-peers 40 --empty-start -``` - -Display a list btpd's torrents and their number, size, status, etc. -``` -# btcli list -``` - -Same as above, but only for torrent 12 and my.little.torrent. -``` -# btcli list 12 my.little.torrent -``` - -Same as above but only for active torrents. -``` -# btcli list -a -``` - -Same as above, but print using a custom format -``` -# btcli list -a -f "btcli list -f "%n\t%#\t%p%s\t%r\n" -``` - -Add foo.torrent, with content dir foo.torrent.d, and start it. -``` -# btcli add -d foo.torrent.d foo.torrent -``` - -Same as above without starting it. -``` -# btcli add --no-start -d foo.torrent.d foo.torrent -``` - -Start bar.torrent and torrent number 7. -``` -# btcli start bar.torrent 7 -``` - -Stop torrent number 7. -``` -# btcli stop 7 -``` - -Stop all active torrents. -``` -# btcli stop -a -``` - -Remove bar.torrent and it's associated information from btpd. -``` -# btcli del bar.torrent -``` - -Display a summary of up/download stats for the active torrents. -``` -# btcli stat -``` - -Display the summary once every five seconds. -``` -# btcli stat -w 5 -``` - -Same as above, but also display individual stats for each active torrent. -``` -# btcli stat -w 5 -i -``` - -Set the global upload rate to 20KB/s and download rate to 1MB/s. -``` -# btcli rate 20K 1M -``` - -Shut down btpd. -``` -# btcli kill -``` - -### Troubleshooting - -If btpd has shut down for some unknown reason, check the logfile for -possible clues. - -## Building - -### Requirements - -You should have a *BSD, Linux or sufficiently similar system. - -Make sure you have recent versions of the following software: -* OpenSSL - Get at http://www.openssl.org/ - -You also need a c99 compiler. A non antique GCC should do. - -To be able to open the manual located in `doc` you need to have `man-pages` installed. - -### Standard build - -``` -# ./configure -# make -# make install -``` - -See `./configure --help` for available build options if the above fails. - -## Additional notes - -### Upgrade from old version - -The layout of the torrents directory in the btpd directory has changed -since btpd 0.11. Please remove the torrents directory before running -later versions. - -### Pre exit mode - -If btpd needs to send stop messages to trackers before shutting down, -it will enter the pre exit mode. A btpd process in this mode can safely -be ignored and will not interfere with any new btpd started in the same -directory. - -### Using both IPv6 and IPv4 - -Unfortunately enabling both IPv6 and IPv4 in btpd is less useful than it -should be. The problem is that some sites have trackers for both versions -and it's likely that the IPv6 one, which probably has less peers, will be -used in favour of the IPv4 one. - -In order to fix this problem, the IP version options should be changed to -be per torrent, in some future version of btpd. -- cgit 1.4.1