|
|
|
@ -21,6 +21,7 @@ bool fProxyNameLookup = false;
@@ -21,6 +21,7 @@ bool fProxyNameLookup = false;
|
|
|
|
|
bool fNameLookup = false; |
|
|
|
|
CService addrProxy("127.0.0.1",9050); |
|
|
|
|
int nConnectTimeout = 5000; |
|
|
|
|
static bool vfNoProxy[NET_MAX] = {}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static const unsigned char pchIPv4[12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff }; |
|
|
|
@ -33,6 +34,11 @@ enum Network ParseNetwork(std::string net) {
@@ -33,6 +34,11 @@ enum Network ParseNetwork(std::string net) {
|
|
|
|
|
return NET_UNROUTABLE; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void SetNoProxy(enum Network net, bool fNoProxy) { |
|
|
|
|
assert(net >= 0 && net < NET_MAX); |
|
|
|
|
vfNoProxy[net] = fNoProxy; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool static LookupIntern(const char *pszName, std::vector<CNetAddr>& vIP, unsigned int nMaxSolutions, bool fAllowLookup) |
|
|
|
|
{ |
|
|
|
|
vIP.clear(); |
|
|
|
@ -440,7 +446,7 @@ bool static ConnectSocketDirectly(const CService &addrConnect, SOCKET& hSocketRe
@@ -440,7 +446,7 @@ bool static ConnectSocketDirectly(const CService &addrConnect, SOCKET& hSocketRe
|
|
|
|
|
bool ConnectSocket(const CService &addrDest, SOCKET& hSocketRet, int nTimeout) |
|
|
|
|
{ |
|
|
|
|
SOCKET hSocket = INVALID_SOCKET; |
|
|
|
|
bool fProxy = (fUseProxy && addrDest.IsRoutable()); |
|
|
|
|
bool fProxy = (fUseProxy && addrDest.IsRoutable() && !vfNoProxy[addrDest.GetNetwork()]); |
|
|
|
|
|
|
|
|
|
if (!ConnectSocketDirectly(fProxy ? addrProxy : addrDest, hSocket, nTimeout)) |
|
|
|
|
return false; |
|
|
|
|