MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / ConnectThroughProxy

Function ConnectThroughProxy

src/netbase.cpp:590–612  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

588}
589
590bool ConnectThroughProxy(const proxyType &proxy, const std::string& strDest, int port, const SOCKET& hSocket, int nTimeout, bool *outProxyConnectionFailed)
591{
592 // first connect to proxy server
593 if (!ConnectSocketDirectly(proxy.proxy, hSocket, nTimeout, true)) {
594 if (outProxyConnectionFailed)
595 *outProxyConnectionFailed = true;
596 return false;
597 }
598 // do socks negotiation
599 if (proxy.randomize_credentials) {
600 ProxyCredentials random_auth;
601 static std::atomic_int counter(0);
602 random_auth.username = random_auth.password = strprintf("%i", counter++);
603 if (!Socks5(strDest, (unsigned short)port, &random_auth, hSocket)) {
604 return false;
605 }
606 } else {
607 if (!Socks5(strDest, (unsigned short)port, 0, hSocket)) {
608 return false;
609 }
610 }
611 return true;
612}
613
614bool LookupSubNet(const char* pszName, CSubNet& ret)
615{

Callers 1

ConnectNodeMethod · 0.85

Calls 2

ConnectSocketDirectlyFunction · 0.85
Socks5Function · 0.85

Tested by

no test coverage detected