scripted-diff: Replace NET_TOR with NET_ONION
-BEGIN VERIFY SCRIPT- sed --in-place'' --expression='s/NET_TOR/NET_ONION/g' $(git grep -I --files-with-matches 'NET_TOR') -END VERIFY SCRIPT- The --in-place'' hack is required for sed on macOS to edit files in-place without passing a backup extension.
This commit is contained in:
parent
686e97a0c7
commit
07c493f2d1
7 changed files with 20 additions and 20 deletions
12
src/init.cpp
12
src/init.cpp
|
@ -1358,7 +1358,7 @@ bool AppInitMain()
|
|||
// -proxy sets a proxy for all outgoing network traffic
|
||||
// -noproxy (or -proxy=0) as well as the empty string can be used to not set a proxy, this is the default
|
||||
std::string proxyArg = gArgs.GetArg("-proxy", "");
|
||||
SetLimited(NET_TOR);
|
||||
SetLimited(NET_ONION);
|
||||
if (proxyArg != "" && proxyArg != "0") {
|
||||
CService proxyAddr;
|
||||
if (!Lookup(proxyArg.c_str(), proxyAddr, 9050, fNameLookup)) {
|
||||
|
@ -1371,9 +1371,9 @@ bool AppInitMain()
|
|||
|
||||
SetProxy(NET_IPV4, addrProxy);
|
||||
SetProxy(NET_IPV6, addrProxy);
|
||||
SetProxy(NET_TOR, addrProxy);
|
||||
SetProxy(NET_ONION, addrProxy);
|
||||
SetNameProxy(addrProxy);
|
||||
SetLimited(NET_TOR, false); // by default, -proxy sets onion as reachable, unless -noonion later
|
||||
SetLimited(NET_ONION, false); // by default, -proxy sets onion as reachable, unless -noonion later
|
||||
}
|
||||
|
||||
// -onion can be used to set only a proxy for .onion, or override normal proxy for .onion addresses
|
||||
|
@ -1382,7 +1382,7 @@ bool AppInitMain()
|
|||
std::string onionArg = gArgs.GetArg("-onion", "");
|
||||
if (onionArg != "") {
|
||||
if (onionArg == "0") { // Handle -noonion/-onion=0
|
||||
SetLimited(NET_TOR); // set onions as unreachable
|
||||
SetLimited(NET_ONION); // set onions as unreachable
|
||||
} else {
|
||||
CService onionProxy;
|
||||
if (!Lookup(onionArg.c_str(), onionProxy, 9050, fNameLookup)) {
|
||||
|
@ -1391,8 +1391,8 @@ bool AppInitMain()
|
|||
proxyType addrOnion = proxyType(onionProxy, proxyRandomize);
|
||||
if (!addrOnion.IsValid())
|
||||
return InitError(strprintf(_("Invalid -onion address or hostname: '%s'"), onionArg));
|
||||
SetProxy(NET_TOR, addrOnion);
|
||||
SetLimited(NET_TOR, false);
|
||||
SetProxy(NET_ONION, addrOnion);
|
||||
SetLimited(NET_ONION, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -246,7 +246,7 @@ enum Network CNetAddr::GetNetwork() const
|
|||
return NET_IPV4;
|
||||
|
||||
if (IsTor())
|
||||
return NET_TOR;
|
||||
return NET_ONION;
|
||||
|
||||
return NET_IPV6;
|
||||
}
|
||||
|
@ -355,7 +355,7 @@ std::vector<unsigned char> CNetAddr::GetGroup() const
|
|||
}
|
||||
else if (IsTor())
|
||||
{
|
||||
nClass = NET_TOR;
|
||||
nClass = NET_ONION;
|
||||
nStartByte = 6;
|
||||
nBits = 4;
|
||||
}
|
||||
|
@ -433,11 +433,11 @@ int CNetAddr::GetReachabilityFrom(const CNetAddr *paddrPartner) const
|
|||
case NET_IPV4: return REACH_IPV4;
|
||||
case NET_IPV6: return fTunnel ? REACH_IPV6_WEAK : REACH_IPV6_STRONG; // only prefer giving our IPv6 address if it's not tunnelled
|
||||
}
|
||||
case NET_TOR:
|
||||
case NET_ONION:
|
||||
switch(ourNet) {
|
||||
default: return REACH_DEFAULT;
|
||||
case NET_IPV4: return REACH_IPV4; // Tor users can connect to IPv4 as well
|
||||
case NET_TOR: return REACH_PRIVATE;
|
||||
case NET_ONION: return REACH_PRIVATE;
|
||||
}
|
||||
case NET_TEREDO:
|
||||
switch(ourNet) {
|
||||
|
@ -454,7 +454,7 @@ int CNetAddr::GetReachabilityFrom(const CNetAddr *paddrPartner) const
|
|||
case NET_TEREDO: return REACH_TEREDO;
|
||||
case NET_IPV6: return REACH_IPV6_WEAK;
|
||||
case NET_IPV4: return REACH_IPV4;
|
||||
case NET_TOR: return REACH_PRIVATE; // either from Tor, or don't care about our address
|
||||
case NET_ONION: return REACH_PRIVATE; // either from Tor, or don't care about our address
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ enum Network
|
|||
NET_UNROUTABLE = 0,
|
||||
NET_IPV4,
|
||||
NET_IPV6,
|
||||
NET_TOR,
|
||||
NET_ONION,
|
||||
NET_INTERNAL,
|
||||
|
||||
NET_MAX,
|
||||
|
|
|
@ -41,10 +41,10 @@ enum Network ParseNetwork(std::string net) {
|
|||
boost::to_lower(net);
|
||||
if (net == "ipv4") return NET_IPV4;
|
||||
if (net == "ipv6") return NET_IPV6;
|
||||
if (net == "onion") return NET_TOR;
|
||||
if (net == "onion") return NET_ONION;
|
||||
if (net == "tor") {
|
||||
LogPrintf("Warning: net name 'tor' is deprecated and will be removed in the future. You should use 'onion' instead.\n");
|
||||
return NET_TOR;
|
||||
return NET_ONION;
|
||||
}
|
||||
return NET_UNROUTABLE;
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ std::string GetNetworkName(enum Network net) {
|
|||
{
|
||||
case NET_IPV4: return "ipv4";
|
||||
case NET_IPV6: return "ipv6";
|
||||
case NET_TOR: return "onion";
|
||||
case NET_ONION: return "onion";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -331,7 +331,7 @@ void OptionsDialog::updateDefaultProxyNets()
|
|||
strDefaultProxyGUI = ui->proxyIp->text() + ":" + ui->proxyPort->text();
|
||||
(strProxy == strDefaultProxyGUI.toStdString()) ? ui->proxyReachIPv6->setChecked(true) : ui->proxyReachIPv6->setChecked(false);
|
||||
|
||||
model->node().getProxy(NET_TOR, proxy);
|
||||
model->node().getProxy(NET_ONION, proxy);
|
||||
strProxy = proxy.proxy.ToStringIP() + ":" + proxy.proxy.ToStringPort();
|
||||
strDefaultProxyGUI = ui->proxyIp->text() + ":" + ui->proxyPort->text();
|
||||
(strProxy == strDefaultProxyGUI.toStdString()) ? ui->proxyReachTor->setChecked(true) : ui->proxyReachTor->setChecked(false);
|
||||
|
|
|
@ -39,7 +39,7 @@ BOOST_AUTO_TEST_CASE(netbase_networks)
|
|||
BOOST_CHECK(ResolveIP("::1").GetNetwork() == NET_UNROUTABLE);
|
||||
BOOST_CHECK(ResolveIP("8.8.8.8").GetNetwork() == NET_IPV4);
|
||||
BOOST_CHECK(ResolveIP("2001::8888").GetNetwork() == NET_IPV6);
|
||||
BOOST_CHECK(ResolveIP("FD87:D87E:EB43:edb1:8e4:3588:e546:35ca").GetNetwork() == NET_TOR);
|
||||
BOOST_CHECK(ResolveIP("FD87:D87E:EB43:edb1:8e4:3588:e546:35ca").GetNetwork() == NET_ONION);
|
||||
BOOST_CHECK(CreateInternal("foo.com").GetNetwork() == NET_INTERNAL);
|
||||
|
||||
}
|
||||
|
@ -293,7 +293,7 @@ BOOST_AUTO_TEST_CASE(netbase_getgroup)
|
|||
BOOST_CHECK(ResolveIP("64:FF9B::102:304").GetGroup() == std::vector<unsigned char>({(unsigned char)NET_IPV4, 1, 2})); // RFC6052
|
||||
BOOST_CHECK(ResolveIP("2002:102:304:9999:9999:9999:9999:9999").GetGroup() == std::vector<unsigned char>({(unsigned char)NET_IPV4, 1, 2})); // RFC3964
|
||||
BOOST_CHECK(ResolveIP("2001:0:9999:9999:9999:9999:FEFD:FCFB").GetGroup() == std::vector<unsigned char>({(unsigned char)NET_IPV4, 1, 2})); // RFC4380
|
||||
BOOST_CHECK(ResolveIP("FD87:D87E:EB43:edb1:8e4:3588:e546:35ca").GetGroup() == std::vector<unsigned char>({(unsigned char)NET_TOR, 239})); // Tor
|
||||
BOOST_CHECK(ResolveIP("FD87:D87E:EB43:edb1:8e4:3588:e546:35ca").GetGroup() == std::vector<unsigned char>({(unsigned char)NET_ONION, 239})); // Tor
|
||||
BOOST_CHECK(ResolveIP("2001:470:abcd:9999:9999:9999:9999:9999").GetGroup() == std::vector<unsigned char>({(unsigned char)NET_IPV6, 32, 1, 4, 112, 175})); //he.net
|
||||
BOOST_CHECK(ResolveIP("2001:2001:9999:9999:9999:9999:9999:9999").GetGroup() == std::vector<unsigned char>({(unsigned char)NET_IPV6, 32, 1, 32, 1})); //IPv6
|
||||
|
||||
|
|
|
@ -528,8 +528,8 @@ void TorController::auth_cb(TorControlConnection& _conn, const TorControlReply&
|
|||
if (gArgs.GetArg("-onion", "") == "") {
|
||||
CService resolved(LookupNumeric("127.0.0.1", 9050));
|
||||
proxyType addrOnion = proxyType(resolved, true);
|
||||
SetProxy(NET_TOR, addrOnion);
|
||||
SetLimited(NET_TOR, false);
|
||||
SetProxy(NET_ONION, addrOnion);
|
||||
SetLimited(NET_ONION, false);
|
||||
}
|
||||
|
||||
// Finally - now create the service
|
||||
|
|
Loading…
Reference in a new issue