From cdf2fbabedcd3b9e2423cce74225744db1acc178 Mon Sep 17 00:00:00 2001 From: erdgeist <> Date: Fri, 5 Jan 2007 00:00:42 +0000 Subject: README\! --- README | 21 ++++++++++++++++++++ opentracker.c | 7 ++++++- scan_urlencoded_query.c | 3 +++ scan_urlencoded_query.h | 3 +++ testsuite.sh | 7 +++---- trackerlogic.c | 52 ++++--------------------------------------------- trackerlogic.h | 5 ++++- 7 files changed, 44 insertions(+), 54 deletions(-) create mode 100644 README diff --git a/README b/README new file mode 100644 index 0000000..17db7de --- /dev/null +++ b/README @@ -0,0 +1,21 @@ +This is opentracker. An open bittorrent tracker. + +You need libowfat (http://www.fefe.de/libowfat/). + +Steps to go: + +fetch http://dl.fefe.de/libowfat-0.24.tar.bz2 +tar xjf libowfat-0.24.tar.bz2 +cd libowfat +make +cd .. +fetch http://erdgeist.org/arts/software/opentracker/opentracker-1.0.tar.bz2 +tar xjf opentracker-1.0.tar.bz2 +cd opentracker-1.0 +make +./opentracker + +This tracker is open in a sense that everyone announcing a torrent is welcome to do so and will be informed about anyone else announcing the same torrent. Unless +-DWANT_IP_FROM_QUERY_STRING is enabled (which is meant for debugging purposes only), only source IPs are accepted. The tracker implements a minimal set of +essential features only but was able respond to far more than 10000 requests per second on a Sun Fire 2200 M2 (thats where we found no more clients able to fire +more of our testsuite.sh script). diff --git a/opentracker.c b/opentracker.c index 680caa4..de98bb3 100644 --- a/opentracker.c +++ b/opentracker.c @@ -1,3 +1,8 @@ +/* This software was written by Dirk Engling + It is considered beerware. Prost. Skol. Cheers or whatever. + Some of the stuff below is stolen from Fefes example libowfat httpd. +*/ + #include "socket.h" #include "io.h" #include "buffer.h" @@ -351,7 +356,7 @@ int main() panic("io_fd"); signal( SIGINT, graceful ); - if( init_logic( "." ) == -1 ) + if( init_logic( ) == -1 ) panic("Logic not started"); io_wantread(s); diff --git a/scan_urlencoded_query.c b/scan_urlencoded_query.c index a21ec04..ec145f9 100644 --- a/scan_urlencoded_query.c +++ b/scan_urlencoded_query.c @@ -1,3 +1,6 @@ +/* This software was written by Dirk Engling + It is considered beerware. Prost. Skol. Cheers or whatever. */ + #include "scan.h" #include "scan_urlencoded_query.h" diff --git a/scan_urlencoded_query.h b/scan_urlencoded_query.h index 5cc6630..83f9be0 100644 --- a/scan_urlencoded_query.h +++ b/scan_urlencoded_query.h @@ -1,3 +1,6 @@ +/* This software was written by Dirk Engling + It is considered beerware. Prost. Skol. Cheers or whatever. */ + #ifndef __SCAN_URLENCODED_QUERY_H__ #define __SCAN_URLENCODED_QUERY_H__ diff --git a/testsuite.sh b/testsuite.sh index 001bc5f..6b2dad9 100644 --- a/testsuite.sh +++ b/testsuite.sh @@ -1,13 +1,12 @@ #!/bin/sh while true; do - request_string="GET /announce?info_hash=012345678901234567%$(printf %02X `jot -r 1 0 255`)%$(printf %02X `jot -r 1 0 255`)&\ -ip=10.1.1.`jot -r 1 0 255`&\ -port=`jot -r 1 0 255` HTTP/1.0\n" + request_string="GET /announce?info_hash=0123456789012345678%$(printf %02X $(( $RANDOM & 0xff )) )&\ +ip=10.1.1.$(( $RANDOM & 0xff ))&port=$(( $RANDOM & 0xff )) HTTP/1.0\n" echo -e $request_string echo - echo -e $request_string | nc erdgeist.org 6969 | tr -C "[:print:]" _ + echo -e $request_string | nc 213.73.88.214 6969 | tr -C "[:print:]" _ echo done diff --git a/trackerlogic.c b/trackerlogic.c index 083161d..84330df 100644 --- a/trackerlogic.c +++ b/trackerlogic.c @@ -1,3 +1,6 @@ +/* This software was written by Dirk Engling + It is considered beerware. Prost. Skol. Cheers or whatever. */ + #include "trackerlogic.h" #include @@ -269,63 +272,16 @@ void remove_peer_from_torrent( ot_hash *hash, ot_peer *peer ) { } } -#if 0 -void dump_knowledge( void ) { - int ati, tli, pli; - for( ati = 0; ati<256; ++ati ) { - ot_vector *torrent_list = &all_torrents[ati]; - for( tli = 0; tlisize; ++tli ) { - ot_torrent *torrent = &torrent_list->data[tli]; - for( pool = 0; poolpeer_list->peers[pool].size; ++pli ) { - - - } - } - } - } -} -#endif - void cleanup_torrents( void ) { } -int init_logic( char *directory ) { - glob_t globber; - int i; - - if( directory ) { - if( chdir( directory )) - return -1; - } - +int init_logic( ) { srandom( time(NULL)); // Initialize control structures byte_zero( all_torrents, sizeof (all_torrents)); - // Scan directory for filenames in the form [0-9A-F]{20} - // * I know this looks ugly, but I've seen A-F to match umlauts as well in strange locales - // * lower case for .. better being safe than sorry, this is not expensive here :) - if( !glob( - "[0-9ABCDEFabcdef][0-9ABCDEFabcdef][0-9ABCDEFabcdef][0-9ABCDEFabcdef]" - "[0-9ABCDEFabcdef][0-9ABCDEFabcdef][0-9ABCDEFabcdef][0-9ABCDEFabcdef]" - "[0-9ABCDEFabcdef][0-9ABCDEFabcdef][0-9ABCDEFabcdef][0-9ABCDEFabcdef]" - "[0-9ABCDEFabcdef][0-9ABCDEFabcdef][0-9ABCDEFabcdef][0-9ABCDEFabcdef]" - "[0-9ABCDEFabcdef][0-9ABCDEFabcdef][0-9ABCDEFabcdef][0-9ABCDEFabcdef]" - "[0-9ABCDEFabcdef][0-9ABCDEFabcdef][0-9ABCDEFabcdef][0-9ABCDEFabcdef]" - "[0-9ABCDEFabcdef][0-9ABCDEFabcdef][0-9ABCDEFabcdef][0-9ABCDEFabcdef]" - "[0-9ABCDEFabcdef][0-9ABCDEFabcdef][0-9ABCDEFabcdef][0-9ABCDEFabcdef]" - "[0-9ABCDEFabcdef][0-9ABCDEFabcdef][0-9ABCDEFabcdef][0-9ABCDEFabcdef]" - "[0-9ABCDEFabcdef][0-9ABCDEFabcdef][0-9ABCDEFabcdef][0-9ABCDEFabcdef]" - , GLOB_NOCHECK, 0, &globber) ) - { - for( i=0; i + It is considered beerware. Prost. Skol. Cheers or whatever. */ + #ifndef __TRACKERLOGIC_H__ #define __TRACKERLOGIC_H__ @@ -72,7 +75,7 @@ typedef struct { // Exported functions // -int init_logic( char *chdir_directory ); +int init_logic( ); void deinit_logic( ); ot_torrent *add_peer_to_torrent( ot_hash *hash, ot_peer *peer ); -- cgit v1.2.3