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

Function ConnectThroughProxy

src/netbase.cpp:804–829  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

802};
803
804std::unique_ptr<Sock> ConnectThroughProxy(const Proxy& proxy,
805 const std::string& dest,
806 uint16_t port,
807 bool& proxy_connection_failed)
808{
809 // first connect to proxy server
810 auto sock = proxy.Connect();
811 if (!sock) {
812 proxy_connection_failed = true;
813 return {};
814 }
815
816 // do socks negotiation
817 if (proxy.m_tor_stream_isolation) {
818 static TorStreamIsolationCredentialsGenerator generator;
819 ProxyCredentials random_auth{generator.Generate()};
820 if (!Socks5(dest, port, &random_auth, *sock)) {
821 return {};
822 }
823 } else {
824 if (!Socks5(dest, port, nullptr, *sock)) {
825 return {};
826 }
827 }
828 return sock;
829}
830
831CSubNet LookupSubNet(const std::string& subnet_str)
832{

Callers 1

ConnectNodeMethod · 0.85

Calls 3

Socks5Function · 0.85
ConnectMethod · 0.45
GenerateMethod · 0.45

Tested by

no test coverage detected