BitTorrent is a peer-to-peer (P2P) protocol intended to speed up retrieval (downloading) of large offerings. More information can be found in the BitTorrent FAQ and Guide written by Brian Dessent. To use BitTorrent, you need the software (free and open source) written by Bram Cohen. It does not contain spy or adware. The Installing BitTorrent section of the FAQ lists other clients. To serve torrents, you need a BitTorrent tracker. There are some public trackers that you might use instead. Alternatively, you can run your own tracker by using Bram's software or by using the BitTorrent::TrackerCGI that runs bittorrent.netspace.org.
BitTorrent::TrackerCGI is Free and Open Source.It is the software behind bittorrent.netspace.org.BitTorrent::TrackerCGI is written in Perl and can run as a mod_perl handler (fast) or as a CGI program (slow). It is licensed under the GNU Public License (GPL) and requires a web server, a standard Perl installation, a MySQL database account, and the additional Perl modules DBI, DBD::mysql, and Digest::SHA1. The extra Perl modules are all available from CPAN if your distributor does not already provide these as extra packages (e.g. they are RedHat RPMs with RedHat 9). Apache::DBI is recommended, but not required, if running under mod_perl. install
bittorrent.netspace.org snippet (not complete config) from httpd.conf:HostnameLookups off UseCanonicalName on KeepAlive Off CGICommandArgs off LoadModule config_log_module modules/mod_log_config.so LoadModule mime_module modules/mod_mime.so LoadModule includes_module modules/mod_include.so LoadModule dir_module modules/mod_dir.so LoadModule access_module modules/mod_access.so LoadModule expires_module modules/mod_expires.so LoadModule perl_module modules/libperl.so LoadModule gzip_module modules/mod_gzip.so # Reconstruction of the complete module list from all available modules # (static and shared ones) to achieve correct module execution order. # [WHENEVER YOU CHANGE THE LOADMODULE SECTION ABOVE UPDATE THIS, TOO] ClearModuleList AddModule mod_log_config.c AddModule mod_mime.c AddModule mod_include.c AddModule mod_dir.c AddModule mod_access.c AddModule mod_expires.c AddModule mod_so.c AddModule mod_perl.c AddModule mod_gzip.c TypesConfig /etc/mime.types DirectoryIndex index.html <Directory /> AllowOverride None Options FollowSymLinks deny from all </Directory> <Directory /web/?/?/*/*> allow from all </Directory> ## mod_gzip <IfModule mod_gzip.c> ## Written for mod_gzip v 1.3.26.1a -- code()gluelogic.com ## Aggressive. Compress everything except images. ## DISable mod_gzip mod_gzip_on no ## intercept chunked encoding type (to allow for possible compression) mod_gzip_dechunk yes ## use this dir for creating work files mod_gzip_temp_dir /tmp ## do not preserve work files (only enable for debugging) mod_gzip_keep_workfiles no ## max file size to compress in memory before using work file ## (default, and max allowed) mod_gzip_maximum_inmem_size 60000 ## min file size to compress (default) mod_gzip_minimum_file_size 300 ## max file size to compress (2 MB generous, but a sanity check) mod_gzip_maximum_file_size 2000000 ## check for already-compressed files (*.gz) mod_gzip_can_negotiate No ## include header size (always uncompressed) in Apache logs mod_gzip_add_header_count Yes ## By default mod_gzip compresses only things included AND not excluded. ## include everything (that is not excluded below) mod_gzip_item_include uri . #mod_gzip_item_include mime . #mod_gzip_item_include handler perl-script ## exclude images/* ## (commented out more general to use 'file' and avoid sending Vary header) #mod_gzip_item_exclude mime ^image/ mod_gzip_item_exclude file \.gif$ </IfModule> ## mod_perl PerlRequire /web/p/e/perl/lib/mod_perl_startup.pl PerlFixupHandler Apache::SizeLimit PerlFreshRestart on PerlSetupEnv off PerlSendHeader off PerlTaintCheck on PerlWarn on # Turn PerlWarn on for debugging and whenever a new module is added ## Virtual Hosts NameVirtualHost * <VirtualHost *> ServerName bittorrent.netspace.org PerlTransHandler 'sub { return shift->uri() =~ m|^/tracker| \ ? Apache::OK \ : Apache::DECLINED; }' <Location /tracker> SetHandler perl-script PerlHandler BitTorrent::TrackerCGI </Location> DocumentRoot /web/p/e/perl/bittorrent.netspace.org <Directory /web/p/e/perl/bittorrent.netspace.org> Options +IncludesNoEXEC </Directory> DirectoryIndex index.shtml index.html AddType application/x-bittorrent .torrent AddType text/html .shtml AddType text/xml .xml AddHandler server-parsed .shtml .xml ExpiresActive on ExpiresDefault A900 ExpiresByType application/x-bittorrent A3600 ## enable mod_gzip mod_gzip_on yes </VirtualHost> mod_perl_startup.pl (sample):#!/usr/bin/perl -Tw ## gs()gluelogic.com ## Be very careful with what is called from this script. At Apache startup, ## it will be included into the Apache mod_perl server. Anything run at ## that point is run under user root. (You should only be including libraries ## here.) Therefore, do not include here any code to which a non-root and ## non-admin user has write privileges. use strict; ## ---------- ## ---------- ## This section is similar in scope to Apache::Debug. ## Delivers a stack backtrace to the error log when perl code dies. ## Allocate 64K as an emergency memory pool for use in out of memory situation $^M = 0x00 x 65536; ## Little trick to initialize this routine here so that in the case of OOM, ## compiling this routine doesn't eat memory from the emergency memory pool $^M use CGI::Carp (); eval { CGI::Carp::confess('init') }; ## Importing CGI::Carp sets $main::SIG{__DIE__} = \&CGI::Carp::die; ## Override that to additionally give a stack backtrace $main::SIG{__DIE__} = \&CGI::Carp::confess; ## ---------- ## ---------- ## Preload often-used modules into the main httpd server ## so that they are shared between all httpd children. ## Need these two in specific order to avoid segv in mod_perl 1.2.6 + Perl 5.6.1 use DynaLoader (); use XSLoader (); use Exporter (); use POSIX (); use Socket (); use Symbol (); use Apache (); # Make sure Apache children do not grow too large (memory usage) # Set generous memory size limit and do not check too often use Apache::SizeLimit (); $Apache::SizeLimit::MAX_PROCESS_SIZE = 16384; $Apache::SizeLimit::CHECK_EVERY_N_REQUESTS = 16; $Apache::SizeLimit::MIN_SHARE_SIZE = 2048; $Apache::SizeLimit::MAX_UNSHARED_SIZE = 8192; ## Load a Perl interface to the Apache API ## (unused) #use Apache::RegistryBB (); ## This is SO chunky. It adds > 2 MB to Apache children! ## This is the recommended way to call CGI.pm v2.46 and up for use in mod_perl. ## (unused) #use CGI qw(-compile :all); ## ---------- ## ---------- ## install database driver and preload database modules ## adds about 3 MB to memory usage, but it will be shared. ## However, these drivers seem to leak on USR1 signal, ## so perform a shutdown/restart when updating the server use Apache::DBI (); ## (MUST be before DBI.pm) use DBI (); DBI->install_driver('mysql'); use DBD::mysql (); Apache::DBI->connect_on_init ( 'DBI:mysql:database=perl;host=mysql.netspace.org','perl','not-my-password', { PrintError => 1, # warn() on errors RaiseError => 0, # do not die on error AutoCommit => 1 # commit executes immediately } ); ## ---------- ## ---------- ## Local libraries ## Add local library directory to Perl's @INC library search path use lib '/web/p/e/perl/lib'; ## BitTorrent tracker use BitTorrent::TrackerCGI (); 1; __END__ # The __END__ and __DATA__ tags may NOT be used in any Apache::Registry # scripts, but are allowed in server configuration files. |