THIS IS PRE-ALPHA SOFTWARE. USE AT YOUR OWN RISK.
mod_bt has been constructed to be modular. There are two main parts: libbtt, the code library that has all of the BitTorrent Tracker-specific stuff in it, and mod_bt, which "glues" libbtt to apache2. libbtt uses the APR (Apache Portability Runtime) library for it's memory pools and shared memory, but it could just as easily be used in projects completely unrelated to apache so long as that library is available.
There are also Perl language bindings both for libbtt and mod_bt, which enable perl coders to further customize their trackers.
The "etc/httpd.conf" file provides a functioning example. At the very least, you will have to make a directory for mod_bt's data files to live and specify that to apache as "TrackerHome", as well as setting up your content-handlers at their appropriate URLs.
(hash interval = ((peers / factor) + 1) * tracker interval) (Default: 1000)Handler for BitTorrent peer announce requests.
Extensions:
shield=1 - When set, peer is considered "shielded".
When a shielded peer is a seed, it is only served to other peers if there are no unshielded seeds available. This flag should be used for "core" seeds only, to protect their bandwidth when there are other sources of the data available. Using mod_rewrite, you can both protect access to the "shield" option, and cause it to be automatically set on peers that should be shielded without their software having to be modified. Here is an example:
<IfModule mod_rewrite.c>
RewriteEngine On
# Don't allow people to set shield mode themselves
RewriteCond %{QUERY_STRING} ^.*shield=1
RewriteRule (.*) - [F]
# Auto-Activate shield mode on peers that are known to be good seeders
RewriteCond %{QUERY_STRING} !^.*shield=1
RewriteCond %{REMOTE_ADDR} ^10.20.30.40 [OR]
RewriteCond %{REMOTE_ADDR} ^20.30.40.50
RewriteRule (.*) /announce?shield=1 [PT,L,QSA,NE,NS]
</IfModule>
Handler for BitTorrent scrape requests
Extensions:
Only one of "xml=1", "verbose=1", or "html=1" may be specified.
info_hash=...[&info_hash=....[...]] -
Multiple "info_hash" parameters may be passed to /scrape, in which case only the details for the hashes specified will
be displayed.
xml=1 -
Return results in an XML-like format rather than bencoded. The XML format contains a lot of additional information about
the hash that is not supplied in the bencode, such as the last time we heard from a peer, total hits to /announce, etc.
verbose=1 -
Return the file's name and size in the bencode in addition to the standard "completed/downloaded/incomplete" statistics.
html=1 -
Return an HTML information page about the hashes rather than a bencode.
full=1 -
Display information about all hashes, not ones that have been active recently.
Return an HTML information page about the hashes. (Equivalent to calling the "modbt-scrape" handler with "html=1" appended to the URL arguments supplied by the user.)
Handler for Infohash registration.
When called with no arguments, a HTML page is displayed allowing the user to fill out the arguments required to register a hash.
This URL is more for use by administration scripts than actual users, but has an HTML interface to facilitate manual use as well.
Arguments:
filesize=... - Size of the file this torrent refers to, in bytes.filename=... - Name of the file this torrent refers to.info_hash=... - Binary representation of the info_hash for this torrent.info_hash_str=... - (For user input) hexadecimal representation of the info_hash for this torrent, as displayed by the HTML info pages.Anyone wanna help? :-)
I don't understand why this can happen since we're using transactions, but occasionally it seems that the
index that connects peers to hashes gets corrupted. Not a big deal, we just have to nuke all of our peers, and they
will all come back within TrackerReturnInterval seconds.
(This hasn't happened to me in a few weeks ago, it's possible this bug is actually fixed...)
Sometimes you can lose your entire database over this :-( I haven't seen it happen in over a few weeks now though, so it's possible the problem is fixed.
mod_bt 0.0.4
Copyright 2004 Tyler MacDonald <tyler@yi.org>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.