diff --git a/libs/QJsonStruct b/libs/QJsonStruct index d2c82df0..91c3ca1c 160000 --- a/libs/QJsonStruct +++ b/libs/QJsonStruct @@ -1 +1 @@ -Subproject commit d2c82df0a82b58c8b1466bb2457e7e2e2138256c +Subproject commit 91c3ca1c3279448052b6be19dc8157517c35a7ca diff --git a/makespec/BUILDVERSION b/makespec/BUILDVERSION index 21c566e1..10a409ec 100644 --- a/makespec/BUILDVERSION +++ b/makespec/BUILDVERSION @@ -1 +1 @@ -5594 +5595 diff --git a/src/base/models/CoreObjectModels.hpp b/src/base/models/CoreObjectModels.hpp index f15c0067..8d541332 100644 --- a/src/base/models/CoreObjectModels.hpp +++ b/src/base/models/CoreObjectModels.hpp @@ -190,9 +190,11 @@ namespace Qv2ray::base::objects bool congestion = false; int readBufferSize = 1; int writeBufferSize = 1; + QString seed; HeaderObject header; KCPObject() : header(){}; - JSONSTRUCT_REGISTER(KCPObject, F(mtu, tti, uplinkCapacity, downlinkCapacity, congestion, readBufferSize, writeBufferSize, header)) + JSONSTRUCT_REGISTER(KCPObject, + F(mtu, tti, uplinkCapacity, downlinkCapacity, congestion, readBufferSize, writeBufferSize, header, seed)) }; // // diff --git a/src/core/connection/Generation.hpp b/src/core/connection/Generation.hpp index 7841adb1..ff763e2e 100644 --- a/src/core/connection/Generation.hpp +++ b/src/core/connection/Generation.hpp @@ -53,6 +53,7 @@ namespace Qv2ray::core::connection::generation void OutboundMarkSettingFilter(const int mark, CONFIGROOT &root); void DNSInterceptFilter(CONFIGROOT &root, const bool have_ipv6); void BypassBTFilter(CONFIGROOT &root); + void mKCPSeedFilter(CONFIGROOT &root); } // namespace filters } // namespace Qv2ray::core::connection::generation diff --git a/src/core/connection/generation/filters.cpp b/src/core/connection/generation/filters.cpp index 5d5ed7b7..0bfaa59c 100644 --- a/src/core/connection/generation/filters.cpp +++ b/src/core/connection/generation/filters.cpp @@ -14,13 +14,18 @@ namespace Qv2ray::core::connection::generation::filters // Static DNS Objects static const QJsonObject dnsOutboundObj{ { "protocol", "dns" }, { "tag", "dns-out" } }; QJsonArray dnsRouteInTag; - if (have_ipv6){ + if (have_ipv6) + { dnsRouteInTag = QJsonArray{ "tproxy_IN", "tproxy_IN_V6" }; } - else{ + else + { dnsRouteInTag = QJsonArray{ "tproxy_IN" }; } - static const QJsonObject dnsRoutingRuleObj{ { "outboundTag", "dns-out" }, { "port", "53" }, { "type", "field" }, { "inboundTag", dnsRouteInTag } }; + static const QJsonObject dnsRoutingRuleObj{ { "outboundTag", "dns-out" }, + { "port", "53" }, + { "type", "field" }, + { "inboundTag", dnsRouteInTag } }; // DNS Outbound QJsonIO::SetValue(root, dnsOutboundObj, "outbounds", root["outbounds"].toArray().count()); // DNS Route @@ -38,4 +43,20 @@ namespace Qv2ray::core::connection::generation::filters _rules.insert(0, bypassBTRuleObj); QJsonIO::SetValue(root, _rules, "routing", "rules"); } + + void mKCPSeedFilter(CONFIGROOT &root) + { + const auto outboundCount = root["outbounds"].toArray().count(); + for (auto i = 0; i < outboundCount; i++) + { + bool isKCP = QJsonIO::GetValue(root, "outbounds", i, "streamSettings", "network").toString() == "kcp"; + if (isKCP) + { + bool isEmptySeed = QJsonIO::GetValue(root, "outbounds", i, "streamSettings", "kcpSettings", "seed").toString().isEmpty(); + if (isEmptySeed) + QJsonIO::SetValue(root, QJsonIO::Undefined, "outbounds", i, "streamSettings", "kcpSettings", "seed"); + } + } + } + } // namespace Qv2ray::core::connection::generation::filters diff --git a/src/core/handler/RouteHandler.cpp b/src/core/handler/RouteHandler.cpp index c0f55b9e..5ca8ec85 100644 --- a/src/core/handler/RouteHandler.cpp +++ b/src/core/handler/RouteHandler.cpp @@ -213,7 +213,7 @@ namespace Qv2ray::core::handler { "enabled", true }, // { "destOverride", QJsonArray{ "http", "tls" } } // }); - tProxyIn.insert("streamSettings", QJsonObject{ { "sockopt", QJsonObject{ { "tproxy", INCONF.tProxySettings.mode } } } }); + tProxyIn.insert("streamSettings", { { "sockopt", { { "tproxy", INCONF.tProxySettings.mode } } } }); inboundsList.append(tProxyIn); } // @@ -229,8 +229,7 @@ namespace Qv2ray::core::handler { "enabled", true }, // { "destOverride", QJsonArray{ "http", "tls" } } // }); - tProxyIn.insert("streamSettings", QJsonObject{ { "sockopt", QJsonObject{ { "tproxy", INCONF.tProxySettings.mode } } } }); - + tProxyIn.insert("streamSettings", { { "sockopt", { { "tproxy", INCONF.tProxySettings.mode } } } }); inboundsList.append(tProxyIn); } } @@ -387,6 +386,8 @@ namespace Qv2ray::core::handler { BypassBTFilter(root); } + // Process mKCP seed. + mKCPSeedFilter(root); } } diff --git a/src/ui/widgets/StreamSettingsWidget.cpp b/src/ui/widgets/StreamSettingsWidget.cpp index 4fdd6312..1813b203 100644 --- a/src/ui/widgets/StreamSettingsWidget.cpp +++ b/src/ui/widgets/StreamSettingsWidget.cpp @@ -13,12 +13,10 @@ QvMessageBusSlotImpl(StreamSettingsWidget) { switch (msg) { + MBRetranslateDefaultImpl; case UPDATE_COLORSCHEME: case HIDE_WINDOWS: - case SHOW_WINDOWS: - break; - // - MBRetranslateDefaultImpl + case SHOW_WINDOWS: break; } } @@ -63,6 +61,7 @@ void StreamSettingsWidget::SetStreamObject(const StreamSettingsObject &sso) kcpUploadCapacSB->setValue(stream.kcpSettings.uplinkCapacity); kcpDownCapacitySB->setValue(stream.kcpSettings.downlinkCapacity); kcpWriteBufferSB->setValue(stream.kcpSettings.writeBufferSize); + kcpSeedTxt->setText(stream.kcpSettings.seed); // DS dsPathTxt->setText(stream.dsSettings.path); // QUIC @@ -290,3 +289,8 @@ void StreamSettingsWidget::on_allowInsecureCiphersCB_stateChanged(int arg1) { stream.tlsSettings.allowInsecureCiphers = arg1 == Qt::Checked; } + +void StreamSettingsWidget::on_kcpSeedTxt_textEdited(const QString &arg1) +{ + stream.kcpSettings.seed = arg1; +} diff --git a/src/ui/widgets/StreamSettingsWidget.hpp b/src/ui/widgets/StreamSettingsWidget.hpp index 172d89c3..3d5e590a 100644 --- a/src/ui/widgets/StreamSettingsWidget.hpp +++ b/src/ui/widgets/StreamSettingsWidget.hpp @@ -80,6 +80,8 @@ class StreamSettingsWidget void on_allowInsecureCiphersCB_stateChanged(int arg1); + void on_kcpSeedTxt_textEdited(const QString &arg1); + private: QvMessageBusSlotDecl; StreamSettingsObject stream; diff --git a/src/ui/widgets/StreamSettingsWidget.ui b/src/ui/widgets/StreamSettingsWidget.ui index 0b401485..06e57d92 100644 --- a/src/ui/widgets/StreamSettingsWidget.ui +++ b/src/ui/widgets/StreamSettingsWidget.ui @@ -6,8 +6,8 @@ 0 0 - 384 - 422 + 455 + 501 @@ -437,18 +437,15 @@ - - - - Qt::Vertical + + + + Seed (Experimental) - - - 20 - 40 - - - + + + + diff --git a/src/ui/windows/w_GroupManager.ui b/src/ui/windows/w_GroupManager.ui index 22450272..eb99d5d7 100644 --- a/src/ui/windows/w_GroupManager.ui +++ b/src/ui/windows/w_GroupManager.ui @@ -155,7 +155,7 @@ - 2 + 0