Browse Source

README\!

dynamic-accesslists
erdgeist 18 years ago
parent
commit
cdf2fbabed
  1. 21
      README
  2. 7
      opentracker.c
  3. 3
      scan_urlencoded_query.c
  4. 3
      scan_urlencoded_query.h
  5. 7
      testsuite.sh
  6. 52
      trackerlogic.c
  7. 5
      trackerlogic.h

21
README

@ -0,0 +1,21 @@ @@ -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).

7
opentracker.c

@ -1,3 +1,8 @@ @@ -1,3 +1,8 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
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() @@ -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);

3
scan_urlencoded_query.c

@ -1,3 +1,6 @@ @@ -1,3 +1,6 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
It is considered beerware. Prost. Skol. Cheers or whatever. */
#include "scan.h"
#include "scan_urlencoded_query.h"

3
scan_urlencoded_query.h

@ -1,3 +1,6 @@ @@ -1,3 +1,6 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
It is considered beerware. Prost. Skol. Cheers or whatever. */
#ifndef __SCAN_URLENCODED_QUERY_H__
#define __SCAN_URLENCODED_QUERY_H__

7
testsuite.sh

@ -1,13 +1,12 @@ @@ -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

52
trackerlogic.c

@ -1,3 +1,6 @@ @@ -1,3 +1,6 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
It is considered beerware. Prost. Skol. Cheers or whatever. */
#include "trackerlogic.h"
#include <stdlib.h>
@ -269,63 +272,16 @@ void remove_peer_from_torrent( ot_hash *hash, ot_peer *peer ) { @@ -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; tli<torrent_list->size; ++tli ) {
ot_torrent *torrent = &torrent_list->data[tli];
for( pool = 0; pool<OT_POOLS_COUNT; ++pool ) {
for( pli=0; pli<torrent->peer_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<globber.gl_matchc; ++i )
printf( "Found: %s\n", globber.gl_pathv[i] );
}
globfree( &globber );
return 0;
}

5
trackerlogic.h

@ -1,3 +1,6 @@ @@ -1,3 +1,6 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
It is considered beerware. Prost. Skol. Cheers or whatever. */
#ifndef __TRACKERLOGIC_H__
#define __TRACKERLOGIC_H__
@ -72,7 +75,7 @@ typedef struct { @@ -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 );

Loading…
Cancel
Save