feat: add UDP over Stream for TUIC

fix: you can't enable uos with udp_relay_mode
This commit is contained in:
HystericalDragon
2023-08-25 15:32:45 +08:00
committed by arm64v8a
parent 26637883a1
commit ff3696772c
5 changed files with 77 additions and 56 deletions

View File

@@ -204,7 +204,11 @@ namespace NekoGui_fmt {
outbound["uuid"] = uuid; outbound["uuid"] = uuid;
outbound["password"] = password; outbound["password"] = password;
outbound["congestion_control"] = congestionControl; outbound["congestion_control"] = congestionControl;
outbound["udp_relay_mode"] = udpRelayMode; if (uos) {
outbound["udp_over_stream"]= true;
} else {
outbound["udp_relay_mode"] = udpRelayMode;
}
outbound["zero_rtt_handshake"] = zeroRttHandshake; outbound["zero_rtt_handshake"] = zeroRttHandshake;
if (!heartbeat.trimmed().isEmpty()) outbound["heartbeat"] = heartbeat; if (!heartbeat.trimmed().isEmpty()) outbound["heartbeat"] = heartbeat;
} }

View File

@@ -42,6 +42,7 @@ namespace NekoGui_fmt {
QString udpRelayMode = "native"; QString udpRelayMode = "native";
bool zeroRttHandshake = false; bool zeroRttHandshake = false;
QString heartbeat = "10s"; QString heartbeat = "10s";
bool uos = false;
// TLS // TLS
@@ -72,6 +73,7 @@ namespace NekoGui_fmt {
_add(new configItem("udpRelayMode", &udpRelayMode, itemType::string)); _add(new configItem("udpRelayMode", &udpRelayMode, itemType::string));
_add(new configItem("zeroRttHandshake", &zeroRttHandshake, itemType::boolean)); _add(new configItem("zeroRttHandshake", &zeroRttHandshake, itemType::boolean));
_add(new configItem("heartbeat", &heartbeat, itemType::string)); _add(new configItem("heartbeat", &heartbeat, itemType::string));
_add(new configItem("uos", &uos, itemType::boolean));
} }
// TLS // TLS
_add(new configItem("allowInsecure", &allowInsecure, itemType::boolean)); _add(new configItem("allowInsecure", &allowInsecure, itemType::boolean));

View File

@@ -446,6 +446,8 @@ namespace NekoGui_sub {
bean->caText = Node2QString(proxy["ca-str"]); bean->caText = Node2QString(proxy["ca-str"]);
bean->sni = Node2QString(proxy["sni"]); bean->sni = Node2QString(proxy["sni"]);
if (Node2Bool(proxy["udp-over-stream"])) bean->uos = true;
if (!Node2QString(proxy["ip"]).isEmpty()) { if (!Node2QString(proxy["ip"]).isEmpty()) {
if (bean->sni.isEmpty()) bean->sni = bean->serverAddress; if (bean->sni.isEmpty()) bean->sni = bean->serverAddress;
bean->serverAddress = Node2QString(proxy["ip"]); bean->serverAddress = Node2QString(proxy["ip"]);

View File

@@ -44,6 +44,7 @@ void EditQUIC::onStart(std::shared_ptr<NekoGui::ProxyEntity> _ent) {
ui->zeroRttHandshake->hide(); ui->zeroRttHandshake->hide();
ui->heartbeat->hide(); ui->heartbeat->hide();
ui->heartbeat_l->hide(); ui->heartbeat_l->hide();
ui->uos->hide();
} else if (bean->proxy_type == NekoGui_fmt::QUICBean::proxy_TUIC) { } else if (bean->proxy_type == NekoGui_fmt::QUICBean::proxy_TUIC) {
P_LOAD_STRING(uuid); P_LOAD_STRING(uuid);
P_LOAD_STRING(password); P_LOAD_STRING(password);
@@ -51,6 +52,7 @@ void EditQUIC::onStart(std::shared_ptr<NekoGui::ProxyEntity> _ent) {
P_LOAD_COMBO_STRING(udpRelayMode); P_LOAD_COMBO_STRING(udpRelayMode);
P_LOAD_BOOL(zeroRttHandshake); P_LOAD_BOOL(zeroRttHandshake);
P_LOAD_STRING(heartbeat); P_LOAD_STRING(heartbeat);
P_LOAD_BOOL(uos);
ui->hopPort->hide(); ui->hopPort->hide();
ui->hopPort_l->hide(); ui->hopPort_l->hide();
@@ -73,6 +75,9 @@ void EditQUIC::onStart(std::shared_ptr<NekoGui::ProxyEntity> _ent) {
ui->streamReceiveWindow_l->hide(); ui->streamReceiveWindow_l->hide();
ui->connectionReceiveWindow->hide(); ui->connectionReceiveWindow->hide();
ui->connectionReceiveWindow_l->hide(); ui->connectionReceiveWindow_l->hide();
if (!IS_NEKO_BOX) {
ui->uos->hide();
}
} }
// TLS // TLS
@@ -106,6 +111,7 @@ bool EditQUIC::onEnd() {
P_SAVE_COMBO_STRING(udpRelayMode); P_SAVE_COMBO_STRING(udpRelayMode);
P_SAVE_BOOL(zeroRttHandshake); P_SAVE_BOOL(zeroRttHandshake);
P_SAVE_STRING(heartbeat); P_SAVE_STRING(heartbeat);
P_SAVE_BOOL(uos);
// TLS // TLS
P_SAVE_STRING(sni); P_SAVE_STRING(sni);

View File

@@ -16,17 +16,24 @@
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
<layout class="QGridLayout" name="upBox"> <layout class="QGridLayout" name="upBox">
<item row="1" column="1"> <item row="3" column="0">
<layout class="QHBoxLayout" name="downloadMbpsLay"> <layout class="QHBoxLayout" name="heartbeatLay">
<item> <item>
<widget class="QLabel" name="downloadMbps_l"> <widget class="QLabel" name="heartbeat_l">
<property name="text"> <property name="text">
<string>Download (Mbps)</string> <string>Heartbeat</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="MyLineEdit" name="downloadMbps"/> <widget class="MyLineEdit" name="heartbeat">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item> </item>
</layout> </layout>
</item> </item>
@@ -44,31 +51,6 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="2" column="1">
<layout class="QHBoxLayout" name="udpRelayModeLay">
<item>
<widget class="QLabel" name="udpRelayMode_l">
<property name="text">
<string>UDP Relay Mode</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="udpRelayMode">
<item>
<property name="text">
<string notr="true">native</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">quic</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item row="2" column="0"> <item row="2" column="0">
<layout class="QHBoxLayout" name="congestionControlLay"> <layout class="QHBoxLayout" name="congestionControlLay">
<item> <item>
@@ -99,17 +81,17 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="1" column="0"> <item row="1" column="1">
<layout class="QHBoxLayout" name="uploadMbpsLay"> <layout class="QHBoxLayout" name="downloadMbpsLay">
<item> <item>
<widget class="QLabel" name="uploadMbps_l"> <widget class="QLabel" name="downloadMbps_l">
<property name="text"> <property name="text">
<string>Upload (Mbps)</string> <string>Download (Mbps)</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="MyLineEdit" name="uploadMbps"/> <widget class="MyLineEdit" name="downloadMbps"/>
</item> </item>
</layout> </layout>
</item> </item>
@@ -127,6 +109,45 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="uploadMbpsLay">
<item>
<widget class="QLabel" name="uploadMbps_l">
<property name="text">
<string>Upload (Mbps)</string>
</property>
</widget>
</item>
<item>
<widget class="MyLineEdit" name="uploadMbps"/>
</item>
</layout>
</item>
<item row="2" column="1">
<layout class="QHBoxLayout" name="udpRelayModeLay">
<item>
<widget class="QLabel" name="udpRelayMode_l">
<property name="text">
<string>UDP Relay Mode</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="udpRelayMode">
<item>
<property name="text">
<string notr="true">native</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">quic</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item row="3" column="1"> <item row="3" column="1">
<widget class="QCheckBox" name="zeroRttHandshake"> <widget class="QCheckBox" name="zeroRttHandshake">
<property name="text"> <property name="text">
@@ -134,26 +155,12 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0"> <item row="4" column="1">
<layout class="QHBoxLayout" name="heartbeatLay"> <widget class="QCheckBox" name="uos">
<item> <property name="text">
<widget class="QLabel" name="heartbeat_l"> <string>UDP over Stream</string>
<property name="text"> </property>
<string>Heartbeat</string> </widget>
</property>
</widget>
</item>
<item>
<widget class="MyLineEdit" name="heartbeat">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item> </item>
</layout> </layout>
</item> </item>