mirror of
https://github.com/chenx-dust/EZ4Connect.git
synced 2026-09-20 10:23:33 +08:00
Revert "refactor: 移除不再被使用的 TCPTunnelMode"
This reverts commit d1e6161558.
This commit is contained in:
@@ -8,7 +8,7 @@ namespace ApplicationConstants
|
||||
const inline QString RepositoryName("chenx-dust/EZ4Connect");
|
||||
const inline QString CoreRepositoryName("Mythologyli/zju-connect");
|
||||
const inline QString ApplicationName("EZ4Connect");
|
||||
constexpr inline int ConfigVersion = 9;
|
||||
constexpr inline int ConfigVersion = 8;
|
||||
}
|
||||
|
||||
#endif // APPLICATIONCONSTANTS_H
|
||||
|
||||
@@ -56,6 +56,7 @@ void DefaultSettings::reset(QSettings &settings)
|
||||
settings.setValue("ZJUConnect/AddRoute", false);
|
||||
settings.setValue("ZJUConnect/DNSHijack", false);
|
||||
settings.setValue("ZJUConnect/FakeIP", false);
|
||||
settings.setValue("ZJUConnect/TCPTunnelMode", false);
|
||||
settings.setValue("ZJUConnect/AutoDetectInterface", false);
|
||||
|
||||
settings.setValue("ZJUConnect/TCPPortForwarding", "");
|
||||
|
||||
@@ -22,11 +22,6 @@ SettingsMigrationAction SettingsMigrator::prepare(QSettings &settings)
|
||||
{
|
||||
return SettingsMigrationAction::MigrateAutoStart;
|
||||
}
|
||||
if (configVersion == 8)
|
||||
{
|
||||
settings.remove("ZJUConnect/TCPTunnelMode");
|
||||
return SettingsMigrationAction::None;
|
||||
}
|
||||
if (configVersion < ApplicationConstants::ConfigVersion)
|
||||
{
|
||||
return SettingsMigrationAction::RecommendReset;
|
||||
|
||||
@@ -49,6 +49,7 @@ struct TunnelOptions
|
||||
bool addRoute = false;
|
||||
bool dnsHijack = false;
|
||||
bool fakeIp = false;
|
||||
bool tcpTunnelMode = false;
|
||||
QString tcpPortForwarding;
|
||||
QString udpPortForwarding;
|
||||
};
|
||||
|
||||
@@ -217,6 +217,10 @@ CoreCommand CoreCommandBuilder::build(const ConnectionProfile &profile, const Co
|
||||
arguments << "-add-route";
|
||||
}
|
||||
}
|
||||
if (profile.tunnel.tcpTunnelMode)
|
||||
{
|
||||
arguments << "-tcp-tunnel-mode";
|
||||
}
|
||||
if (profile.debug.detailedOutput)
|
||||
{
|
||||
arguments << "-debug-dump";
|
||||
|
||||
@@ -73,6 +73,7 @@ ConnectionProfile SettingsProfileLoader::load(
|
||||
settings.value("ZJUConnect/AddRoute").toBool(),
|
||||
settings.value("ZJUConnect/DNSHijack").toBool(),
|
||||
settings.value("ZJUConnect/FakeIP").toBool(),
|
||||
settings.value("ZJUConnect/TCPTunnelMode").toBool(),
|
||||
settings.value("ZJUConnect/TCPPortForwarding").toString(),
|
||||
settings.value("ZJUConnect/UDPPortForwarding").toString()
|
||||
};
|
||||
|
||||
@@ -288,6 +288,7 @@ void SettingWindow::loadSettings()
|
||||
ui->routeCheckBox->setChecked(settings->value("ZJUConnect/AddRoute").toBool());
|
||||
ui->dnsHijackCheckBox->setChecked(settings->value("ZJUConnect/DNSHijack").toBool());
|
||||
ui->fakeIPCheckBox->setChecked(settings->value("ZJUConnect/FakeIP").toBool());
|
||||
ui->tcpTunnelModeCheckBox->setChecked(settings->value("ZJUConnect/TCPTunnelMode").toBool());
|
||||
ui->autoDetectInterfaceCheckBox->setChecked(settings->value("ZJUConnect/AutoDetectInterface", false).toBool());
|
||||
|
||||
tcpPortForwarding = settings->value("ZJUConnect/TCPPortForwarding").toString();
|
||||
@@ -384,7 +385,7 @@ void SettingWindow::applySettings()
|
||||
settings->setValue("ZJUConnect/AddRoute", ui->routeCheckBox->isChecked());
|
||||
settings->setValue("ZJUConnect/DNSHijack", ui->dnsHijackCheckBox->isChecked());
|
||||
settings->setValue("ZJUConnect/FakeIP", ui->fakeIPCheckBox->isChecked());
|
||||
settings->remove("ZJUConnect/TCPTunnelMode");
|
||||
settings->setValue("ZJUConnect/TCPTunnelMode", ui->tcpTunnelModeCheckBox->isChecked());
|
||||
settings->setValue("ZJUConnect/AutoDetectInterface", ui->autoDetectInterfaceCheckBox->isChecked());
|
||||
|
||||
|
||||
|
||||
@@ -915,6 +915,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QCheckBox" name="tcpTunnelModeCheckBox">
|
||||
<property name="text">
|
||||
<string>禁用 L3 隧道</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="QCheckBox" name="autoDetectInterfaceCheckBox">
|
||||
<property name="toolTip">
|
||||
|
||||
@@ -83,7 +83,7 @@ bool buildsCompleteCommandInCompatibleOrder()
|
||||
profile.dns = {"10.0.0.1", false, "10.0.0.2", 60, true, "example.org=1.1.1.1"};
|
||||
profile.proxy = {"127.0.0.1:1080", "127.0.0.1:1081", "ss://url", "http://direct",
|
||||
true, "example.org"};
|
||||
profile.tunnel = {true, true, true, true, "127.0.0.1:80/10.0.0.1:80",
|
||||
profile.tunnel = {true, true, true, true, true, "127.0.0.1:80/10.0.0.1:80",
|
||||
"127.0.0.1:53/10.0.0.1:53"};
|
||||
profile.behavior = {30, true, true, "https://keepalive", "en0", true, true, true,
|
||||
true};
|
||||
@@ -121,6 +121,7 @@ bool buildsCompleteCommandInCompatibleOrder()
|
||||
"-dns-hijack",
|
||||
"-fake-ip",
|
||||
"-add-route",
|
||||
"-tcp-tunnel-mode",
|
||||
"-debug-dump",
|
||||
"-debug-pcap-file", "/tmp/debug capture.pcap",
|
||||
"-debug-tls-log-file", "/tmp/debug capture.keys.log",
|
||||
|
||||
@@ -38,29 +38,10 @@ bool recommendsResetForUnsupportedVersions()
|
||||
}
|
||||
return passed;
|
||||
}
|
||||
|
||||
bool removesTcpTunnelModeFromVersionEightProfiles()
|
||||
{
|
||||
QTemporaryDir directory;
|
||||
QSettings settings(directory.filePath("profile.ini"), QSettings::IniFormat);
|
||||
settings.setValue("Common/ConfigVersion", 8);
|
||||
settings.setValue("ZJUConnect/TCPTunnelMode", true);
|
||||
|
||||
const bool passed =
|
||||
SettingsMigrator::prepare(settings) == SettingsMigrationAction::None
|
||||
&& !settings.contains("ZJUConnect/TCPTunnelMode");
|
||||
if (!passed)
|
||||
{
|
||||
qCritical() << "removesTcpTunnelModeFromVersionEightProfiles failed";
|
||||
}
|
||||
return passed;
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QCoreApplication app(argc, argv);
|
||||
return migratesKnownVersions()
|
||||
&& recommendsResetForUnsupportedVersions()
|
||||
&& removesTcpTunnelModeFromVersionEightProfiles() ? 0 : 1;
|
||||
return migratesKnownVersions() && recommendsResetForUnsupportedVersions() ? 0 : 1;
|
||||
}
|
||||
|
||||
@@ -47,6 +47,7 @@ bool loadsSettingsIntoTypedProfile()
|
||||
settings.setValue("ZJUConnect/AddRoute", true);
|
||||
settings.setValue("ZJUConnect/DNSHijack", true);
|
||||
settings.setValue("ZJUConnect/FakeIP", true);
|
||||
settings.setValue("ZJUConnect/TCPTunnelMode", true);
|
||||
settings.setValue("ZJUConnect/TCPPortForwarding", "tcp-forward");
|
||||
settings.setValue("ZJUConnect/UDPPortForwarding", "udp-forward");
|
||||
settings.setValue("ZJUConnect/UpdateBestNodesInterval", 30);
|
||||
@@ -97,6 +98,7 @@ bool loadsSettingsIntoTypedProfile()
|
||||
&& profile.tunnel.addRoute
|
||||
&& profile.tunnel.dnsHijack
|
||||
&& profile.tunnel.fakeIp
|
||||
&& profile.tunnel.tcpTunnelMode
|
||||
&& profile.tunnel.tcpPortForwarding == "tcp-forward"
|
||||
&& profile.tunnel.udpPortForwarding == "udp-forward"
|
||||
&& profile.behavior.updateBestNodesInterval == 30
|
||||
|
||||
Reference in New Issue
Block a user