-
Notifications
You must be signed in to change notification settings - Fork 38.7k
extend core proxy options and handling #2575
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/init.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why convert strArg to a c_str() here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps because I didn't know I could use strArg here ^^. Will update of course.
|
Removed some |
|
I left out changes needed in optionsmodel.cpp, that's why build fails... |
|
updated optionsmodel.cpp |
src/init.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use "GetArg(strArg)" instead of "!(mapArgs[strArg] == "0")". Shorter and more flexible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sipa After looking at GetArg(), couldn't this all be replaced with:
if (!IsLimited(net) && GetArg(strArg, 0)) {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed. I assumed the 0 was default.
|
Use |
|
Update name proxy setup to use |
|
@sipa Further thoughts about this? |
src/init.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sipa I need some input on GetArg(strArg, 0), which I added here because you suggested that earlier.
I want to catch -noproxy or -proxy=0 here, but GetArg(strArg, 0) does more.
-proxy=127.0.0.1 for example will also cause this to fail, because we use this GetArg()-version:
int64 GetArg(const std::string& strArg, int64 nDefault)
{
if (mapArgs.count(strArg))
return atoi64(mapArgs[strArg]);
return nDefault;
}
What hapens now is that atoi64(mapArgs[strArg]); will not work for "127.0.0.1" right ;). Too bad I didn't catch that earlier, as I only had the state -noproxy and -proxy=0 in mind, which indeed work here like they should.
Edit: I guess this should be (GetArg(strArg, "0") != "0"), right? -noproxy gets converted to proxy=0, which will return "0" here and every other proxy string will get into the if-clause then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Updated!
|
Needs a test plan to test all the combinations, then needs testers to, you know, actually test them all. |
|
@gavinandresen I'm fine with a test plan, as long as this has a real chance of getting merged. Is the code okay now or is ths not wanted anyway? |
|
Updated to include changes to |
|
Anyone willing to help me doing that test-plan stuff and/or check out if it works like it should :)? |
|
I am the last guy who should be checking GUI changes, but I will gladly follow a test plan and report back on it. (Though I can only easily test Linux, and windows builds under wine). |
|
@gmaxwell I'm glad you are interested in helping me with this one. You currently don't need to start Bitcoin-Qt to do so, as this can be tested completely via bitcoind. The only Bitcoin-Qt change is to make it compatible with a changed datastructure. Should I start by listing possible combinations of all proxy switches and how they should behave? |
|
I'm going to describe the pull with some more details here. Most proxy-setup is now done using the new
|
|
base proxy = Proxy initialisation flow (happens via Errors initialising base proxy or Tor/IPv6 proxies via base proxy lead to exit! |
|
@gmaxwell Perhaps you could take a look at what I've written, if the current proxy handling of this pull sounds correct, before I start doing the test-plan. |
|
Updated: Included suggestions from @sipa and introduced |
|
Still needs a test plan. |
|
Updated:
|
|
Damn I hope if we chose to remove SOCKS4 support this pull is much less complicated to test ;). |
|
I'm tending toward NACK, as it over-complicates things and introduces options that are difficult to test.
|
|
@laanwj I removed the changes to So last point is |
|
Removed |
src/rpcnet.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be better as a sub-object 'proxy' that contains the "ipv4", "ipv6" and "onion" fields.
|
Updated to include the changes after the SOCKS4 support removal and made |
- rework the proxy handling in init to cover more cases and work more thoroughly - add -proxy6 to allow setting a separate SOCKS5 proxy to reach peers via IPv6 - rework proxy data-structures to allow recognition of the default proxy (-proxy) to give users the ability to see, which proxy (IPv6 / Tor) is derived from the default proxy and which was explicitly set - extend RPC call getnetwork info - remove unneeded (int) casts before CLIENT_VERSION and PROTOCOL_VERSION in getinfo and getnetworkinfo RPC calls
|
Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/p2575_bb977eaccc5daeda5a05139f916fc4d00fe9f5ef/ for binaries and test log. |
|
@laanwj If you can re-check the latest changes, I'm able to squash this into 2 commits and will rebase the GUI pull onto this. |
|
See #4605 for my take on the RPC changes. I've added some more information per network. |
|
@laanwj Did you close your nameproxy pull? |
|
I never had it as pull, because I'm not sure how I want to handle that yet. I may submit it as pull as some point. |
This commit adds per-network information to the getnetworkinfo RPC call: - Is the network limited? - Is the network reachable - Which proxy is used for this network, if any Inspired by bitcoin#2575.
|
@laanwj If I remove the nameproxy changes are you fine with this then? |
|
@laanwj I'll rework this when I'm back in a few days. |
This commit adds per-network information to the getnetworkinfo RPC call: - Is the network limited? - Is the network reachable - Which proxy is used for this network, if any Inspired by bitcoin#2575.
|
Closing this one for now. This thread has gotten too 'messy'. If you intend to do a reworked version at some point that just changes initialization, I'd suggest opening a new pull. |
This commit adds per-network information to the getnetworkinfo RPC call: - Is the network limited? - Is the network reachable - Which proxy is used for this network, if any Inspired by bitcoin#2575. Conflicts: src/init.cpp src/rpcnet.cpp Rebased-from: aa82795 bitcoin#4605
This commit adds per-network information to the getnetworkinfo RPC call: - Is the network limited? - Is the network reachable - Which proxy is used for this network, if any Inspired by bitcoin#2575. Conflicts: src/init.cpp src/rpcnet.cpp Rebased-from: aa82795 bitcoin#4605
This commit adds per-network information to the getnetworkinfo RPC call: - Is the network limited? - Is the network reachable - Which proxy is used for this network, if any Inspired by bitcoin#2575. Conflicts: src/init.cpp src/rpcnet.cpp Rebased-from: aa82795 bitcoin#4605
This commit adds per-network information to the getnetworkinfo RPC call: - Is the network limited? - Is the network reachable - Which proxy is used for this network, if any Inspired by bitcoin#2575. Conflicts: src/init.cpp src/rpcnet.cpp Rebased-from: aa82795 bitcoin#4605
This commit adds per-network information to the getnetworkinfo RPC call: - Is the network limited? - Is the network reachable - Which proxy is used for this network, if any Inspired by bitcoin#2575. Conflicts: src/init.cpp src/rpcnet.cpp Rebased-from: aa82795 bitcoin#4605
This commit adds per-network information to the getnetworkinfo RPC call: - Is the network limited? - Is the network reachable - Which proxy is used for this network, if any Inspired by bitcoin#2575. (cherry picked from commit aa82795) # Conflicts: # src/rpcnet.cpp
thoroughly
IPv6
(-proxy) to give users the ability to see, which proxy (IPv6 / Tor) is
derived from the default proxy and which was explicitly set
2nd commit:
Most proxy-setup is now done using the new
ProxyInit()function.bool ProxyInit(Network net, const std::string& strArg, bool fIsDefault)parameter description:net= network to setup proxy for (NET_IPV4, NET_IPV6 or NET_TOR)strArg= command-line argument to get values from (-proxy, -proxy6 or -onion)fIsDefault= is that proxy the default proxy (true) or a separate proxy (false)?bool ProxyInit(Network net, const std::string& strArg, bool fIsDefault)does the following:-pre-check, if
netis not limited and -no{proxy/proxy6/onion} was NOT specified--pre-check passed: try to
SetProxy()and returnfalseon error---pre-check passed: only for
net == NET_TORcallSetReachable();---pre-check passed: return
true--pre-check failed: for default proxy (
fIsDefault == true) a failed pre-check is okay, returntrue, otherwisefalsedefault proxy =
-proxyseparate IPv6 proxy =
-proxy6separate Tor proxy =
-onionProxy initialisation flow (happens via
ProxyInit(), just the name proxy is special cased in the code):-try to setup default IPv4 proxy
-try to setup separate Tor proxy, on failure try to setup Tor proxy via default proxy
-try to setup separate IPv6 proxy, on failure try to setup IPv6 proxy via default proxy
-try to setup default SOCKS5 name proxy
Errors initialising default proxy or IPv6/Tor proxies via default proxy lead to exit!