Changeset View
Changeset View
Standalone View
Standalone View
src/seeder/main.cpp
Show First 20 Lines • Show All 346 Lines • ▼ Show 20 Lines | extern "C" void *ThreadSeeder(void *) { | ||||
return nullptr; | return nullptr; | ||||
} | } | ||||
static void SetupSeederArgs() { | static void SetupSeederArgs() { | ||||
gArgs.AddArg("-?", _("Print this help message and exit"), false, | gArgs.AddArg("-?", _("Print this help message and exit"), false, | ||||
OptionsCategory::OPTIONS); | OptionsCategory::OPTIONS); | ||||
gArgs.AddArg("-host=<host>", _("Hostname of the DNS seed"), false, | gArgs.AddArg("-host=<host>", _("Hostname of the DNS seed"), false, | ||||
OptionsCategory::OPTIONS); | OptionsCategory::OPTIONS); | ||||
gArgs.AddArg("-ns=<ns>", _("Hostname of the nameserver"), false, | gArgs.AddArg("-nameserver=<ns>", _("Hostname of the nameserver"), false, | ||||
OptionsCategory::OPTIONS); | OptionsCategory::OPTIONS); | ||||
gArgs.AddArg("-mbox=<mbox>", _("E-Mail address reported in SOA records"), | gArgs.AddArg("-email=<mbox>", _("E-Mail address reported in SOA records"), | ||||
false, OptionsCategory::OPTIONS); | false, OptionsCategory::OPTIONS); | ||||
gArgs.AddArg("-threads=<threads>", | gArgs.AddArg("-threads=<threads>", | ||||
_("Number of crawlers to run in parallel (default 96)"), false, | _("Number of crawlers to run in parallel (default 96)"), false, | ||||
OptionsCategory::OPTIONS); | OptionsCategory::OPTIONS); | ||||
gArgs.AddArg("-dnsthreads=<threads>", | gArgs.AddArg("-dnsthreads=<threads>", | ||||
_("Number of DNS server threads (default 4)"), false, | _("Number of DNS server threads (default 4)"), false, | ||||
OptionsCategory::OPTIONS); | OptionsCategory::OPTIONS); | ||||
gArgs.AddArg("-port=<port>", _("UDP port to listen on (default 53)"), false, | gArgs.AddArg("-port=<port>", _("UDP port to listen on (default 53)"), false, | ||||
OptionsCategory::OPTIONS); | OptionsCategory::OPTIONS); | ||||
gArgs.AddArg("-onion=<ip:port>", _("Tor proxy IP/Port"), false, | gArgs.AddArg("-onion=<ip:port>", _("Tor proxy IP/Port"), false, | ||||
OptionsCategory::CONNECTION); | OptionsCategory::CONNECTION); | ||||
gArgs.AddArg("-proxyipv4=<ip:port>", _("IPV4 SOCKS5 proxy IP/Port"), false, | gArgs.AddArg("-ipv4proxy=<ip:port>", _("IPV4 SOCKS5 proxy IP/Port"), false, | ||||
OptionsCategory::CONNECTION); | OptionsCategory::CONNECTION); | ||||
gArgs.AddArg("-proxyipv6=<ip:port>", _("IPV6 SOCKS5 proxy IP/Port"), false, | gArgs.AddArg("-ipv6proxy=<ip:port>", _("IPV6 SOCKS5 proxy IP/Port"), false, | ||||
OptionsCategory::CONNECTION); | OptionsCategory::CONNECTION); | ||||
gArgs.AddArg("-filter=<f1,f2,...>", | gArgs.AddArg("-filter=<f1,f2,...>", | ||||
_("Allow these flag combinations as filters"), false, | _("Allow these flag combinations as filters"), false, | ||||
OptionsCategory::OPTIONS); | OptionsCategory::OPTIONS); | ||||
gArgs.AddArg("-testnet", _("Use testnet"), false, | gArgs.AddArg("-testnet", _("Use testnet"), false, | ||||
OptionsCategory::CHAINPARAMS); | OptionsCategory::CHAINPARAMS); | ||||
gArgs.AddArg("-wipeban", _("Wipe list of banned nodes"), false, | gArgs.AddArg("-wipeban", _("Wipe list of banned nodes"), false, | ||||
OptionsCategory::CONNECTION); | OptionsCategory::CONNECTION); | ||||
▲ Show 20 Lines • Show All 80 Lines • ▼ Show 20 Lines | if (opts.tor) { | ||||
if (service.IsValid()) { | if (service.IsValid()) { | ||||
fprintf(stdout, "Using Tor proxy at %s\n", | fprintf(stdout, "Using Tor proxy at %s\n", | ||||
service.ToStringIPPort().c_str()); | service.ToStringIPPort().c_str()); | ||||
SetProxy(NET_ONION, proxyType(service)); | SetProxy(NET_ONION, proxyType(service)); | ||||
} | } | ||||
} | } | ||||
// Get ipv4 proxy | // Get ipv4 proxy | ||||
if (gArgs.IsArgSet("-proxyipv4")) { | if (gArgs.IsArgSet("-ipv4proxy")) { | ||||
opts.ipv6_proxy = gArgs.GetArg("-proxyipv4", "").c_str(); | opts.ipv6_proxy = gArgs.GetArg("-ipv4proxy", "").c_str(); | ||||
} | } | ||||
if (opts.ipv4_proxy) { | if (opts.ipv4_proxy) { | ||||
CService service(LookupNumeric(opts.ipv4_proxy, 9050)); | CService service(LookupNumeric(opts.ipv4_proxy, 9050)); | ||||
if (service.IsValid()) { | if (service.IsValid()) { | ||||
fprintf(stdout, "Using IPv4 proxy at %s\n", | fprintf(stdout, "Using IPv4 proxy at %s\n", | ||||
service.ToStringIPPort().c_str()); | service.ToStringIPPort().c_str()); | ||||
SetProxy(NET_IPV4, proxyType(service)); | SetProxy(NET_IPV4, proxyType(service)); | ||||
} | } | ||||
} | } | ||||
// Get ipv6 proxy | // Get ipv6 proxy | ||||
if (gArgs.IsArgSet("-proxyipv6")) { | if (gArgs.IsArgSet("-ipv6proxy")) { | ||||
opts.ipv6_proxy = gArgs.GetArg("-proxyipv6", "").c_str(); | opts.ipv6_proxy = gArgs.GetArg("-ipv6proxy", "").c_str(); | ||||
} | } | ||||
if (opts.ipv6_proxy) { | if (opts.ipv6_proxy) { | ||||
CService service(LookupNumeric(opts.ipv6_proxy, 9050)); | CService service(LookupNumeric(opts.ipv6_proxy, 9050)); | ||||
if (service.IsValid()) { | if (service.IsValid()) { | ||||
fprintf(stdout, "Using IPv6 proxy at %s\n", | fprintf(stdout, "Using IPv6 proxy at %s\n", | ||||
service.ToStringIPPort().c_str()); | service.ToStringIPPort().c_str()); | ||||
SetProxy(NET_IPV6, proxyType(service)); | SetProxy(NET_IPV6, proxyType(service)); | ||||
} | } | ||||
} | } | ||||
// Get -testnet option | // Get -testnet option | ||||
bool fDNS = true; | bool fDNS = true; | ||||
if (gArgs.GetBoolArg("-testnet", false)) { | if (gArgs.GetBoolArg("-testnet", false)) { | ||||
fprintf(stdout, "Using testnet.\n"); | fprintf(stdout, "Using testnet.\n"); | ||||
netMagic[0] = 0xf4; | netMagic[0] = 0xf4; | ||||
netMagic[1] = 0xe5; | netMagic[1] = 0xe5; | ||||
netMagic[2] = 0xf3; | netMagic[2] = 0xf3; | ||||
netMagic[3] = 0xf4; | netMagic[3] = 0xf4; | ||||
seeds = testnet_seeds; | seeds = testnet_seeds; | ||||
fTestNet = true; | fTestNet = true; | ||||
} | } | ||||
// Get hostname of nameserver | // Get hostname of nameserver | ||||
if (gArgs.IsArgSet("-ns")) { | if (gArgs.IsArgSet("-nameserver")) { | ||||
opts.ns = gArgs.GetArg("-ns", "").c_str(); | opts.ns = gArgs.GetArg("-nameserver", "").c_str(); | ||||
} else { | } else { | ||||
// No hostname set | // No hostname set | ||||
fprintf(stdout, "No nameserver set. Not starting DNS server.\n"); | fprintf(stdout, "No nameserver set. Not starting DNS server.\n"); | ||||
fDNS = false; | fDNS = false; | ||||
} | } | ||||
// Get hostname of DNS seed | // Get hostname of DNS seed | ||||
if (gArgs.IsArgSet("-host")) { | if (gArgs.IsArgSet("-host")) { | ||||
opts.host = gArgs.GetArg("-host", "").c_str(); | opts.host = gArgs.GetArg("-host", "").c_str(); | ||||
} | } | ||||
if (fDNS && !opts.host) { | if (fDNS && !opts.host) { | ||||
fprintf(stderr, "No hostname set. Please use -host.\n"); | fprintf(stderr, "No hostname set. Please use -host.\n"); | ||||
return false; | return false; | ||||
} | } | ||||
// Get email | // Get email | ||||
if (gArgs.IsArgSet("-mbox")) { | if (gArgs.IsArgSet("-email")) { | ||||
opts.mbox = gArgs.GetArg("-mbox", "").c_str(); | opts.mbox = gArgs.GetArg("-email", "").c_str(); | ||||
} | } | ||||
if (fDNS && !opts.mbox) { | if (fDNS && !opts.mbox) { | ||||
fprintf(stderr, "No e-mail address set. Please use -mbox.\n"); | fprintf(stderr, "No e-mail address set. Please use -email.\n"); | ||||
return false; | return false; | ||||
} | } | ||||
FILE *f = fsbridge::fopen("dnsseed.dat", "r"); | FILE *f = fsbridge::fopen("dnsseed.dat", "r"); | ||||
if (f) { | if (f) { | ||||
fprintf(stdout, "Loading dnsseed.dat..."); | fprintf(stdout, "Loading dnsseed.dat..."); | ||||
CAutoFile cf(f, SER_DISK, CLIENT_VERSION); | CAutoFile cf(f, SER_DISK, CLIENT_VERSION); | ||||
cf >> db; | cf >> db; | ||||
// Check for -wipeban and the -wipeignore | // Check for -wipeban and the -wipeignore | ||||
▲ Show 20 Lines • Show All 65 Lines • Show Last 20 Lines |