typedef SSIZE_T ssize_t;
#endif
-#include <boost/algorithm/string/case_conv.hpp> // for to_lower()
-
using namespace std;
// Settings
static const unsigned char pchIPv4[12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff };
enum Network ParseNetwork(std::string net) {
- boost::to_lower(net);
+ transform(net.begin(), net.end(), net.begin(), ::tolower);
if (net == "ipv4") return NET_IPV4;
if (net == "ipv6") return NET_IPV6;
if (net == "tor" || net == "onion") return NET_TOR;
return (vIP.size() > 0);
}
-bool LookupHost(const string strName, std::vector<CNetAddr>& vIP, unsigned int nMaxSolutions, bool fAllowLookup)
+bool LookupHost(const string& strName, std::vector<CNetAddr>& vIP, unsigned int nMaxSolutions, bool fAllowLookup)
{
std::string strHost(strName);
if (strHost.empty())
return false;
- if ((strHost.compare(0,1, "[") == 0) && (strHost.compare(strHost.length()-1,1, "]") == 0))
+ if ((strHost.front() == '[') && (strHost.back() == ']'))
{
strHost = strHost.substr(1, strHost.size() - 2);
}
std::string strHost(pszName);
if (strHost.empty())
return false;
- if ((strHost.compare(0,1, "[") == 0) && (strHost.compare(strHost.length()-1,1, "]") == 0))
+ if ((strHost.front() == '[') && (strHost.back() == ']'))
{
strHost = strHost.substr(1, strHost.size() - 2);
}
*this = ip;
}
-unsigned short CService::GetPort() const
+uint16_t CService::GetPort() const
{
return port;
}
return ToStringIPPort();
}
-void CService::SetPort(unsigned short portIn)
+void CService::SetupPort(uint16_t portIn)
{
port = portIn;
}