mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-08 12:19:07 +02:00
scripted-diff: rename proxyType
to Proxy
-BEGIN VERIFY SCRIPT- sed -i 's/\<proxyType\>/Proxy/g' $(git grep -l proxyType) -END VERIFY SCRIPT-
This commit is contained in:
parent
e53a8505db
commit
0eea83a85e
10
src/init.cpp
10
src/init.cpp
@ -1315,7 +1315,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
||||
// Check for host lookup allowed before parsing any network related parameters
|
||||
fNameLookup = args.GetBoolArg("-dns", DEFAULT_NAME_LOOKUP);
|
||||
|
||||
proxyType onion_proxy;
|
||||
Proxy onion_proxy;
|
||||
|
||||
bool proxyRandomize = args.GetBoolArg("-proxyrandomize", DEFAULT_PROXYRANDOMIZE);
|
||||
// -proxy sets a proxy for all outgoing network traffic
|
||||
@ -1327,7 +1327,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
||||
return InitError(strprintf(_("Invalid -proxy address or hostname: '%s'"), proxyArg));
|
||||
}
|
||||
|
||||
proxyType addrProxy = proxyType(proxyAddr, proxyRandomize);
|
||||
Proxy addrProxy = Proxy(proxyAddr, proxyRandomize);
|
||||
if (!addrProxy.IsValid())
|
||||
return InitError(strprintf(_("Invalid -proxy address or hostname: '%s'"), proxyArg));
|
||||
|
||||
@ -1344,13 +1344,13 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
||||
std::string onionArg = args.GetArg("-onion", "");
|
||||
if (onionArg != "") {
|
||||
if (onionArg == "0") { // Handle -noonion/-onion=0
|
||||
onion_proxy = proxyType{};
|
||||
onion_proxy = Proxy{};
|
||||
} else {
|
||||
CService addr;
|
||||
if (!Lookup(onionArg, addr, 9050, fNameLookup) || !addr.IsValid()) {
|
||||
return InitError(strprintf(_("Invalid -onion address or hostname: '%s'"), onionArg));
|
||||
}
|
||||
onion_proxy = proxyType{addr, proxyRandomize};
|
||||
onion_proxy = Proxy{addr, proxyRandomize};
|
||||
}
|
||||
}
|
||||
|
||||
@ -1851,7 +1851,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
||||
if (!Lookup(i2psam_arg, addr, 7656, fNameLookup) || !addr.IsValid()) {
|
||||
return InitError(strprintf(_("Invalid -i2psam address or hostname: '%s'"), i2psam_arg));
|
||||
}
|
||||
SetProxy(NET_I2P, proxyType{addr});
|
||||
SetProxy(NET_I2P, Proxy{addr});
|
||||
} else {
|
||||
SetReachable(NET_I2P, false);
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ class CNodeStats;
|
||||
class Coin;
|
||||
class RPCTimerInterface;
|
||||
class UniValue;
|
||||
class proxyType;
|
||||
class Proxy;
|
||||
enum class SynchronizationState;
|
||||
enum class TransactionError;
|
||||
struct CNodeStateStats;
|
||||
@ -97,7 +97,7 @@ public:
|
||||
virtual void mapPort(bool use_upnp, bool use_natpmp) = 0;
|
||||
|
||||
//! Get proxy.
|
||||
virtual bool getProxy(Network net, proxyType& proxy_info) = 0;
|
||||
virtual bool getProxy(Network net, Proxy& proxy_info) = 0;
|
||||
|
||||
//! Get number of connections.
|
||||
virtual size_t getNodeCount(ConnectionDirection flags) = 0;
|
||||
|
@ -447,7 +447,7 @@ CNode* CConnman::ConnectNode(CAddress addrConnect, const char *pszDest, bool fCo
|
||||
// Connect
|
||||
bool connected = false;
|
||||
std::unique_ptr<Sock> sock;
|
||||
proxyType proxy;
|
||||
Proxy proxy;
|
||||
CAddress addr_bind;
|
||||
assert(!addr_bind.IsValid());
|
||||
|
||||
@ -2538,7 +2538,7 @@ bool CConnman::Start(CScheduler& scheduler, const Options& connOptions)
|
||||
return false;
|
||||
}
|
||||
|
||||
proxyType i2p_sam;
|
||||
Proxy i2p_sam;
|
||||
if (GetProxy(NET_I2P, i2p_sam)) {
|
||||
m_i2p_sam_session = std::make_unique<i2p::sam::Session>(gArgs.GetDataDirNet() / "i2p_private_key",
|
||||
i2p_sam.proxy, &interruptNet);
|
||||
|
@ -31,8 +31,8 @@
|
||||
|
||||
// Settings
|
||||
static Mutex g_proxyinfo_mutex;
|
||||
static proxyType proxyInfo[NET_MAX] GUARDED_BY(g_proxyinfo_mutex);
|
||||
static proxyType nameProxy GUARDED_BY(g_proxyinfo_mutex);
|
||||
static Proxy proxyInfo[NET_MAX] GUARDED_BY(g_proxyinfo_mutex);
|
||||
static Proxy nameProxy GUARDED_BY(g_proxyinfo_mutex);
|
||||
int nConnectTimeout = DEFAULT_CONNECT_TIMEOUT;
|
||||
bool fNameLookup = DEFAULT_NAME_LOOKUP;
|
||||
|
||||
@ -605,7 +605,7 @@ bool ConnectSocketDirectly(const CService &addrConnect, const Sock& sock, int nT
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SetProxy(enum Network net, const proxyType &addrProxy) {
|
||||
bool SetProxy(enum Network net, const Proxy &addrProxy) {
|
||||
assert(net >= 0 && net < NET_MAX);
|
||||
if (!addrProxy.IsValid())
|
||||
return false;
|
||||
@ -614,7 +614,7 @@ bool SetProxy(enum Network net, const proxyType &addrProxy) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GetProxy(enum Network net, proxyType &proxyInfoOut) {
|
||||
bool GetProxy(enum Network net, Proxy &proxyInfoOut) {
|
||||
assert(net >= 0 && net < NET_MAX);
|
||||
LOCK(g_proxyinfo_mutex);
|
||||
if (!proxyInfo[net].IsValid())
|
||||
@ -623,7 +623,7 @@ bool GetProxy(enum Network net, proxyType &proxyInfoOut) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SetNameProxy(const proxyType &addrProxy) {
|
||||
bool SetNameProxy(const Proxy &addrProxy) {
|
||||
if (!addrProxy.IsValid())
|
||||
return false;
|
||||
LOCK(g_proxyinfo_mutex);
|
||||
@ -631,7 +631,7 @@ bool SetNameProxy(const proxyType &addrProxy) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GetNameProxy(proxyType &nameProxyOut) {
|
||||
bool GetNameProxy(Proxy &nameProxyOut) {
|
||||
LOCK(g_proxyinfo_mutex);
|
||||
if(!nameProxy.IsValid())
|
||||
return false;
|
||||
@ -653,7 +653,7 @@ bool IsProxy(const CNetAddr &addr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ConnectThroughProxy(const proxyType& proxy, const std::string& strDest, uint16_t port, const Sock& sock, int nTimeout, bool& outProxyConnectionFailed)
|
||||
bool ConnectThroughProxy(const Proxy& proxy, const std::string& strDest, uint16_t port, const Sock& sock, int nTimeout, bool& outProxyConnectionFailed)
|
||||
{
|
||||
// first connect to proxy server
|
||||
if (!ConnectSocketDirectly(proxy.proxy, sock, nTimeout, true)) {
|
||||
|
@ -45,11 +45,11 @@ static inline bool operator&(ConnectionDirection a, ConnectionDirection b) {
|
||||
return (underlying(a) & underlying(b));
|
||||
}
|
||||
|
||||
class proxyType
|
||||
class Proxy
|
||||
{
|
||||
public:
|
||||
proxyType(): randomize_credentials(false) {}
|
||||
explicit proxyType(const CService &_proxy, bool _randomize_credentials=false): proxy(_proxy), randomize_credentials(_randomize_credentials) {}
|
||||
Proxy(): randomize_credentials(false) {}
|
||||
explicit Proxy(const CService &_proxy, bool _randomize_credentials=false): proxy(_proxy), randomize_credentials(_randomize_credentials) {}
|
||||
|
||||
bool IsValid() const { return proxy.IsValid(); }
|
||||
|
||||
@ -73,8 +73,8 @@ enum Network ParseNetwork(const std::string& net);
|
||||
std::string GetNetworkName(enum Network net);
|
||||
/** Return a vector of publicly routable Network names; optionally append NET_UNROUTABLE. */
|
||||
std::vector<std::string> GetNetworkNames(bool append_unroutable = false);
|
||||
bool SetProxy(enum Network net, const proxyType &addrProxy);
|
||||
bool GetProxy(enum Network net, proxyType &proxyInfoOut);
|
||||
bool SetProxy(enum Network net, const Proxy &addrProxy);
|
||||
bool GetProxy(enum Network net, Proxy &proxyInfoOut);
|
||||
bool IsProxy(const CNetAddr &addr);
|
||||
/**
|
||||
* Set the name proxy to use for all connections to nodes specified by a
|
||||
@ -92,9 +92,9 @@ bool IsProxy(const CNetAddr &addr);
|
||||
* server in common use (most notably Tor) actually implements UDP
|
||||
* support, and a DNS resolver is beyond the scope of this project.
|
||||
*/
|
||||
bool SetNameProxy(const proxyType &addrProxy);
|
||||
bool SetNameProxy(const Proxy &addrProxy);
|
||||
bool HaveNameProxy();
|
||||
bool GetNameProxy(proxyType &nameProxyOut);
|
||||
bool GetNameProxy(Proxy &nameProxyOut);
|
||||
|
||||
using DNSLookupFn = std::function<std::vector<CNetAddr>(const std::string&, bool)>;
|
||||
extern DNSLookupFn g_dns_lookup;
|
||||
@ -218,7 +218,7 @@ bool ConnectSocketDirectly(const CService &addrConnect, const Sock& sock, int nT
|
||||
*
|
||||
* @returns Whether or not the operation succeeded.
|
||||
*/
|
||||
bool ConnectThroughProxy(const proxyType& proxy, const std::string& strDest, uint16_t port, const Sock& sock, int nTimeout, bool& outProxyConnectionFailed);
|
||||
bool ConnectThroughProxy(const Proxy& proxy, const std::string& strDest, uint16_t port, const Sock& sock, int nTimeout, bool& outProxyConnectionFailed);
|
||||
|
||||
/** Disable or enable blocking-mode for a socket */
|
||||
bool SetSocketNonBlocking(const SOCKET& hSocket, bool fNonBlocking);
|
||||
|
@ -113,7 +113,7 @@ public:
|
||||
}
|
||||
bool shutdownRequested() override { return ShutdownRequested(); }
|
||||
void mapPort(bool use_upnp, bool use_natpmp) override { StartMapPort(use_upnp, use_natpmp); }
|
||||
bool getProxy(Network net, proxyType& proxy_info) override { return GetProxy(net, proxy_info); }
|
||||
bool getProxy(Network net, Proxy& proxy_info) override { return GetProxy(net, proxy_info); }
|
||||
size_t getNodeCount(ConnectionDirection flags) override
|
||||
{
|
||||
return m_context->connman ? m_context->connman->GetNodeCount(flags) : 0;
|
||||
|
@ -328,7 +328,7 @@ void ClientModel::unsubscribeFromCoreSignals()
|
||||
|
||||
bool ClientModel::getProxyInfo(std::string& ip_port) const
|
||||
{
|
||||
proxyType ipv4, ipv6;
|
||||
Proxy ipv4, ipv6;
|
||||
if (m_node.getProxy((Network) 1, ipv4) && m_node.getProxy((Network) 2, ipv6)) {
|
||||
ip_port = ipv4.proxy.ToStringIPPort();
|
||||
return true;
|
||||
|
@ -392,7 +392,7 @@ void OptionsDialog::updateProxyValidationState()
|
||||
|
||||
void OptionsDialog::updateDefaultProxyNets()
|
||||
{
|
||||
proxyType proxy;
|
||||
Proxy proxy;
|
||||
std::string strProxy;
|
||||
QString strDefaultProxyGUI;
|
||||
|
||||
@ -422,7 +422,7 @@ QValidator::State ProxyAddressValidator::validate(QString &input, int &pos) cons
|
||||
Q_UNUSED(pos);
|
||||
// Validate the proxy
|
||||
CService serv(LookupNumeric(input.toStdString(), DEFAULT_GUI_PROXY_PORT));
|
||||
proxyType addrProxy = proxyType(serv, true);
|
||||
Proxy addrProxy = Proxy(serv, true);
|
||||
if (addrProxy.IsValid())
|
||||
return QValidator::Acceptable;
|
||||
|
||||
|
@ -567,7 +567,7 @@ static UniValue GetNetworksInfo()
|
||||
for (int n = 0; n < NET_MAX; ++n) {
|
||||
enum Network network = static_cast<enum Network>(n);
|
||||
if (network == NET_UNROUTABLE || network == NET_INTERNAL) continue;
|
||||
proxyType proxy;
|
||||
Proxy proxy;
|
||||
UniValue obj(UniValue::VOBJ);
|
||||
GetProxy(network, proxy);
|
||||
obj.pushKV("name", GetNetworkName(network));
|
||||
|
@ -378,7 +378,7 @@ void TorController::auth_cb(TorControlConnection& _conn, const TorControlReply&
|
||||
// if -onion isn't set to something else.
|
||||
if (gArgs.GetArg("-onion", "") == "") {
|
||||
CService resolved(LookupNumeric("127.0.0.1", 9050));
|
||||
proxyType addrOnion = proxyType(resolved, true);
|
||||
Proxy addrOnion = Proxy(resolved, true);
|
||||
SetProxy(NET_ONION, addrOnion);
|
||||
|
||||
const auto onlynets = gArgs.GetArgs("-onlynet");
|
||||
|
Loading…
x
Reference in New Issue
Block a user