Merge pull request #4327
a339a37error out, when we detect -socks argument (Philip Kaufmann)0127a9bremove SOCKS4 support from core and GUI (Philip Kaufmann)
This commit is contained in:
@@ -328,26 +328,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="socksVersionLabel">
|
||||
<property name="text">
|
||||
<string>SOCKS &Version:</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>socksVersion</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QValueComboBox" name="socksVersion">
|
||||
<property name="toolTip">
|
||||
<string>SOCKS version of the proxy (e.g. 5)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_1_Network">
|
||||
<property name="orientation">
|
||||
|
||||
@@ -52,15 +52,8 @@ OptionsDialog::OptionsDialog(QWidget *parent) :
|
||||
ui->proxyPort->setEnabled(false);
|
||||
ui->proxyPort->setValidator(new QIntValidator(1, 65535, this));
|
||||
|
||||
/** SOCKS version is only selectable for default proxy and is always 5 for IPv6 and Tor */
|
||||
ui->socksVersion->setEnabled(false);
|
||||
ui->socksVersion->addItem("5", 5);
|
||||
ui->socksVersion->addItem("4", 4);
|
||||
ui->socksVersion->setCurrentIndex(0);
|
||||
|
||||
connect(ui->connectSocks, SIGNAL(toggled(bool)), ui->proxyIp, SLOT(setEnabled(bool)));
|
||||
connect(ui->connectSocks, SIGNAL(toggled(bool)), ui->proxyPort, SLOT(setEnabled(bool)));
|
||||
connect(ui->connectSocks, SIGNAL(toggled(bool)), ui->socksVersion, SLOT(setEnabled(bool)));
|
||||
|
||||
ui->proxyIp->installEventFilter(this);
|
||||
|
||||
@@ -182,7 +175,6 @@ void OptionsDialog::setMapper()
|
||||
mapper->addMapping(ui->connectSocks, OptionsModel::ProxyUse);
|
||||
mapper->addMapping(ui->proxyIp, OptionsModel::ProxyIP);
|
||||
mapper->addMapping(ui->proxyPort, OptionsModel::ProxyPort);
|
||||
mapper->addMapping(ui->socksVersion, OptionsModel::ProxySocksVersion);
|
||||
|
||||
/* Window */
|
||||
#ifndef Q_OS_MAC
|
||||
|
||||
@@ -122,11 +122,6 @@ void OptionsModel::Init()
|
||||
// Only try to set -proxy, if user has enabled fUseProxy
|
||||
if (settings.value("fUseProxy").toBool() && !SoftSetArg("-proxy", settings.value("addrProxy").toString().toStdString()))
|
||||
addOverriddenOption("-proxy");
|
||||
if (!settings.contains("nSocksVersion"))
|
||||
settings.setValue("nSocksVersion", 5);
|
||||
// Only try to set -socks, if user has enabled fUseProxy
|
||||
if (settings.value("fUseProxy").toBool() && !SoftSetArg("-socks", settings.value("nSocksVersion").toString().toStdString()))
|
||||
addOverriddenOption("-socks");
|
||||
|
||||
// Display
|
||||
if (!settings.contains("language"))
|
||||
@@ -188,8 +183,6 @@ QVariant OptionsModel::data(const QModelIndex & index, int role) const
|
||||
QStringList strlIpPort = settings.value("addrProxy").toString().split(":", QString::SkipEmptyParts);
|
||||
return strlIpPort.at(1);
|
||||
}
|
||||
case ProxySocksVersion:
|
||||
return settings.value("nSocksVersion", 5);
|
||||
|
||||
#ifdef ENABLE_WALLET
|
||||
case Fee: {
|
||||
@@ -284,13 +277,6 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ProxySocksVersion: {
|
||||
if (settings.value("nSocksVersion") != value) {
|
||||
settings.setValue("nSocksVersion", value.toInt());
|
||||
setRestartRequired(true);
|
||||
}
|
||||
}
|
||||
break;
|
||||
#ifdef ENABLE_WALLET
|
||||
case Fee: { // core option - can be changed on-the-fly
|
||||
// Todo: Add is valid check and warn via message, if not
|
||||
@@ -378,20 +364,16 @@ bool OptionsModel::getProxySettings(QNetworkProxy& proxy) const
|
||||
// GUI settings can be overridden with -proxy.
|
||||
proxyType curProxy;
|
||||
if (GetProxy(NET_IPV4, curProxy)) {
|
||||
if (curProxy.second == 5) {
|
||||
proxy.setType(QNetworkProxy::Socks5Proxy);
|
||||
proxy.setHostName(QString::fromStdString(curProxy.first.ToStringIP()));
|
||||
proxy.setPort(curProxy.first.GetPort());
|
||||
proxy.setType(QNetworkProxy::Socks5Proxy);
|
||||
proxy.setHostName(QString::fromStdString(curProxy.ToStringIP()));
|
||||
proxy.setPort(curProxy.GetPort());
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
proxy.setType(QNetworkProxy::NoProxy);
|
||||
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
void OptionsModel::setRestartRequired(bool fRequired)
|
||||
|
||||
@@ -341,20 +341,14 @@ void PaymentServer::initNetManager()
|
||||
|
||||
QNetworkProxy proxy;
|
||||
|
||||
// Query active proxy (fails if no SOCKS5 proxy)
|
||||
// Query active SOCKS5 proxy
|
||||
if (optionsModel->getProxySettings(proxy)) {
|
||||
if (proxy.type() == QNetworkProxy::Socks5Proxy) {
|
||||
netManager->setProxy(proxy);
|
||||
netManager->setProxy(proxy);
|
||||
|
||||
qDebug() << "PaymentServer::initNetManager : Using SOCKS5 proxy" << proxy.hostName() << ":" << proxy.port();
|
||||
}
|
||||
else
|
||||
qDebug() << "PaymentServer::initNetManager : No active proxy server found.";
|
||||
qDebug() << "PaymentServer::initNetManager : Using SOCKS5 proxy" << proxy.hostName() << ":" << proxy.port();
|
||||
}
|
||||
else
|
||||
emit message(tr("Net manager warning"),
|
||||
tr("Your active proxy doesn't support SOCKS5, which is required for payment requests via proxy."),
|
||||
CClientUIInterface::MSG_WARNING);
|
||||
qDebug() << "PaymentServer::initNetManager : No active proxy server found.";
|
||||
|
||||
connect(netManager, SIGNAL(finished(QNetworkReply*)),
|
||||
this, SLOT(netRequestFinished(QNetworkReply*)));
|
||||
|
||||
Reference in New Issue
Block a user