Skip to content

Commit

Permalink
Add shadowsocks uot option (MatsuriDayo#560)
Browse files Browse the repository at this point in the history
  • Loading branch information
tdjnodj authored May 2, 2023
1 parent 7212c6a commit 79ef90f
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 41 deletions.
1 change: 1 addition & 0 deletions fmt/Bean2CoreObj_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ namespace NekoRay::fmt {
outbound["server_port"] = serverPort;
outbound["method"] = method;
outbound["password"] = password;
outbound["udp_over_tcp"] = uot;

if (!plugin.trimmed().isEmpty()) {
outbound["plugin"] = SubStrBefore(plugin, ";");
Expand Down
2 changes: 2 additions & 0 deletions fmt/ShadowSocksBean.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ namespace NekoRay::fmt {
QString method = "aes-128-gcm";
QString password = "";
QString plugin = "";
bool uot = false;

QSharedPointer<V2rayStreamSettings> stream = QSharedPointer<V2rayStreamSettings>(new V2rayStreamSettings());

ShadowSocksBean() : AbstractBean(0) {
_add(new configItem("method", &method, itemType::string));
_add(new configItem("pass", &password, 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));
};

Expand Down
6 changes: 5 additions & 1 deletion ui/edit/edit_shadowsocks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ EditShadowSocks::EditShadowSocks(QWidget *parent) : QWidget(parent),
ui->setupUi(this);
if (IS_NEKO_BOX) {
ui->method->addItems({"2022-blake3-aes-128-gcm", "2022-blake3-aes-256-gcm", "2022-blake3-chacha20-poly1305"});
} else {
ui->uot->hide();
}
}

Expand All @@ -20,6 +22,7 @@ void EditShadowSocks::onStart(QSharedPointer<NekoRay::ProxyEntity> _ent) {
auto bean = this->ent->ShadowSocksBean();

ui->method->setCurrentText(bean->method);
ui->uot->setChecked(bean->uot);
ui->password->setText(bean->password);
auto ssPlugin = bean->plugin.split(";");
if (!ssPlugin.empty()) {
Expand All @@ -33,10 +36,11 @@ bool EditShadowSocks::onEnd() {

bean->method = ui->method->currentText();
bean->password = ui->password->text();
bean->uot = ui->uot->isChecked();
bean->plugin = ui->plugin->currentText();
if (!bean->plugin.isEmpty()) {
bean->plugin += ";" + ui->plugin_opts->text();
}

return true;
}
}
87 changes: 47 additions & 40 deletions ui/edit/edit_shadowsocks.ui
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,20 @@
<string notr="true">Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="3" column="0">
<widget class="QLabel" name="label_3">
<item row="0" column="0">
<widget class="QLabel" name="label">
<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>
</widget>
</item>
Expand All @@ -31,40 +41,6 @@
</property>
</widget>
</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">
<widget class="QComboBox" name="method">
<property name="editable">
Expand Down Expand Up @@ -162,10 +138,41 @@
</item>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<item row="3" column="0">
<widget class="QLabel" name="label_3">
<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>
</widget>
</item>
Expand Down

0 comments on commit 79ef90f

Please sign in to comment.