typedef SSIZE_T ssize_t;
#endif
-#include <boost/algorithm/string/case_conv.hpp> // for to_lower()
-#include <boost/algorithm/string/predicate.hpp> // for startswith() and endswith()
using namespace std;
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;
std::string strHost(pszName);
if (strHost.empty())
return false;
- if (boost::algorithm::starts_with(strHost, "[") && boost::algorithm::ends_with(strHost, "]"))
+ if ((strHost.compare(0,1, "[") == 0) && (strHost.compare(strHost.length()-1,1, "]") == 0))
{
strHost = strHost.substr(1, strHost.size() - 2);
}
return LookupIntern(strHost.c_str(), vIP, nMaxSolutions, fAllowLookup);
}
-bool LookupHostNumeric(const char *pszName, std::vector<CNetAddr>& vIP, unsigned int nMaxSolutions)
-{
- return LookupHost(pszName, vIP, nMaxSolutions, false);
-}
-
bool Lookup(const char *pszName, std::vector<CService>& vAddr, uint16_t portDefault, bool fAllowLookup, unsigned int nMaxSolutions)
{
if (pszName[0] == 0)
CloseSocket(hSocket);
return error("Hostname too long");
}
- char pszSocks5Init[] = "\5\1\0";
- ssize_t nSize = sizeof(pszSocks5Init) - 1;
-
- ssize_t ret = send(hSocket, pszSocks5Init, nSize, MSG_NOSIGNAL);
- if (ret != nSize)
+ const char pszSocks5Init[] = "\5\1\0";
+ ssize_t ret = send(hSocket, pszSocks5Init, 3, MSG_NOSIGNAL);
+ if (ret != 3)
{
CloseSocket(hSocket);
return error("Error sending to proxy");
return nRet;
}
-void CNetAddr::print() const
-{
- printf("CNetAddr(%s)\n", ToString().c_str());
-}
-
// private extensions to enum Network, only returned by GetExtNetwork,
// and only used in GetReachabilityFrom
static const int NET_UNKNOWN = NET_MAX + 0;
return ToStringIPPort();
}
-void CService::print() const
-{
- printf("CService(%s)\n", ToString().c_str());
-}
-
void CService::SetPort(unsigned short portIn)
{
port = portIn;
#endif
hSocket = INVALID_SOCKET;
return ret != SOCKET_ERROR;
-}
\ No newline at end of file
+}