|
|
@ -17,9 +17,12 @@ public: |
|
|
|
int nThreads; |
|
|
|
int nThreads; |
|
|
|
int nPort; |
|
|
|
int nPort; |
|
|
|
int nDnsThreads; |
|
|
|
int nDnsThreads; |
|
|
|
|
|
|
|
int fWipeBan; |
|
|
|
|
|
|
|
int fWipeIgnore; |
|
|
|
const char *mbox; |
|
|
|
const char *mbox; |
|
|
|
const char *ns; |
|
|
|
const char *ns; |
|
|
|
const char *host; |
|
|
|
const char *host; |
|
|
|
|
|
|
|
const char *tor; |
|
|
|
|
|
|
|
|
|
|
|
CDnsSeedOpts() : nThreads(24), nDnsThreads(24), nPort(53), mbox(NULL), ns(NULL), host(NULL) {} |
|
|
|
CDnsSeedOpts() : nThreads(24), nDnsThreads(24), nPort(53), mbox(NULL), ns(NULL), host(NULL) {} |
|
|
|
|
|
|
|
|
|
|
@ -34,6 +37,9 @@ public: |
|
|
|
"-t <threads> Number of crawlers to run in parallel (default 24)\n" |
|
|
|
"-t <threads> Number of crawlers to run in parallel (default 24)\n" |
|
|
|
"-d <threads> Number of DNS server threads (default 24)\n" |
|
|
|
"-d <threads> Number of DNS server threads (default 24)\n" |
|
|
|
"-p <port> UDP port to listen on (default 53)\n" |
|
|
|
"-p <port> UDP port to listen on (default 53)\n" |
|
|
|
|
|
|
|
"-o <ip:port> Tor proxy IP/Port\n" |
|
|
|
|
|
|
|
"--wipeban Wipe list of banned nodes\n" |
|
|
|
|
|
|
|
"--wipeignore Wipe list of ignored nodes\n" |
|
|
|
"-?, --help Show this text\n" |
|
|
|
"-?, --help Show this text\n" |
|
|
|
"\n"; |
|
|
|
"\n"; |
|
|
|
bool showHelp = false; |
|
|
|
bool showHelp = false; |
|
|
@ -46,11 +52,14 @@ public: |
|
|
|
{"threads", required_argument, 0, 't'}, |
|
|
|
{"threads", required_argument, 0, 't'}, |
|
|
|
{"dnsthreads", required_argument, 0, 'd'}, |
|
|
|
{"dnsthreads", required_argument, 0, 'd'}, |
|
|
|
{"port", required_argument, 0, 'p'}, |
|
|
|
{"port", required_argument, 0, 'p'}, |
|
|
|
|
|
|
|
{"onion", required_argument, 0, 'o'}, |
|
|
|
|
|
|
|
{"wipeban", no_argument, &fWipeBan, 1}, |
|
|
|
|
|
|
|
{"wipeignore", no_argument, &fWipeBan, 1}, |
|
|
|
{"help", no_argument, 0, 'h'}, |
|
|
|
{"help", no_argument, 0, 'h'}, |
|
|
|
{0, 0, 0, 0} |
|
|
|
{0, 0, 0, 0} |
|
|
|
}; |
|
|
|
}; |
|
|
|
int option_index = 0; |
|
|
|
int option_index = 0; |
|
|
|
int c = getopt_long(argc, argv, "h:n:m:t:p:d:", long_options, &option_index); |
|
|
|
int c = getopt_long(argc, argv, "h:n:m:t:p:d:o:", long_options, &option_index); |
|
|
|
if (c == -1) break; |
|
|
|
if (c == -1) break; |
|
|
|
switch (c) { |
|
|
|
switch (c) { |
|
|
|
case 'h': { |
|
|
|
case 'h': { |
|
|
@ -86,6 +95,11 @@ public: |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 'o': { |
|
|
|
|
|
|
|
tor = optarg; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
case '?': { |
|
|
|
case '?': { |
|
|
|
showHelp = true; |
|
|
|
showHelp = true; |
|
|
|
break; |
|
|
|
break; |
|
|
@ -322,7 +336,11 @@ int main(int argc, char **argv) { |
|
|
|
setbuf(stdout, NULL); |
|
|
|
setbuf(stdout, NULL); |
|
|
|
CDnsSeedOpts opts; |
|
|
|
CDnsSeedOpts opts; |
|
|
|
opts.ParseCommandLine(argc, argv); |
|
|
|
opts.ParseCommandLine(argc, argv); |
|
|
|
SetProxy(NET_TOR, CService("127.0.0.1", 9050)); |
|
|
|
CService service(opts.tor, 9050); |
|
|
|
|
|
|
|
if (service.IsValid()) { |
|
|
|
|
|
|
|
printf("Using Tor proxy at %s\n", service.ToStringIPPort().c_str()); |
|
|
|
|
|
|
|
SetProxy(NET_TOR, service); |
|
|
|
|
|
|
|
} |
|
|
|
bool fDNS = true; |
|
|
|
bool fDNS = true; |
|
|
|
if (!opts.ns) { |
|
|
|
if (!opts.ns) { |
|
|
|
printf("No nameserver set. Not starting DNS server.\n"); |
|
|
|
printf("No nameserver set. Not starting DNS server.\n"); |
|
|
@ -337,7 +355,9 @@ int main(int argc, char **argv) { |
|
|
|
printf("Loading dnsseed.dat..."); |
|
|
|
printf("Loading dnsseed.dat..."); |
|
|
|
CAutoFile cf(f); |
|
|
|
CAutoFile cf(f); |
|
|
|
cf >> db; |
|
|
|
cf >> db; |
|
|
|
|
|
|
|
if (opts.fWipeBan) |
|
|
|
db.banned.clear(); |
|
|
|
db.banned.clear(); |
|
|
|
|
|
|
|
if (opts.fWipeIgnore) |
|
|
|
db.ResetIgnores(); |
|
|
|
db.ResetIgnores(); |
|
|
|
printf("done\n"); |
|
|
|
printf("done\n"); |
|
|
|
} |
|
|
|
} |
|
|
|