mirror of
https://github.com/Qv2ray/Qv2ray.git
synced 2025-05-19 10:20:49 +08:00
add: test adding allowInsecure allowInsecureCipher
This commit is contained in:
parent
b16140c879
commit
cca5a56643
@ -257,13 +257,14 @@ namespace Qv2ray::base::objects
|
|||||||
{
|
{
|
||||||
QString serverName;
|
QString serverName;
|
||||||
bool allowInsecure;
|
bool allowInsecure;
|
||||||
|
bool allowInsecureCiphers;
|
||||||
QList<QString> alpn;
|
QList<QString> alpn;
|
||||||
QList<CertificateObject> certificates;
|
QList<CertificateObject> certificates;
|
||||||
bool disableSystemRoot;
|
bool disableSystemRoot;
|
||||||
TLSObject() : serverName(), allowInsecure(), certificates(), disableSystemRoot()
|
TLSObject() : serverName(), allowInsecure(), allowInsecureCiphers(), certificates(), disableSystemRoot()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
XTOSTRUCT(O(serverName, allowInsecure, alpn, certificates, disableSystemRoot))
|
XTOSTRUCT(O(serverName, allowInsecure, allowInsecureCiphers, alpn, certificates, disableSystemRoot))
|
||||||
};
|
};
|
||||||
} // namespace transfer
|
} // namespace transfer
|
||||||
//
|
//
|
||||||
|
@ -217,8 +217,9 @@ namespace Qv2ray::base::config
|
|||||||
struct Qv2rayAdvancedConfig
|
struct Qv2rayAdvancedConfig
|
||||||
{
|
{
|
||||||
bool setAllowInsecure;
|
bool setAllowInsecure;
|
||||||
|
bool setAllowInsecureCiphers;
|
||||||
bool testLatencyPeriodcally;
|
bool testLatencyPeriodcally;
|
||||||
XTOSTRUCT(O(setAllowInsecure, testLatencyPeriodcally))
|
XTOSTRUCT(O(setAllowInsecure, setAllowInsecureCiphers, testLatencyPeriodcally))
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Qv2rayNetworkConfig
|
struct Qv2rayNetworkConfig
|
||||||
|
@ -16,6 +16,22 @@ namespace Qv2ray::core::connection
|
|||||||
if (link.startsWith("vmess://"))
|
if (link.startsWith("vmess://"))
|
||||||
{
|
{
|
||||||
auto conf = ConvertConfigFromVMessString(link, prefix, errMessage);
|
auto conf = ConvertConfigFromVMessString(link, prefix, errMessage);
|
||||||
|
//
|
||||||
|
if (GlobalConfig.advancedConfig.setAllowInsecureCiphers || GlobalConfig.advancedConfig.setAllowInsecure)
|
||||||
|
{
|
||||||
|
auto outbound = conf["outbounds"].toArray().first().toObject();
|
||||||
|
auto streamSettings = outbound["streamSettings"].toObject();
|
||||||
|
auto tlsSettings = streamSettings["tlsSettings"].toObject();
|
||||||
|
tlsSettings["allowInsecure"] = GlobalConfig.advancedConfig.setAllowInsecure;
|
||||||
|
tlsSettings["allowInsecureCiphers"] = GlobalConfig.advancedConfig.setAllowInsecureCiphers;
|
||||||
|
streamSettings["tlsSettings"] = tlsSettings;
|
||||||
|
outbound["streamSettings"] = streamSettings;
|
||||||
|
//
|
||||||
|
auto outbounds = conf["outbounds"].toArray();
|
||||||
|
outbounds[0] = outbound;
|
||||||
|
conf["outbounds"] = outbounds;
|
||||||
|
}
|
||||||
|
//
|
||||||
connectionConf.insert(*prefix, conf);
|
connectionConf.insert(*prefix, conf);
|
||||||
}
|
}
|
||||||
else if (link.startsWith("ss://"))
|
else if (link.startsWith("ss://"))
|
||||||
|
@ -13,7 +13,7 @@ namespace Qv2ray::core::handlers
|
|||||||
DEBUG(MODULE_CORE_HANDLER, "ConnectionHandler Constructor.")
|
DEBUG(MODULE_CORE_HANDLER, "ConnectionHandler Constructor.")
|
||||||
|
|
||||||
// Do we need to check how many of them are loaded?
|
// Do we need to check how many of them are loaded?
|
||||||
// Do not use: for (const auto &key : connections)
|
// Do not use: for (const auto &key : connections), why?
|
||||||
for (auto i = 0; i < GlobalConfig.connections.count(); i++)
|
for (auto i = 0; i < GlobalConfig.connections.count(); i++)
|
||||||
{
|
{
|
||||||
auto const &id = ConnectionId(GlobalConfig.connections.keys().at(i));
|
auto const &id = ConnectionId(GlobalConfig.connections.keys().at(i));
|
||||||
@ -87,10 +87,9 @@ namespace Qv2ray::core::handlers
|
|||||||
httpHelper = new QvHttpRequestHelper(this);
|
httpHelper = new QvHttpRequestHelper(this);
|
||||||
connect(tcpingHelper, &QvTCPingHelper::OnLatencyTestCompleted, this, &QvConfigHandler::OnLatencyDataArrived_p);
|
connect(tcpingHelper, &QvTCPingHelper::OnLatencyTestCompleted, this, &QvConfigHandler::OnLatencyDataArrived_p);
|
||||||
//
|
//
|
||||||
// Save per 2 minutes.
|
// Save per 1 minutes.
|
||||||
saveTimerId = startTimer(2 * 60 * 1000);
|
saveTimerId = startTimer(1 * 60 * 1000);
|
||||||
// Do not ping all...
|
// Do not ping all...
|
||||||
// pingAllTimerId = startTimer(5 * 60 * 1000);
|
|
||||||
pingConnectionTimerId = startTimer(60 * 1000);
|
pingConnectionTimerId = startTimer(60 * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,7 +140,7 @@ namespace Qv2ray::core::handlers
|
|||||||
else if (event->timerId() == pingConnectionTimerId)
|
else if (event->timerId() == pingConnectionTimerId)
|
||||||
{
|
{
|
||||||
auto id = kernelHandler->CurrentConnection();
|
auto id = kernelHandler->CurrentConnection();
|
||||||
if (id != NullConnectionId)
|
if (id != NullConnectionId && GlobalConfig.advancedConfig.testLatencyPeriodcally)
|
||||||
{
|
{
|
||||||
StartLatencyTest(id);
|
StartLatencyTest(id);
|
||||||
}
|
}
|
||||||
|
@ -139,6 +139,7 @@ PreferencesWindow::PreferencesWindow(QWidget *parent) : QDialog(parent), Current
|
|||||||
//
|
//
|
||||||
// Advanced config.
|
// Advanced config.
|
||||||
setAllowInsecureCB->setChecked(CurrentConfig.advancedConfig.setAllowInsecure);
|
setAllowInsecureCB->setChecked(CurrentConfig.advancedConfig.setAllowInsecure);
|
||||||
|
setAllowInsecureCiphersCB->setChecked(CurrentConfig.advancedConfig.setAllowInsecureCiphers);
|
||||||
setTestLatenctCB->setChecked(CurrentConfig.advancedConfig.testLatencyPeriodcally);
|
setTestLatenctCB->setChecked(CurrentConfig.advancedConfig.testLatencyPeriodcally);
|
||||||
//
|
//
|
||||||
DNSListTxt->clear();
|
DNSListTxt->clear();
|
||||||
@ -1156,13 +1157,29 @@ void PreferencesWindow::on_qvUseProxyCB_stateChanged(int arg1)
|
|||||||
void PreferencesWindow::on_setAllowInsecureCB_stateChanged(int arg1)
|
void PreferencesWindow::on_setAllowInsecureCB_stateChanged(int arg1)
|
||||||
{
|
{
|
||||||
LOADINGCHECK
|
LOADINGCHECK
|
||||||
QvMessageBoxWarn(this, tr("Dangerous Operation"), tr("You may under MITM attack, which is just what TLS is protective for."));
|
if (arg1 == Qt::Checked)
|
||||||
|
{
|
||||||
|
QvMessageBoxWarn(this, tr("Dangerous Operation"), tr("You will lose the advantage of TLS and make your connection under MITM attack."));
|
||||||
|
}
|
||||||
CurrentConfig.advancedConfig.setAllowInsecure = arg1 == Qt::Checked;
|
CurrentConfig.advancedConfig.setAllowInsecure = arg1 == Qt::Checked;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreferencesWindow::on_setTestLatenctCB_stateChanged(int arg1)
|
void PreferencesWindow::on_setTestLatenctCB_stateChanged(int arg1)
|
||||||
{
|
{
|
||||||
LOADINGCHECK
|
LOADINGCHECK
|
||||||
|
if (arg1 == Qt::Checked)
|
||||||
|
{
|
||||||
QvMessageBoxWarn(this, tr("Dangerous Operation"), tr("This will (probably) makes it easy to fingerprint your connection."));
|
QvMessageBoxWarn(this, tr("Dangerous Operation"), tr("This will (probably) makes it easy to fingerprint your connection."));
|
||||||
|
}
|
||||||
CurrentConfig.advancedConfig.testLatencyPeriodcally = arg1 == Qt::Checked;
|
CurrentConfig.advancedConfig.testLatencyPeriodcally = arg1 == Qt::Checked;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PreferencesWindow::on_setAllowInsecureCiphersCB_stateChanged(int arg1)
|
||||||
|
{
|
||||||
|
LOADINGCHECK
|
||||||
|
if (arg1 == Qt::Checked)
|
||||||
|
{
|
||||||
|
QvMessageBoxWarn(this, tr("Dangerous Operation"), tr("You will lose the advantage of TLS and make your connection under MITM attack."));
|
||||||
|
}
|
||||||
|
CurrentConfig.advancedConfig.setAllowInsecureCiphers = arg1 == Qt::Checked;
|
||||||
|
}
|
||||||
|
@ -174,6 +174,8 @@ class PreferencesWindow
|
|||||||
|
|
||||||
void on_setTestLatenctCB_stateChanged(int arg1);
|
void on_setTestLatenctCB_stateChanged(int arg1);
|
||||||
|
|
||||||
|
void on_setAllowInsecureCiphersCB_stateChanged(int arg1);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//
|
//
|
||||||
RouteSettingsMatrixWidget *routeSettingsWidget;
|
RouteSettingsMatrixWidget *routeSettingsWidget;
|
||||||
|
@ -347,14 +347,14 @@ This could resolve the certificate issues, but also could let one performing TLS
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="3" column="0">
|
||||||
<widget class="QLabel" name="label_83">
|
<widget class="QLabel" name="label_83">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Test Latency Periodcally</string>
|
<string>Test Latency Periodcally</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
<item row="3" column="1">
|
||||||
<widget class="QCheckBox" name="setTestLatenctCB">
|
<widget class="QCheckBox" name="setTestLatenctCB">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Run TCPing or ICMPing periodcally after connecting to a server.
|
<string>Run TCPing or ICMPing periodcally after connecting to a server.
|
||||||
@ -383,6 +383,20 @@ But could damage your server if improperly used.</string>
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="label_85">
|
||||||
|
<property name="text">
|
||||||
|
<string>AllowInsecureCiphers By Default</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QCheckBox" name="setAllowInsecureCiphersCB">
|
||||||
|
<property name="text">
|
||||||
|
<string>Enabled</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -22,7 +22,7 @@ QvMessageBusSlotImpl(StreamSettingsWidget)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StreamSettingsObject StreamSettingsWidget::GetStreamSettings()
|
StreamSettingsObject StreamSettingsWidget::GetStreamSettings() const
|
||||||
{
|
{
|
||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
@ -36,6 +36,7 @@ void StreamSettingsWidget::SetStreamObject(const StreamSettingsObject &sso)
|
|||||||
tlsCB->setChecked(stream.security == "tls");
|
tlsCB->setChecked(stream.security == "tls");
|
||||||
serverNameTxt->setText(stream.tlsSettings.serverName);
|
serverNameTxt->setText(stream.tlsSettings.serverName);
|
||||||
allowInsecureCB->setChecked(stream.tlsSettings.allowInsecure);
|
allowInsecureCB->setChecked(stream.tlsSettings.allowInsecure);
|
||||||
|
allowInsecureCiphersCB->setChecked(stream.tlsSettings.allowInsecureCiphers);
|
||||||
alpnTxt->setPlainText(stream.tlsSettings.alpn.join(NEWLINE));
|
alpnTxt->setPlainText(stream.tlsSettings.alpn.join(NEWLINE));
|
||||||
// TCP
|
// TCP
|
||||||
tcpHeaderTypeCB->setCurrentText(stream.tcpSettings.header.type);
|
tcpHeaderTypeCB->setCurrentText(stream.tcpSettings.header.type);
|
||||||
@ -47,9 +48,9 @@ void StreamSettingsWidget::SetStreamObject(const StreamSettingsObject &sso)
|
|||||||
// WS
|
// WS
|
||||||
wsPathTxt->setText(stream.wsSettings.path);
|
wsPathTxt->setText(stream.wsSettings.path);
|
||||||
QString wsHeaders;
|
QString wsHeaders;
|
||||||
for (auto index = 0; index < stream.wsSettings.headers.count(); index++)
|
for (auto i = 0; i < stream.wsSettings.headers.count(); i++)
|
||||||
{
|
{
|
||||||
wsHeaders = wsHeaders % stream.wsSettings.headers.keys().at(index) % "|" % stream.wsSettings.headers.values().at(index) % NEWLINE;
|
wsHeaders = wsHeaders % stream.wsSettings.headers.keys().at(i) % "|" % stream.wsSettings.headers.values().at(i) % NEWLINE;
|
||||||
}
|
}
|
||||||
|
|
||||||
wsHeadersTxt->setPlainText(wsHeaders);
|
wsHeadersTxt->setPlainText(wsHeaders);
|
||||||
@ -284,3 +285,8 @@ void StreamSettingsWidget::on_alpnTxt_textChanged()
|
|||||||
{
|
{
|
||||||
stream.tlsSettings.alpn = SplitLines(alpnTxt->toPlainText());
|
stream.tlsSettings.alpn = SplitLines(alpnTxt->toPlainText());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void StreamSettingsWidget::on_allowInsecureCiphersCB_stateChanged(int arg1)
|
||||||
|
{
|
||||||
|
stream.tlsSettings.allowInsecureCiphers = arg1 == Qt::Checked;
|
||||||
|
}
|
||||||
|
@ -14,7 +14,7 @@ class StreamSettingsWidget
|
|||||||
public:
|
public:
|
||||||
explicit StreamSettingsWidget(QWidget *parent = nullptr);
|
explicit StreamSettingsWidget(QWidget *parent = nullptr);
|
||||||
void SetStreamObject(const StreamSettingsObject &sso);
|
void SetStreamObject(const StreamSettingsObject &sso);
|
||||||
StreamSettingsObject GetStreamSettings();
|
StreamSettingsObject GetStreamSettings() const;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_httpPathTxt_textEdited(const QString &arg1);
|
void on_httpPathTxt_textEdited(const QString &arg1);
|
||||||
@ -77,6 +77,8 @@ class StreamSettingsWidget
|
|||||||
|
|
||||||
void on_alpnTxt_textChanged();
|
void on_alpnTxt_textChanged();
|
||||||
|
|
||||||
|
void on_allowInsecureCiphersCB_stateChanged(int arg1);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QvMessageBusSlotDecl;
|
QvMessageBusSlotDecl;
|
||||||
StreamSettingsObject stream;
|
StreamSettingsObject stream;
|
||||||
|
@ -635,37 +635,37 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="3" column="0">
|
||||||
<widget class="QLabel" name="label_6">
|
<widget class="QLabel" name="label_6">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Server</string>
|
<string>Server</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
<item row="3" column="1">
|
||||||
<widget class="QLineEdit" name="serverNameTxt"/>
|
<widget class="QLineEdit" name="serverNameTxt"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="4" column="0">
|
||||||
<widget class="QLabel" name="label_14">
|
<widget class="QLabel" name="label_14">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>ALPN</string>
|
<string>ALPN</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="1">
|
<item row="4" column="1">
|
||||||
<widget class="QPlainTextEdit" name="alpnTxt"/>
|
<widget class="QPlainTextEdit" name="alpnTxt"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0" colspan="2">
|
||||||
<widget class="QLabel" name="label_13">
|
<widget class="QCheckBox" name="tlsCB">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>TLS</string>
|
<string>Enable TLS</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="2" column="0" colspan="2">
|
||||||
<widget class="QCheckBox" name="tlsCB">
|
<widget class="QCheckBox" name="allowInsecureCiphersCB">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Enabled</string>
|
<string>Allow Insecure Ciphers</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
Loading…
Reference in New Issue
Block a user