diff --git a/src/seeder/address.h b/src/seeder/address.h --- a/src/seeder/address.h +++ b/src/seeder/address.h @@ -8,10 +8,10 @@ #include "netbase.h" #include "protocol.h" -class CSeederAddress : public CSeederService { +class CSeederAddress : public CService { public: CSeederAddress(); - CSeederAddress(CSeederService ipIn, + CSeederAddress(CService ipIn, uint64_t nServicesIn = NODE_NETWORK | NODE_BITCOIN_CASH); void Init(); @@ -22,7 +22,7 @@ inline void SerializationOp(Stream &s, Operation ser_action) { int nVersion = s.GetVersion(); CSeederAddress *pthis = const_cast(this); - CSeederService *pip = (CSeederService *)pthis; + CService *pip = (CService *)pthis; if (ser_action.ForRead()) { pthis->Init(); } diff --git a/src/seeder/address.cpp b/src/seeder/address.cpp --- a/src/seeder/address.cpp +++ b/src/seeder/address.cpp @@ -4,12 +4,12 @@ #include "address.h" -CSeederAddress::CSeederAddress() : CSeederService() { +CSeederAddress::CSeederAddress() : CService() { Init(); } -CSeederAddress::CSeederAddress(CSeederService ipIn, uint64_t nServicesIn) - : CSeederService(ipIn) { +CSeederAddress::CSeederAddress(CService ipIn, uint64_t nServicesIn) + : CService(ipIn) { Init(); nServices = nServicesIn; } diff --git a/src/seeder/bitcoin.h b/src/seeder/bitcoin.h --- a/src/seeder/bitcoin.h +++ b/src/seeder/bitcoin.h @@ -20,8 +20,7 @@ // The network magic to use. extern CMessageHeader::MessageMagic netMagic; -bool TestNode(const CSeederService &cip, int &ban, int &client, - std::string &clientSV, int &blocks, - std::vector *vAddr); +bool TestNode(const CService &cip, int &ban, int &client, std::string &clientSV, + int &blocks, std::vector *vAddr); #endif diff --git a/src/seeder/bitcoin.cpp b/src/seeder/bitcoin.cpp --- a/src/seeder/bitcoin.cpp +++ b/src/seeder/bitcoin.cpp @@ -95,7 +95,8 @@ int64_t nTime = time(nullptr); uint64_t nLocalNonce = BITCOIN_SEED_NONCE; int64_t nLocalServices = 0; - CSeederAddress me(CSeederService("0.0.0.0")); + CService myService; + CSeederAddress me(myService); BeginMessage("version"); int nBestHeight = GetRequireHeight(); std::string ver = "/bitcoin-cash-seeder:0.15/"; @@ -236,7 +237,7 @@ } public: - CNode(const CSeederService &ip, std::vector *vAddrIn) + CNode(const CService &ip, std::vector *vAddrIn) : vSend(SER_NETWORK, 0), vRecv(SER_NETWORK, 0), nHeaderStart(-1), nMessageStart(-1), nVersion(0), vAddr(vAddrIn), ban(0), doneAfter(0), you(ip) { @@ -306,7 +307,7 @@ int GetStartingHeight() { return nStartingHeight; } }; -bool TestNode(const CSeederService &cip, int &ban, int &clientV, +bool TestNode(const CService &cip, int &ban, int &clientV, std::string &clientSV, int &blocks, std::vector *vAddr) { try { @@ -330,7 +331,7 @@ /* int main(void) { - CSeederService ip("bitcoin.sipa.be", 8333, true); + CService ip("bitcoin.sipa.be", 8333, true); std::vector vAddr; vAddr.clear(); int ban = 0; diff --git a/src/seeder/db.h b/src/seeder/db.h --- a/src/seeder/db.h +++ b/src/seeder/db.h @@ -24,7 +24,7 @@ return testnet ? 500000 : 350000; } -static inline std::string ToString(const CSeederService &ip) { +static inline std::string ToString(const CService &ip) { std::string str = ip.ToString(); while (str.size() < 22) { str += ' '; @@ -62,7 +62,7 @@ class CAddrReport { public: - CSeederService ip; + CService ip; int clientVersion; int blocks; double uptime[5]; @@ -74,7 +74,7 @@ class CAddrInfo { private: - CSeederService ip; + CService ip; uint64_t services; int64_t lastTry; int64_t ourLastTry; @@ -225,8 +225,8 @@ int nAge; }; -struct CSeederServiceResult { - CSeederService service; +struct CServiceResult { + CService service; bool fGood; int nBanTime; int nHeight; @@ -252,7 +252,7 @@ // map address id to address info (b,c,d,e) std::map idToInfo; // map ip to id (b,c,d,e) - std::map ipToId; + std::map ipToId; // sequence of tried nodes, in order we have tried connecting to them (c,d) std::deque ourId; // set of nodes not yet tried (b) @@ -267,25 +267,25 @@ void Add_(const CSeederAddress &addr, bool force); // get an IP to test (must call Good_, Bad_, or Skipped_ on result // afterwards) - bool Get_(CSeederServiceResult &ip, int &wait); - bool GetMany_(std::vector &ips, int max, int &wait); + bool Get_(CServiceResult &ip, int &wait); + bool GetMany_(std::vector &ips, int max, int &wait); // mark an IP as good (must have been returned by Get_) - void Good_(const CSeederService &ip, int clientV, std::string clientSV, + void Good_(const CService &ip, int clientV, std::string clientSV, int blocks); // mark an IP as bad (and optionally ban it) (must have been returned by // Get_) - void Bad_(const CSeederService &ip, int ban); + void Bad_(const CService &ip, int ban); // mark an IP as skipped (must have been returned by Get_) - void Skipped_(const CSeederService &ip); + void Skipped_(const CService &ip); // look up id of an IP - int Lookup_(const CSeederService &ip); + int Lookup_(const CService &ip); // get a random set of IPs (shared lock only) void GetIPs_(std::set &ips, uint64_t requestedFlags, uint32_t max, const bool *nets); public: // nodes that are banned, with their unban time (a) - std::map banned; + std::map banned; void GetStats(CAddrDbStats &stats) { LOCK(cs); @@ -390,31 +390,31 @@ } } - void Good(const CSeederService &addr, int clientVersion, + void Good(const CService &addr, int clientVersion, std::string clientSubVersion, int blocks) { LOCK(cs); Good_(addr, clientVersion, clientSubVersion, blocks); } - void Skipped(const CSeederService &addr) { + void Skipped(const CService &addr) { LOCK(cs); Skipped_(addr); } - void Bad(const CSeederService &addr, int ban = 0) { + void Bad(const CService &addr, int ban = 0) { LOCK(cs); Bad_(addr, ban); } - bool Get(CSeederServiceResult &ip, int &wait) { + bool Get(CServiceResult &ip, int &wait) { LOCK(cs); return Get_(ip, wait); } - void GetMany(std::vector &ips, int max, int &wait) { + void GetMany(std::vector &ips, int max, int &wait) { LOCK(cs); while (max > 0) { - CSeederServiceResult ip = {}; + CServiceResult ip = {}; if (!Get_(ip, wait)) { return; } @@ -423,7 +423,7 @@ } } - void ResultMany(const std::vector &ips) { + void ResultMany(const std::vector &ips) { LOCK(cs); for (size_t i = 0; i < ips.size(); i++) { if (ips[i].fGood) { diff --git a/src/seeder/db.cpp b/src/seeder/db.cpp --- a/src/seeder/db.cpp +++ b/src/seeder/db.cpp @@ -34,7 +34,7 @@ // stat1W.weight), stat1W.count); } -bool CAddrDb::Get_(CSeederServiceResult &ip, int &wait) { +bool CAddrDb::Get_(CServiceResult &ip, int &wait) { int64_t now = time(nullptr); size_t tot = unkId.size() + ourId.size(); if (tot == 0) { @@ -72,13 +72,13 @@ return true; } -int CAddrDb::Lookup_(const CSeederService &ip) { +int CAddrDb::Lookup_(const CService &ip) { if (ipToId.count(ip)) return ipToId[ip]; return -1; } -void CAddrDb::Good_(const CSeederService &addr, int clientV, - std::string clientSV, int blocks) { +void CAddrDb::Good_(const CService &addr, int clientV, std::string clientSV, + int blocks) { int id = Lookup_(addr); if (id == -1) return; unkId.erase(id); @@ -97,7 +97,7 @@ ourId.push_back(id); } -void CAddrDb::Bad_(const CSeederService &addr, int ban) { +void CAddrDb::Bad_(const CService &addr, int ban) { int id = Lookup_(addr); if (id == -1) return; unkId.erase(id); @@ -126,7 +126,7 @@ nDirty++; } -void CAddrDb::Skipped_(const CSeederService &addr) { +void CAddrDb::Skipped_(const CService &addr) { int id = Lookup_(addr); if (id == -1) return; unkId.erase(id); @@ -139,7 +139,7 @@ if (!force && !addr.IsRoutable()) { return; } - CSeederService ipp(addr); + CService ipp(addr); if (banned.count(ipp)) { time_t bantime = banned[ipp]; if (force || (bantime < time(nullptr) && addr.nTime > bantime)) { @@ -221,7 +221,7 @@ } for (auto &id : ids) { - CSeederService &ip = idToInfo[id].ip; + CService &ip = idToInfo[id].ip; if (nets[ip.GetNetwork()]) { ips.insert(ip); } diff --git a/src/seeder/main.cpp b/src/seeder/main.cpp --- a/src/seeder/main.cpp +++ b/src/seeder/main.cpp @@ -171,7 +171,7 @@ extern "C" void *ThreadCrawler(void *data) { int *nThreads = (int *)data; do { - std::vector ips; + std::vector ips; int wait = 5; db.GetMany(ips, 16, wait); int64_t now = time(nullptr); @@ -184,7 +184,7 @@ std::vector addr; for (size_t i = 0; i < ips.size(); i++) { - CSeederServiceResult &res = ips[i]; + CServiceResult &res = ips[i]; res.nBanTime = 0; res.nClientV = 0; res.nHeight = 0; @@ -449,16 +449,15 @@ "testnet-seeder.criptolayer.net", ""}; static const std::string *seeds = mainnet_seeds; +const static unsigned int MAX_HOSTS_PER_SEED = 128; + extern "C" void *ThreadSeeder(void *) { - if (!fTestNet) { - db.Add(CSeederService("kjy2eqzk4zwi5zd3.onion", 8333), true); - } do { for (int i = 0; seeds[i] != ""; i++) { std::vector ips; - LookupHost(seeds[i].c_str(), ips); + LookupHost(seeds[i].c_str(), ips, MAX_HOSTS_PER_SEED, true); for (auto &ip : ips) { - db.Add(CSeederService(ip, GetDefaultPort()), true); + db.Add(CSeederAddress(CService(ip, GetDefaultPort())), true); } } Sleep(1800000); @@ -481,14 +480,14 @@ } printf("\n"); if (opts.tor) { - CSeederService service(opts.tor, 9050); + CService service(LookupNumeric(opts.tor, 9050)); if (service.IsValid()) { printf("Using Tor proxy at %s\n", service.ToStringIPPort().c_str()); SetProxy(NET_TOR, service); } } if (opts.ipv4_proxy) { - CSeederService service(opts.ipv4_proxy, 9050); + CService service(LookupNumeric(opts.ipv4_proxy, 9050)); if (service.IsValid()) { printf("Using IPv4 proxy at %s\n", service.ToStringIPPort().c_str()); @@ -496,7 +495,7 @@ } } if (opts.ipv6_proxy) { - CSeederService service(opts.ipv6_proxy, 9050); + CService service(LookupNumeric(opts.ipv6_proxy, 9050)); if (service.IsValid()) { printf("Using IPv6 proxy at %s\n", service.ToStringIPPort().c_str()); diff --git a/src/seeder/netbase.h b/src/seeder/netbase.h --- a/src/seeder/netbase.h +++ b/src/seeder/netbase.h @@ -19,62 +19,11 @@ #undef SetPort #endif -extern int nConnectTimeout; -extern bool fNameLookup; - -/** A combination of a network address (CNetAddr) and a (TCP) port */ -class CSeederService : public CNetAddr { -protected: - unsigned short port; // host order - -public: - CSeederService(); - CSeederService(const CNetAddr &ip, unsigned short port); - CSeederService(const struct in_addr &ipv4Addr, unsigned short port); - CSeederService(const struct sockaddr_in &addr); - explicit CSeederService(const char *pszIpPort, int portDefault, - bool fAllowLookup = false); - explicit CSeederService(const char *pszIpPort, bool fAllowLookup = false); - explicit CSeederService(const std::string &strIpPort, int portDefault, - bool fAllowLookup = false); - explicit CSeederService(const std::string &strIpPort, - bool fAllowLookup = false); - void Init(); - void SetPort(unsigned short portIn); - unsigned short GetPort() const; - bool GetSockAddr(struct sockaddr *paddr, socklen_t *addrlen) const; - bool SetSockAddr(const struct sockaddr *paddr); - friend bool operator==(const CSeederService &a, const CSeederService &b); - friend bool operator!=(const CSeederService &a, const CSeederService &b); - friend bool operator<(const CSeederService &a, const CSeederService &b); - std::vector GetKey() const; - std::string ToString() const; - std::string ToStringPort() const; - std::string ToStringIPPort() const; - void print() const; - - CSeederService(const struct in6_addr &ipv6Addr, unsigned short port); - CSeederService(const struct sockaddr_in6 &addr); - - ADD_SERIALIZE_METHODS; - - template - inline void SerializationOp(Stream &s, Operation ser_action) { - CSeederService *pthis = const_cast(this); - READWRITE(FLATDATA(ip)); - unsigned short portN = htons(port); - READWRITE(portN); - if (ser_action.ForRead()) { - pthis->port = ntohs(portN); - } - } -}; - -bool SetProxy(enum Network net, CSeederService addrProxy, - int nSocksVersion = 5); +bool SetProxy(enum Network net, CService addrProxy, int nSocksVersion = 5); bool LookupHost(const char *pszName, std::vector &vIP, unsigned int nMaxSolutions = 0, bool fAllowLookup = true); -bool ConnectSocket(const CSeederService &addr, SOCKET &hSocketRet, +CService LookupNumeric(const char *pszName, int portDefault = 0); +bool ConnectSocket(const CService &addr, SOCKET &hSocketRet, int nTimeout = nConnectTimeout); #endif diff --git a/src/seeder/netbase.cpp b/src/seeder/netbase.cpp --- a/src/seeder/netbase.cpp +++ b/src/seeder/netbase.cpp @@ -16,131 +16,13 @@ #define printf my_printf // Settings -typedef std::pair proxyType; +typedef std::pair proxyType; static proxyType proxyInfo[NET_MAX]; static proxyType nameproxyInfo; -int nConnectTimeout = 5000; -bool fNameLookup = false; static const uint8_t pchIPv4[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff}; -static void SplitHostPort(std::string in, int &portOut, std::string &hostOut) { - size_t colon = in.find_last_of(':'); - // if a : is found, and it either follows a [...], or no other : is in the - // string, treat it as port separator - bool fHaveColon = colon != in.npos; - // if there is a colon, and in[0]=='[', colon is not 0, so in[colon-1] is - // safe - bool fBracketed = fHaveColon && (in[0] == '[' && in[colon - 1] == ']'); - bool fMultiColon = - fHaveColon && (in.find_last_of(':', colon - 1) != in.npos); - if (fHaveColon && (colon == 0 || fBracketed || !fMultiColon)) { - char *endp = nullptr; - int n = strtol(in.c_str() + colon + 1, &endp, 10); - if (endp && *endp == 0 && n >= 0) { - in = in.substr(0, colon); - if (n > 0 && n < 0x10000) portOut = n; - } - } - if (in.size() > 0 && in[0] == '[' && in[in.size() - 1] == ']') - hostOut = in.substr(1, in.size() - 2); - else - hostOut = in; -} - -static bool LookupIntern(const char *pszName, std::vector &vIP, - unsigned int nMaxSolutions, bool fAllowLookup) { - vIP.clear(); - - { - CNetAddr addr; - if (addr.SetSpecial(std::string(pszName))) { - vIP.push_back(addr); - return true; - } - } - - struct addrinfo aiHint; - memset(&aiHint, 0, sizeof(struct addrinfo)); - - aiHint.ai_socktype = SOCK_STREAM; - aiHint.ai_protocol = IPPROTO_TCP; -#ifdef WIN32 - aiHint.ai_family = AF_UNSPEC; - aiHint.ai_flags = fAllowLookup ? 0 : AI_NUMERICHOST; -#else - aiHint.ai_family = AF_UNSPEC; - aiHint.ai_flags = fAllowLookup ? AI_ADDRCONFIG : AI_NUMERICHOST; -#endif - struct addrinfo *aiRes = nullptr; - int nErr = getaddrinfo(pszName, nullptr, &aiHint, &aiRes); - if (nErr) return false; - - struct addrinfo *aiTrav = aiRes; - while (aiTrav != nullptr && - (nMaxSolutions == 0 || vIP.size() < nMaxSolutions)) { - if (aiTrav->ai_family == AF_INET) { - assert(aiTrav->ai_addrlen >= sizeof(sockaddr_in)); - vIP.push_back( - CNetAddr(((struct sockaddr_in *)(aiTrav->ai_addr))->sin_addr)); - } - - if (aiTrav->ai_family == AF_INET6) { - assert(aiTrav->ai_addrlen >= sizeof(sockaddr_in6)); - vIP.push_back(CNetAddr( - ((struct sockaddr_in6 *)(aiTrav->ai_addr))->sin6_addr)); - } - - aiTrav = aiTrav->ai_next; - } - - freeaddrinfo(aiRes); - - return (vIP.size() > 0); -} - -bool LookupHost(const char *pszName, std::vector &vIP, - unsigned int nMaxSolutions, bool fAllowLookup) { - if (pszName[0] == 0) return false; - char psz[256]; - char *pszHost = psz; - strlcpy(psz, pszName, sizeof(psz)); - if (psz[0] == '[' && psz[strlen(psz) - 1] == ']') { - pszHost = psz + 1; - psz[strlen(psz) - 1] = 0; - } - - return LookupIntern(pszHost, vIP, nMaxSolutions, fAllowLookup); -} - -static bool Lookup(const char *pszName, std::vector &vAddr, - int portDefault, bool fAllowLookup, - unsigned int nMaxSolutions) { - if (pszName[0] == 0) return false; - int port = portDefault; - std::string hostname = ""; - SplitHostPort(std::string(pszName), port, hostname); - - std::vector vIP; - bool fRet = - LookupIntern(hostname.c_str(), vIP, nMaxSolutions, fAllowLookup); - if (!fRet) return false; - vAddr.resize(vIP.size()); - for (unsigned int i = 0; i < vIP.size(); i++) - vAddr[i] = CSeederService(vIP[i], port); - return true; -} - -static bool Lookup(const char *pszName, CSeederService &addr, int portDefault, - bool fAllowLookup) { - std::vector vService; - bool fRet = Lookup(pszName, vService, portDefault, fAllowLookup, 1); - if (!fRet) return false; - addr = vService[0]; - return true; -} - -static bool Socks4(const CSeederService &addrDest, SOCKET &hSocket) { +static bool Socks4(const CService &addrDest, SOCKET &hSocket) { printf("SOCKS4 connecting %s\n", addrDest.ToString().c_str()); if (!addrDest.IsIPv4()) { closesocket(hSocket); @@ -282,7 +164,7 @@ return true; } -static bool ConnectSocketDirectly(const CSeederService &addrConnect, +static bool ConnectSocketDirectly(const CService &addrConnect, SOCKET &hSocketRet, int nTimeout) { hSocketRet = INVALID_SOCKET; @@ -389,7 +271,7 @@ return true; } -bool SetProxy(enum Network net, CSeederService addrProxy, int nSocksVersion) { +bool SetProxy(enum Network net, CService addrProxy, int nSocksVersion) { assert(net >= 0 && net < NET_MAX); if (nSocksVersion != 0 && nSocksVersion != 4 && nSocksVersion != 5) return false; @@ -398,8 +280,7 @@ return true; } -bool ConnectSocket(const CSeederService &addrDest, SOCKET &hSocketRet, - int nTimeout) { +bool ConnectSocket(const CService &addrDest, SOCKET &hSocketRet, int nTimeout) { const proxyType &proxy = proxyInfo[addrDest.GetNetwork()]; // no proxy needed @@ -427,147 +308,3 @@ hSocketRet = hSocket; return true; } - -void CSeederService::Init() { - port = 0; -} - -CSeederService::CSeederService() { - Init(); -} - -CSeederService::CSeederService(const CNetAddr &cip, unsigned short portIn) - : CNetAddr(cip), port(portIn) {} - -CSeederService::CSeederService(const struct in_addr &ipv4Addr, - unsigned short portIn) - : CNetAddr(ipv4Addr), port(portIn) {} - -CSeederService::CSeederService(const struct in6_addr &ipv6Addr, - unsigned short portIn) - : CNetAddr(ipv6Addr), port(portIn) {} - -CSeederService::CSeederService(const struct sockaddr_in &addr) - : CNetAddr(addr.sin_addr), port(ntohs(addr.sin_port)) { - assert(addr.sin_family == AF_INET); -} - -CSeederService::CSeederService(const struct sockaddr_in6 &addr) - : CNetAddr(addr.sin6_addr), port(ntohs(addr.sin6_port)) { - assert(addr.sin6_family == AF_INET6); -} - -bool CSeederService::SetSockAddr(const struct sockaddr *paddr) { - switch (paddr->sa_family) { - case AF_INET: - *this = CSeederService(*(const struct sockaddr_in *)paddr); - return true; - case AF_INET6: - *this = CSeederService(*(const struct sockaddr_in6 *)paddr); - return true; - default: - return false; - } -} - -CSeederService::CSeederService(const char *pszIpPort, bool fAllowLookup) { - Init(); - CSeederService ip; - if (Lookup(pszIpPort, ip, 0, fAllowLookup)) *this = ip; -} - -CSeederService::CSeederService(const char *pszIpPort, int portDefault, - bool fAllowLookup) { - Init(); - CSeederService ip; - if (Lookup(pszIpPort, ip, portDefault, fAllowLookup)) *this = ip; -} - -CSeederService::CSeederService(const std::string &strIpPort, - bool fAllowLookup) { - Init(); - CSeederService ip; - if (Lookup(strIpPort.c_str(), ip, 0, fAllowLookup)) *this = ip; -} - -CSeederService::CSeederService(const std::string &strIpPort, int portDefault, - bool fAllowLookup) { - Init(); - CSeederService ip; - if (Lookup(strIpPort.c_str(), ip, portDefault, fAllowLookup)) *this = ip; -} - -unsigned short CSeederService::GetPort() const { - return port; -} - -bool operator==(const CSeederService &a, const CSeederService &b) { - return (CNetAddr)a == (CNetAddr)b && a.port == b.port; -} - -bool operator!=(const CSeederService &a, const CSeederService &b) { - return (CNetAddr)a != (CNetAddr)b || a.port != b.port; -} - -bool operator<(const CSeederService &a, const CSeederService &b) { - return (CNetAddr)a < (CNetAddr)b || - ((CNetAddr)a == (CNetAddr)b && a.port < b.port); -} - -bool CSeederService::GetSockAddr(struct sockaddr *paddr, - socklen_t *addrlen) const { - if (IsIPv4()) { - if (*addrlen < (socklen_t)sizeof(struct sockaddr_in)) return false; - *addrlen = sizeof(struct sockaddr_in); - struct sockaddr_in *paddrin = (struct sockaddr_in *)paddr; - memset(paddrin, 0, *addrlen); - if (!GetInAddr(&paddrin->sin_addr)) return false; - paddrin->sin_family = AF_INET; - paddrin->sin_port = htons(port); - return true; - } - if (IsIPv6()) { - if (*addrlen < (socklen_t)sizeof(struct sockaddr_in6)) return false; - *addrlen = sizeof(struct sockaddr_in6); - struct sockaddr_in6 *paddrin6 = (struct sockaddr_in6 *)paddr; - memset(paddrin6, 0, *addrlen); - if (!GetIn6Addr(&paddrin6->sin6_addr)) return false; - paddrin6->sin6_family = AF_INET6; - paddrin6->sin6_port = htons(port); - return true; - } - return false; -} - -std::vector CSeederService::GetKey() const { - std::vector vKey; - vKey.resize(18); - memcpy(&vKey[0], ip, 16); - vKey[16] = port / 0x100; - vKey[17] = port & 0x0FF; - return vKey; -} - -std::string CSeederService::ToStringPort() const { - return strprintf("%u", port); -} - -std::string CSeederService::ToStringIPPort() const { - if (IsIPv4() || IsTor()) { - return ToStringIP() + ":" + ToStringPort(); - } else { - return "[" + ToStringIP() + "]:" + ToStringPort(); - } -} - -std::string CSeederService::ToString() const { - return ToStringIPPort(); -} - -void CSeederService::print() const { - printf("CSeederService(%s)\n", ToString().c_str()); -} - -void CSeederService::SetPort(unsigned short portIn) { - port = portIn; -}