Browse Source

Be more helpful

master
Dirk Engling 15 years ago
parent
commit
9957e9ea1f
  1. 44
      opentracker.c
  2. 1
      trackerlogic.c
  3. 3
      trackerlogic.h

44
opentracker.c

@ -342,10 +342,37 @@ void graceful( int s ) {
void usage( char *name ) {
fprintf( stderr, "Usage: %s [-i serverip] [-p serverport] [-d serverdirectory]"
#ifdef WANT_CLOSED_TRACKER
" [-o|c]"
" [-oc]"
#endif
#ifdef WANT_BLACKLIST
" [-bB]"
#endif
"\n", name );
exit(1);
}
void help( char *name ) {
usage( name );
fprintf( stderr, "\t-i serverip\tspecify ip to bind to (default: *)\n"
"\t-p serverport\tspecify port to bind to (default: 6969)\n"
"\t-d serverdir\tspecify directory containing white- or black listed torrent info_hashes (default: \".\")\n"
#ifdef WANT_CLOSED_TRACKER
"\t-o\t\tmake tracker an open tracker, e.g. do not check for white list (default: off)\n"
"\t-c\t\tmake tracker a closed tracker, e.g. check each announced torrent against white list (default: on)\n"
#endif
#ifdef WANT_BLACKLIST
"\t-b\t\tmake tracker check its black list, e.g. check each announced torrent against black list (default: on)\n"
"\t-B\t\tmake tracker check its black list, e.g. check each announced torrent against black list (default: off)\n"
#endif
#ifdef WANT_CLOSED_TRACKER
"\n* To white list a torrent, touch a file inside serverdir with info_hash hex string.\n"
#endif
#ifdef WANT_BLACKLIST
#ifndef WANT_CLOSED_TRACKER
"\n"
#endif
"* To white list a torrent, touch a file inside serverdir with info_hash hex string, preprended by '-'.\n"
#endif
);
}
int main( int argc, char **argv ) {
@ -356,17 +383,22 @@ int main( int argc, char **argv ) {
uint16 port = 6969;
while( 1 ) {
switch( getopt(argc,argv,":i:p:d:") ) {
switch( getopt(argc,argv,":i:p:d:ocbBh") ) {
case -1: goto allparsed;
case 'i': serverip = optarg; break;
case 'p': port = (uint16)atol( optarg ); break;
case 'd': serverdir = optarg; break;
case 'h': help( argv[0]); exit(0);
#ifdef WANT_CLOSED_TRACKER
case 'o': g_closedtracker = 0;
case 'c': g_closedtracker = 1;
case 'o': g_closedtracker = 0; break;
case 'c': g_closedtracker = 1; break;
#endif
#ifdef WANT_BLACKLIST
case 'b': g_check_blacklist = 1; break;
case 'B': g_check_blacklist = 0; break;
#endif
default:
case '?': usage( argv[0] );
case '?': usage( argv[0] ); exit(1);
}
}

1
trackerlogic.c

@ -32,6 +32,7 @@ static ot_torrent* const OT_TORRENT_NOT_ON_WHITELIST = (ot_torrent*)1;
#endif
#ifdef WANT_BLACKLIST
int g_check_blacklist = 1;
static ot_torrent* const OT_TORRENT_ON_BLACKLIST = (ot_torrent*)2;
#endif

3
trackerlogic.h

@ -81,6 +81,9 @@ void deinit_logic( );
#ifdef WANT_CLOSED_TRACKER
extern int g_closedtracker;
#endif
#ifdef WANT_BLACKLIST
extern int g_check_blacklist;
#endif
ot_torrent *add_peer_to_torrent( ot_hash *hash, ot_peer *peer );
size_t return_peers_for_torrent( ot_torrent *torrent, unsigned long amount, char *reply );

Loading…
Cancel
Save