| 654 | } |
| 655 | |
| 656 | bool ConnectThroughProxy(const Proxy& proxy, const std::string& strDest, uint16_t port, const Sock& sock, int nTimeout, bool& outProxyConnectionFailed) |
| 657 | { |
| 658 | // first connect to proxy server |
| 659 | if (!ConnectSocketDirectly(proxy.proxy, sock, nTimeout, true)) { |
| 660 | outProxyConnectionFailed = true; |
| 661 | return false; |
| 662 | } |
| 663 | // do socks negotiation |
| 664 | if (proxy.randomize_credentials) { |
| 665 | ProxyCredentials random_auth; |
| 666 | static std::atomic_int counter(0); |
| 667 | random_auth.username = random_auth.password = strprintf("%i", counter++); |
| 668 | if (!Socks5(strDest, port, &random_auth, sock)) { |
| 669 | return false; |
| 670 | } |
| 671 | } else { |
| 672 | if (!Socks5(strDest, port, 0, sock)) { |
| 673 | return false; |
| 674 | } |
| 675 | } |
| 676 | return true; |
| 677 | } |
| 678 | |
| 679 | bool LookupSubNet(const std::string& subnet_str, CSubNet& subnet_out) |
| 680 | { |
no test coverage detected