Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1457,6 +1457,26 @@ void ThreadOpenAddedConnections()

list<vector<CService> > lservAddressesToAdd(0);
BOOST_FOREACH(const std::string& strAddNode, lAddresses) {
// Detect .onion addresses — they cannot be DNS-resolved.
// Route them through the NET_ONION proxy (set by -onion=) if available,
// using the string-based ConnectSocketByName path.
{
std::string strHost;
int nPort = Params().GetDefaultPort();
SplitHostPort(strAddNode, nPort, strHost);
if (strHost.size() > 6 &&
strHost.substr(strHost.size() - 6) == ".onion")
{
proxyType onionProxy;
if (GetProxy(NET_ONION, onionProxy)) {
CSemaphoreGrant grant(*semOutbound);
OpenNetworkConnection(CAddress(), &grant, strAddNode.c_str());
MilliSleep(500);
}
continue;
}
}

vector<CService> vservNode(0);
if(Lookup(strAddNode.c_str(), vservNode, Params().GetDefaultPort(), fNameLookup, 0))
{
Expand Down
Loading