diff --git a/src/netbase.h b/src/netbase.h --- a/src/netbase.h +++ b/src/netbase.h @@ -28,7 +28,8 @@ class proxyType { public: proxyType() : randomize_credentials(false) {} - proxyType(const CService &_proxy, bool _randomize_credentials = false) + explicit proxyType(const CService &_proxy, + bool _randomize_credentials = false) : proxy(_proxy), randomize_credentials(_randomize_credentials) {} bool IsValid() const { return proxy.IsValid(); } diff --git a/src/netbase.cpp b/src/netbase.cpp --- a/src/netbase.cpp +++ b/src/netbase.cpp @@ -3,10 +3,6 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#ifdef HAVE_CONFIG_H -#include "config/bitcoin-config.h" -#endif - #include "netbase.h" #include "hash.h" @@ -23,7 +19,6 @@ #endif #include // for to_lower() -#include // for startswith() and endswith() #if !defined(MSG_NOSIGNAL) #define MSG_NOSIGNAL 0 @@ -122,9 +117,10 @@ bool LookupHost(const char *pszName, std::vector &vIP, unsigned int nMaxSolutions, bool fAllowLookup) { std::string strHost(pszName); - if (strHost.empty()) return false; - if (boost::algorithm::starts_with(strHost, "[") && - boost::algorithm::ends_with(strHost, "]")) { + if (strHost.empty()) { + return false; + } + if (strHost.front() == '[' && strHost.back() == ']') { strHost = strHost.substr(1, strHost.size() - 2); } @@ -289,8 +285,8 @@ std::string password; }; -/** Convert SOCKS5 reply to a an error message */ -std::string Socks5ErrorString(uint8_t err) { +/** Convert SOCKS5 reply to an error message */ +static std::string Socks5ErrorString(uint8_t err) { switch (err) { case SOCKS5Reply::GENFAILURE: return "general failure"; @@ -603,7 +599,9 @@ bool IsProxy(const CNetAddr &addr) { LOCK(cs_proxyInfos); for (int i = 0; i < NET_MAX; i++) { - if (addr == (CNetAddr)proxyInfo[i].proxy) return true; + if (addr == static_cast(proxyInfo[i].proxy)) { + return true; + } } return false; } diff --git a/src/seeder/main.cpp b/src/seeder/main.cpp --- a/src/seeder/main.cpp +++ b/src/seeder/main.cpp @@ -485,7 +485,7 @@ CService service(LookupNumeric(opts.tor, 9050)); if (service.IsValid()) { printf("Using Tor proxy at %s\n", service.ToStringIPPort().c_str()); - SetProxy(NET_TOR, service); + SetProxy(NET_TOR, proxyType(service)); } } if (opts.ipv4_proxy) { @@ -493,7 +493,7 @@ if (service.IsValid()) { printf("Using IPv4 proxy at %s\n", service.ToStringIPPort().c_str()); - SetProxy(NET_IPV4, service); + SetProxy(NET_IPV4, proxyType(service)); } } if (opts.ipv6_proxy) { @@ -501,7 +501,7 @@ if (service.IsValid()) { printf("Using IPv6 proxy at %s\n", service.ToStringIPPort().c_str()); - SetProxy(NET_IPV6, service); + SetProxy(NET_IPV6, proxyType(service)); } } bool fDNS = true;