extend core proxy options and handling#4871
extend core proxy options and handling#4871Diapolo wants to merge 1 commit intobitcoin:masterfrom Diapolo:proxy-core
Conversation
|
@laanwj As you suggested, a new and clean pull and empty discussion ;). |
|
@laanwj Can you please have a look again, I hope we can sort this out now finally :). |
|
Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/p4871_2711cda5b8c54efb2164d7bb3593b3db50f8e15c/ for binaries and test log. |
|
Rebased and removed an obsolete c_str(). |
|
@laanwj This and the GUI part are pulls that are not cosmetic, but need review or ACKs. |
src/rpcnet.cpp
Outdated
There was a problem hiding this comment.
As said before - I'm still not convinced that proxy-from-default is useful information. Clients requesting from RPC just want to know the currently effective state, it shouldn't matter how it came that way. For troubleshooting command line argument interaction there's always debug.log.
There was a problem hiding this comment.
Alright, removing this will finally make the pull get merged then?
There was a problem hiding this comment.
The main problem here is that we don't have testcases with proxy, so this needs to be manually tested. Can you list what you tested?
|
Needs rebase |
|
Rebased, needs review / testing. |
|
To be clear what this is blocked on: We need (RPC) tests for the proxy functionality, before we can merge changes like this. |
|
@laanwj Rebased to include the recent |
src/rpcnet.cpp
Outdated
There was a problem hiding this comment.
Let's remove proxy-from-default, it's not useful information and will always be true anyway according to the above code.
- rework the proxy handling in init to cover more cases and work more thoroughly
|
@laanwj Removed changes to rpcnet.cpp. |
|
@laanwj This is passing proxy tests and I removed what you didn't like. Anything I can do to get this forward finally? |
|
I'm terribly sorry sorry for holding this up so long, but I'm not convinced that the new logic is any better. The logical flow here sounds to me:
All errors during parsing of either setting should be fatal, to avoid that the user is running with different settings than they expect. This is nearer to the original code than yours. I certainly think the code could be simplified and made more clear, what do you think about: bool proxyRandomize = GetBoolArg("-proxyrandomize", true);
// -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 = GetArg("-proxy", "");
if (proxyArg != "" && proxyArg != "0") {
proxyType addrProxy = proxyType(CService(proxyArg, 9050), proxyRandomize);
if (!addrProxy.IsValid())
return InitError(strprintf(_("Invalid -proxy address: '%s'"), proxyArg));
SetProxy(NET_IPV4, addrProxy);
SetProxy(NET_IPV6, addrProxy);
SetProxy(NET_TOR, addrProxy);
SetNameProxy(addrProxy);
SetReachable(NET_TOR); // by default, -proxy sets onion as reachable, unless -noonion later
}
// -onion can override normal proxy for .onion addresses
// -noonion (or -onion=0) disables connecting to .onion entirely
// An empty string is used to just not override the onion proxy
std::string onionArg = GetArg("-onion", "");
if (onionArg != "") {
if (onionArg == "0") { // Handle -noonion/-onion=0
SetReachable(NET_TOR, false); // set onions as unreachable
} else {
proxyType addrOnion;
addrOnion = proxyType(CService(onionArg, 9050), proxyRandomize);
if (!addrOnion.IsValid())
return InitError(strprintf(_("Invalid -onion address: '%s'"), onionArg));
SetProxy(NET_TOR, addrOnion);
SetReachable(NET_TOR);
}
}This provides a straightforward flow, gets rid of |
|
Closing in favor of #6272 |
thoroughly
default proxy
See #2575 for discussion!