Changeset View
Changeset View
Standalone View
Standalone View
src/netbase.cpp
Show All 12 Lines | |||||
#include <utilstrencodings.h> | #include <utilstrencodings.h> | ||||
#include <atomic> | #include <atomic> | ||||
#ifndef WIN32 | #ifndef WIN32 | ||||
#include <fcntl.h> | #include <fcntl.h> | ||||
#endif | #endif | ||||
#include <boost/algorithm/string/case_conv.hpp> // for to_lower() | |||||
#if !defined(MSG_NOSIGNAL) | #if !defined(MSG_NOSIGNAL) | ||||
#define MSG_NOSIGNAL 0 | #define MSG_NOSIGNAL 0 | ||||
#endif | #endif | ||||
// Settings | // Settings | ||||
static proxyType proxyInfo[NET_MAX]; | static proxyType proxyInfo[NET_MAX]; | ||||
static proxyType nameProxy; | static proxyType nameProxy; | ||||
static CCriticalSection cs_proxyInfos; | static CCriticalSection cs_proxyInfos; | ||||
int nConnectTimeout = DEFAULT_CONNECT_TIMEOUT; | int nConnectTimeout = DEFAULT_CONNECT_TIMEOUT; | ||||
bool fNameLookup = DEFAULT_NAME_LOOKUP; | bool fNameLookup = DEFAULT_NAME_LOOKUP; | ||||
// Need ample time for negotiation for very slow proxies such as Tor | // Need ample time for negotiation for very slow proxies such as Tor | ||||
// (milliseconds) | // (milliseconds) | ||||
static const int SOCKS5_RECV_TIMEOUT = 20 * 1000; | static const int SOCKS5_RECV_TIMEOUT = 20 * 1000; | ||||
static std::atomic<bool> interruptSocks5Recv(false); | static std::atomic<bool> interruptSocks5Recv(false); | ||||
enum Network ParseNetwork(std::string net) { | enum Network ParseNetwork(std::string net) { | ||||
boost::to_lower(net); | Downcase(net); | ||||
if (net == "ipv4") { | if (net == "ipv4") { | ||||
return NET_IPV4; | return NET_IPV4; | ||||
} | } | ||||
if (net == "ipv6") { | if (net == "ipv6") { | ||||
return NET_IPV6; | return NET_IPV6; | ||||
} | } | ||||
if (net == "onion") { | if (net == "onion") { | ||||
return NET_ONION; | return NET_ONION; | ||||
▲ Show 20 Lines • Show All 735 Lines • Show Last 20 Lines |