mirror of
https://github.com/Qv2ray/Qv2ray.git
synced 2025-05-20 02:40:20 +08:00
add: add support for mKCP seed
This commit is contained in:
parent
807f2e5c6f
commit
b2543860f8
@ -1 +1 @@
|
||||
Subproject commit d2c82df0a82b58c8b1466bb2457e7e2e2138256c
|
||||
Subproject commit 91c3ca1c3279448052b6be19dc8157517c35a7ca
|
@ -1 +1 @@
|
||||
5594
|
||||
5595
|
||||
|
@ -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))
|
||||
};
|
||||
//
|
||||
//
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -80,6 +80,8 @@ class StreamSettingsWidget
|
||||
|
||||
void on_allowInsecureCiphersCB_stateChanged(int arg1);
|
||||
|
||||
void on_kcpSeedTxt_textEdited(const QString &arg1);
|
||||
|
||||
private:
|
||||
QvMessageBusSlotDecl;
|
||||
StreamSettingsObject stream;
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>384</width>
|
||||
<height>422</height>
|
||||
<width>455</width>
|
||||
<height>501</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -437,18 +437,15 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0" colspan="2">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="label_13">
|
||||
<property name="text">
|
||||
<string>Seed (Experimental)</string>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QLineEdit" name="kcpSeedTxt"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
@ -155,7 +155,7 @@
|
||||
<item row="1" column="1">
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="title">
|
||||
|
Loading…
Reference in New Issue
Block a user