-
Notifications
You must be signed in to change notification settings - Fork 36.1k
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
extend core proxy options and handling #4871
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. |
obj.push_back(Pair("name", GetNetworkName(network))); | ||
obj.push_back(Pair("limited", IsLimited(network))); | ||
obj.push_back(Pair("reachable", IsReachable(network))); | ||
obj.push_back(Pair("proxy", proxy.IsValid() ? proxy.ToStringIPPort() : string())); | ||
if (network != NET_IPV4) | ||
obj.push_back(Pair("proxy-from-default", proxy == proxyDefault)); |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, removing this will finally make the pull get merged 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.
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 |
obj.push_back(Pair("name", GetNetworkName(network))); | ||
obj.push_back(Pair("limited", IsLimited(network))); | ||
obj.push_back(Pair("reachable", IsReachable(network))); | ||
obj.push_back(Pair("proxy", proxy.IsValid() ? proxy.proxy.ToStringIPPort() : string())); | ||
obj.push_back(Pair("proxy_randomize_credentials", proxy.randomize_credentials)); | ||
if (network != NET_IPV4) | ||
obj.push_back(Pair("proxy-from-default", proxy.proxy == proxyDefault.proxy)); |
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.
Let's remove proxy-from-default
, it's not useful information and will always be true anyway according to the above code.
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.
I'll remove it :).
- 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!