Add shadowsocks uot option (#560)

This commit is contained in:
tdjnodj
2023-05-02 18:30:49 +08:00
committed by GitHub
parent 7212c6a64c
commit 79ef90f3bf
4 changed files with 55 additions and 41 deletions

View File

@@ -85,6 +85,7 @@ namespace NekoRay::fmt {
outbound["server_port"] = serverPort; outbound["server_port"] = serverPort;
outbound["method"] = method; outbound["method"] = method;
outbound["password"] = password; outbound["password"] = password;
outbound["udp_over_tcp"] = uot;
if (!plugin.trimmed().isEmpty()) { if (!plugin.trimmed().isEmpty()) {
outbound["plugin"] = SubStrBefore(plugin, ";"); outbound["plugin"] = SubStrBefore(plugin, ";");

View File

@@ -9,6 +9,7 @@ namespace NekoRay::fmt {
QString method = "aes-128-gcm"; QString method = "aes-128-gcm";
QString password = ""; QString password = "";
QString plugin = ""; QString plugin = "";
bool uot = false;
QSharedPointer<V2rayStreamSettings> stream = QSharedPointer<V2rayStreamSettings>(new V2rayStreamSettings()); QSharedPointer<V2rayStreamSettings> stream = QSharedPointer<V2rayStreamSettings>(new V2rayStreamSettings());
@@ -16,6 +17,7 @@ namespace NekoRay::fmt {
_add(new configItem("method", &method, itemType::string)); _add(new configItem("method", &method, itemType::string));
_add(new configItem("pass", &password, itemType::string)); _add(new configItem("pass", &password, itemType::string));
_add(new configItem("plugin", &plugin, itemType::string)); _add(new configItem("plugin", &plugin, itemType::string));
_add(new configItem("uot", &uot, itemType::boolean));
_add(new configItem("stream", dynamic_cast<JsonStore *>(stream.get()), itemType::jsonStore)); _add(new configItem("stream", dynamic_cast<JsonStore *>(stream.get()), itemType::jsonStore));
}; };

View File

@@ -8,6 +8,8 @@ EditShadowSocks::EditShadowSocks(QWidget *parent) : QWidget(parent),
ui->setupUi(this); ui->setupUi(this);
if (IS_NEKO_BOX) { if (IS_NEKO_BOX) {
ui->method->addItems({"2022-blake3-aes-128-gcm", "2022-blake3-aes-256-gcm", "2022-blake3-chacha20-poly1305"}); ui->method->addItems({"2022-blake3-aes-128-gcm", "2022-blake3-aes-256-gcm", "2022-blake3-chacha20-poly1305"});
} else {
ui->uot->hide();
} }
} }
@@ -20,6 +22,7 @@ void EditShadowSocks::onStart(QSharedPointer<NekoRay::ProxyEntity> _ent) {
auto bean = this->ent->ShadowSocksBean(); auto bean = this->ent->ShadowSocksBean();
ui->method->setCurrentText(bean->method); ui->method->setCurrentText(bean->method);
ui->uot->setChecked(bean->uot);
ui->password->setText(bean->password); ui->password->setText(bean->password);
auto ssPlugin = bean->plugin.split(";"); auto ssPlugin = bean->plugin.split(";");
if (!ssPlugin.empty()) { if (!ssPlugin.empty()) {
@@ -33,10 +36,11 @@ bool EditShadowSocks::onEnd() {
bean->method = ui->method->currentText(); bean->method = ui->method->currentText();
bean->password = ui->password->text(); bean->password = ui->password->text();
bean->uot = ui->uot->isChecked();
bean->plugin = ui->plugin->currentText(); bean->plugin = ui->plugin->currentText();
if (!bean->plugin.isEmpty()) { if (!bean->plugin.isEmpty()) {
bean->plugin += ";" + ui->plugin_opts->text(); bean->plugin += ";" + ui->plugin_opts->text();
} }
return true; return true;
} }

View File

@@ -14,10 +14,20 @@
<string notr="true">Form</string> <string notr="true">Form</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="3" column="0"> <item row="0" column="0">
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="label">
<property name="text"> <property name="text">
<string>Plugin Args</string> <string>Encryption</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="MyLineEdit" name="password"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Plugin</string>
</property> </property>
</widget> </widget>
</item> </item>
@@ -31,40 +41,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Encryption</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="plugin">
<item>
<property name="text">
<string/>
</property>
</item>
<item>
<property name="text">
<string notr="true">obfs-local</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">v2ray-plugin</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">ssr</string>
</property>
</item>
</widget>
</item>
<item row="1" column="1">
<widget class="MyLineEdit" name="password"/>
</item>
<item row="0" column="1"> <item row="0" column="1">
<widget class="QComboBox" name="method"> <widget class="QComboBox" name="method">
<property name="editable"> <property name="editable">
@@ -162,10 +138,41 @@
</item> </item>
</widget> </widget>
</item> </item>
<item row="2" column="0"> <item row="3" column="0">
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="label_3">
<property name="text"> <property name="text">
<string>Plugin</string> <string>Plugin Args</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="plugin">
<item>
<property name="text">
<string/>
</property>
</item>
<item>
<property name="text">
<string notr="true">obfs-local</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">v2ray-plugin</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">ssr</string>
</property>
</item>
</widget>
</item>
<item row="4" column="1">
<widget class="QCheckBox" name="uot">
<property name="text">
<string notr="true">UDP over TCP</string>
</property> </property>
</widget> </widget>
</item> </item>