summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorerdgeist <>2007-01-05 00:00:42 +0000
committererdgeist <>2007-01-05 00:00:42 +0000
commitcdf2fbabedcd3b9e2423cce74225744db1acc178 (patch)
tree8ae4f49c81dcd8507bf0629405d647386e60a96d
parent3d54ca32fe676c9a47a8e1e914f78cbd9c461906 (diff)
README\!
-rw-r--r--README21
-rw-r--r--opentracker.c7
-rw-r--r--scan_urlencoded_query.c3
-rw-r--r--scan_urlencoded_query.h3
-rw-r--r--testsuite.sh7
-rw-r--r--trackerlogic.c52
-rw-r--r--trackerlogic.h5
7 files changed, 44 insertions, 54 deletions
diff --git a/README b/README
new file mode 100644
index 0000000..17db7de
--- /dev/null
+++ b/README
@@ -0,0 +1,21 @@
1This is opentracker. An open bittorrent tracker.
2
3You need libowfat (http://www.fefe.de/libowfat/).
4
5Steps to go:
6
7fetch http://dl.fefe.de/libowfat-0.24.tar.bz2
8tar xjf libowfat-0.24.tar.bz2
9cd libowfat
10make
11cd ..
12fetch http://erdgeist.org/arts/software/opentracker/opentracker-1.0.tar.bz2
13tar xjf opentracker-1.0.tar.bz2
14cd opentracker-1.0
15make
16./opentracker
17
18This 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
19-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
20essential 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
21more 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 @@
1/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
2 It is considered beerware. Prost. Skol. Cheers or whatever.
3 Some of the stuff below is stolen from Fefes example libowfat httpd.
4*/
5
1#include "socket.h" 6#include "socket.h"
2#include "io.h" 7#include "io.h"
3#include "buffer.h" 8#include "buffer.h"
@@ -351,7 +356,7 @@ int main()
351 panic("io_fd"); 356 panic("io_fd");
352 357
353 signal( SIGINT, graceful ); 358 signal( SIGINT, graceful );
354 if( init_logic( "." ) == -1 ) 359 if( init_logic( ) == -1 )
355 panic("Logic not started"); 360 panic("Logic not started");
356 361
357 io_wantread(s); 362 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 @@
1/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
2 It is considered beerware. Prost. Skol. Cheers or whatever. */
3
1#include "scan.h" 4#include "scan.h"
2#include "scan_urlencoded_query.h" 5#include "scan_urlencoded_query.h"
3 6
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 @@
1/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
2 It is considered beerware. Prost. Skol. Cheers or whatever. */
3
1#ifndef __SCAN_URLENCODED_QUERY_H__ 4#ifndef __SCAN_URLENCODED_QUERY_H__
2#define __SCAN_URLENCODED_QUERY_H__ 5#define __SCAN_URLENCODED_QUERY_H__
3 6
diff --git a/testsuite.sh b/testsuite.sh
index 001bc5f..6b2dad9 100644
--- a/testsuite.sh
+++ b/testsuite.sh
@@ -1,13 +1,12 @@
1#!/bin/sh 1#!/bin/sh
2 2
3while true; do 3while true; do
4 request_string="GET /announce?info_hash=012345678901234567%$(printf %02X `jot -r 1 0 255`)%$(printf %02X `jot -r 1 0 255`)&\ 4 request_string="GET /announce?info_hash=0123456789012345678%$(printf %02X $(( $RANDOM & 0xff )) )&\
5ip=10.1.1.`jot -r 1 0 255`&\ 5ip=10.1.1.$(( $RANDOM & 0xff ))&port=$(( $RANDOM & 0xff )) HTTP/1.0\n"
6port=`jot -r 1 0 255` HTTP/1.0\n"
7 6
8 echo -e $request_string 7 echo -e $request_string
9 echo 8 echo
10 echo -e $request_string | nc erdgeist.org 6969 | tr -C "[:print:]" _ 9 echo -e $request_string | nc 213.73.88.214 6969 | tr -C "[:print:]" _
11 echo 10 echo
12 11
13done 12done
diff --git a/trackerlogic.c b/trackerlogic.c
index 083161d..84330df 100644
--- a/trackerlogic.c
+++ b/trackerlogic.c
@@ -1,3 +1,6 @@
1/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
2 It is considered beerware. Prost. Skol. Cheers or whatever. */
3
1#include "trackerlogic.h" 4#include "trackerlogic.h"
2 5
3#include <stdlib.h> 6#include <stdlib.h>
@@ -269,63 +272,16 @@ void remove_peer_from_torrent( ot_hash *hash, ot_peer *peer ) {
269 } 272 }
270} 273}
271 274
272#if 0
273void dump_knowledge( void ) {
274 int ati, tli, pli;
275 for( ati = 0; ati<256; ++ati ) {
276 ot_vector *torrent_list = &all_torrents[ati];
277 for( tli = 0; tli<torrent_list->size; ++tli ) {
278 ot_torrent *torrent = &torrent_list->data[tli];
279 for( pool = 0; pool<OT_POOLS_COUNT; ++pool ) {
280 for( pli=0; pli<torrent->peer_list->peers[pool].size; ++pli ) {
281
282
283 }
284 }
285 }
286 }
287}
288#endif
289
290void cleanup_torrents( void ) { 275void cleanup_torrents( void ) {
291 276
292} 277}
293 278
294int init_logic( char *directory ) { 279int init_logic( ) {
295 glob_t globber;
296 int i;
297
298 if( directory ) {
299 if( chdir( directory ))
300 return -1;
301 }
302
303 srandom( time(NULL)); 280 srandom( time(NULL));
304 281
305 // Initialize control structures 282 // Initialize control structures
306 byte_zero( all_torrents, sizeof (all_torrents)); 283 byte_zero( all_torrents, sizeof (all_torrents));
307 284
308 // Scan directory for filenames in the form [0-9A-F]{20}
309 // * I know this looks ugly, but I've seen A-F to match umlauts as well in strange locales
310 // * lower case for .. better being safe than sorry, this is not expensive here :)
311 if( !glob(
312 "[0-9ABCDEFabcdef][0-9ABCDEFabcdef][0-9ABCDEFabcdef][0-9ABCDEFabcdef]"
313 "[0-9ABCDEFabcdef][0-9ABCDEFabcdef][0-9ABCDEFabcdef][0-9ABCDEFabcdef]"
314 "[0-9ABCDEFabcdef][0-9ABCDEFabcdef][0-9ABCDEFabcdef][0-9ABCDEFabcdef]"
315 "[0-9ABCDEFabcdef][0-9ABCDEFabcdef][0-9ABCDEFabcdef][0-9ABCDEFabcdef]"
316 "[0-9ABCDEFabcdef][0-9ABCDEFabcdef][0-9ABCDEFabcdef][0-9ABCDEFabcdef]"
317 "[0-9ABCDEFabcdef][0-9ABCDEFabcdef][0-9ABCDEFabcdef][0-9ABCDEFabcdef]"
318 "[0-9ABCDEFabcdef][0-9ABCDEFabcdef][0-9ABCDEFabcdef][0-9ABCDEFabcdef]"
319 "[0-9ABCDEFabcdef][0-9ABCDEFabcdef][0-9ABCDEFabcdef][0-9ABCDEFabcdef]"
320 "[0-9ABCDEFabcdef][0-9ABCDEFabcdef][0-9ABCDEFabcdef][0-9ABCDEFabcdef]"
321 "[0-9ABCDEFabcdef][0-9ABCDEFabcdef][0-9ABCDEFabcdef][0-9ABCDEFabcdef]"
322 , GLOB_NOCHECK, 0, &globber) )
323 {
324 for( i=0; i<globber.gl_matchc; ++i )
325 printf( "Found: %s\n", globber.gl_pathv[i] );
326 }
327
328 globfree( &globber );
329 return 0; 285 return 0;
330} 286}
331 287
diff --git a/trackerlogic.h b/trackerlogic.h
index 03c8e9e..06a9dd1 100644
--- a/trackerlogic.h
+++ b/trackerlogic.h
@@ -1,3 +1,6 @@
1/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
2 It is considered beerware. Prost. Skol. Cheers or whatever. */
3
1#ifndef __TRACKERLOGIC_H__ 4#ifndef __TRACKERLOGIC_H__
2#define __TRACKERLOGIC_H__ 5#define __TRACKERLOGIC_H__
3 6
@@ -72,7 +75,7 @@ typedef struct {
72// Exported functions 75// Exported functions
73// 76//
74 77
75int init_logic( char *chdir_directory ); 78int init_logic( );
76void deinit_logic( ); 79void deinit_logic( );
77 80
78ot_torrent *add_peer_to_torrent( ot_hash *hash, ot_peer *peer ); 81ot_torrent *add_peer_to_torrent( ot_hash *hash, ot_peer *peer );