Changeset View
Changeset View
Standalone View
Standalone View
src/seeder/main.cpp
// Copyright (c) 2017-2020 The Bitcoin developers | // Copyright (c) 2017-2020 The Bitcoin developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#include <chainparams.h> | #include <chainparams.h> | ||||
#include <clientversion.h> | #include <clientversion.h> | ||||
#include <dnsseeds.h> | |||||
#include <fs.h> | #include <fs.h> | ||||
#include <logging.h> | #include <logging.h> | ||||
#include <protocol.h> | #include <protocol.h> | ||||
#include <seeder/bitcoin.h> | #include <seeder/bitcoin.h> | ||||
#include <seeder/db.h> | #include <seeder/db.h> | ||||
#include <seeder/dns.h> | #include <seeder/dns.h> | ||||
#include <streams.h> | #include <streams.h> | ||||
#include <util/strencodings.h> | #include <util/strencodings.h> | ||||
▲ Show 20 Lines • Show All 126 Lines • ▼ Show 20 Lines | void SetupSeederArgs(ArgsManager &argsman) { | ||||
ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); | ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); | ||||
argsman.AddArg("-dnsthreads=<threads>", | argsman.AddArg("-dnsthreads=<threads>", | ||||
"Number of DNS server threads (default 4)", | "Number of DNS server threads (default 4)", | ||||
ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); | ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); | ||||
argsman.AddArg("-port=<port>", "UDP port to listen on (default 53)", | argsman.AddArg("-port=<port>", "UDP port to listen on (default 53)", | ||||
ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION); | ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION); | ||||
argsman.AddArg("-onion=<ip:port>", "Tor proxy IP/Port", | argsman.AddArg("-onion=<ip:port>", "Tor proxy IP/Port", | ||||
ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION); | ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION); | ||||
argsman.AddArg("-overridednsseed", | |||||
"If set, only use the specified DNS seed when " | |||||
"querying for peer addresses via DNS lookup.", | |||||
ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION); | |||||
argsman.AddArg("-proxyipv4=<ip:port>", "IPV4 SOCKS5 proxy IP/Port", | argsman.AddArg("-proxyipv4=<ip:port>", "IPV4 SOCKS5 proxy IP/Port", | ||||
ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION); | ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION); | ||||
argsman.AddArg("-proxyipv6=<ip:port>", "IPV6 SOCKS5 proxy IP/Port", | argsman.AddArg("-proxyipv6=<ip:port>", "IPV6 SOCKS5 proxy IP/Port", | ||||
ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION); | ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION); | ||||
argsman.AddArg("-filter=<f1,f2,...>", | argsman.AddArg("-filter=<f1,f2,...>", | ||||
"Allow these flag combinations as filters", | "Allow these flag combinations as filters", | ||||
ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); | ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); | ||||
argsman.AddArg("-wipeban", "Wipe list of banned nodes", | argsman.AddArg("-wipeban", "Wipe list of banned nodes", | ||||
▲ Show 20 Lines • Show All 296 Lines • ▼ Show 20 Lines | extern "C" void *ThreadStats(void *) { | ||||
} while (1); | } while (1); | ||||
return nullptr; | return nullptr; | ||||
} | } | ||||
const static unsigned int MAX_HOSTS_PER_SEED = 128; | const static unsigned int MAX_HOSTS_PER_SEED = 128; | ||||
extern "C" void *ThreadSeeder(void *) { | extern "C" void *ThreadSeeder(void *) { | ||||
do { | do { | ||||
for (const std::string &seed : Params().DNSSeeds()) { | for (const std::string &seed : GetRandomizedDNSSeeds(Params())) { | ||||
std::vector<CNetAddr> ips; | std::vector<CNetAddr> ips; | ||||
LookupHost(seed.c_str(), ips, MAX_HOSTS_PER_SEED, true); | LookupHost(seed.c_str(), ips, MAX_HOSTS_PER_SEED, true); | ||||
for (auto &ip : ips) { | for (auto &ip : ips) { | ||||
db.Add(CAddress(CService(ip, GetDefaultPort()), ServiceFlags()), | db.Add(CAddress(CService(ip, GetDefaultPort()), ServiceFlags()), | ||||
true); | true); | ||||
} | } | ||||
} | } | ||||
Sleep(1800000); | Sleep(1800000); | ||||
▲ Show 20 Lines • Show All 111 Lines • Show Last 20 Lines |