| 588 | } |
| 589 | |
| 590 | bool 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 | |
| 614 | bool LookupSubNet(const char* pszName, CSubNet& ret) |
| 615 | { |
no test coverage detected