diff --git a/examples/sing-box-vpn.json b/examples/sing-box-vpn.json
index ce3892f..21b9aef 100644
--- a/examples/sing-box-vpn.json
+++ b/examples/sing-box-vpn.json
@@ -7,6 +7,8 @@
%IPV6_ADDRESS%
"mtu": %MTU%,
"auto_route": true,
+ "stack": "%STACK%",
+ "endpoint_independent_nat": true,
"sniff": false
}
],
diff --git a/fmt/Preset.hpp b/fmt/Preset.hpp
index 23f4753..5793698 100644
--- a/fmt/Preset.hpp
+++ b/fmt/Preset.hpp
@@ -14,4 +14,8 @@ namespace Preset {
" }\n"
"}";
}
+
+ namespace SingBox {
+ inline QStringList VpnImplementation = {"gvisor", "lwip", "system"};
+ }
}
diff --git a/libs/build_go.sh b/libs/build_go.sh
index 6d36481..2702e98 100755
--- a/libs/build_go.sh
+++ b/libs/build_go.sh
@@ -33,7 +33,7 @@ if [ "$GOOS" != "windows" ]; then
fi
#### Go ext: sing-box ####
-curl -Lso sing-box.zip https://github.com/SagerNet/sing-box/releases/download/v1.0-beta1/sing-box-1.0-beta1-windows-amd64.zip
+curl -Lso sing-box.zip https://github.com/SagerNet/sing-box/releases/download/v1.0-beta1/sing-box-1.0-beta1-windows-amd64.zip # TODO Update for system stack
unzip sing-box.zip
mv sing-box-*/sing-box.exe $DEST
rm -rf sing-box.zip sing-box-*
diff --git a/ui/dialog_basic_settings.ui b/ui/dialog_basic_settings.ui
index 0193aa0..41a33ac 100644
--- a/ui/dialog_basic_settings.ui
+++ b/ui/dialog_basic_settings.ui
@@ -124,7 +124,7 @@
-
-
+
-
@@ -221,7 +221,7 @@
-
-
+
-
@@ -265,7 +265,7 @@
-
-
+
-
@@ -402,7 +402,7 @@
-
-
+
-
diff --git a/ui/dialog_manage_routes.cpp b/ui/dialog_manage_routes.cpp
index 615aafb..7915f8f 100644
--- a/ui/dialog_manage_routes.cpp
+++ b/ui/dialog_manage_routes.cpp
@@ -3,6 +3,7 @@
#include "qv2ray/v2/ui/widgets/editors/w_JsonEditor.hpp"
#include "qv2ray/v3/components/GeositeReader/GeositeReader.hpp"
+#include "fmt/Preset.hpp"
#include "main/GuiUtils.hpp"
#include
@@ -43,10 +44,11 @@ DialogManageRoutes::DialogManageRoutes(QWidget *parent) :
ui->vpn_implementation->setCurrentIndex(NekoRay::dataStore->vpn_implementation);
ui->vpn_mtu->setCurrentText(Int2String(NekoRay::dataStore->vpn_mtu));
ui->vpn_ipv6->setChecked(NekoRay::dataStore->vpn_ipv6);
+ //
#ifdef Q_OS_WIN
- ui->vpn_implementation->setEditable(true);
- ui->vpn_implementation->setCurrentText("Windows: sing-box gVisor");
- ui->vpn_implementation->setDisabled(true);
+ ui->vpn_implementation->setItemText(0, Preset::SingBox::VpnImplementation[0]);
+ ui->vpn_implementation->setItemText(1, Preset::SingBox::VpnImplementation[1]);
+ ui->vpn_implementation->setItemText(2, Preset::SingBox::VpnImplementation[2]);
#endif
//
connect(ui->custom_route_edit, &QPushButton::clicked, this, [=] {
@@ -109,11 +111,11 @@ void DialogManageRoutes::accept() {
auto mtu = ui->vpn_mtu->currentText().toInt();
if (mtu > 10000 || mtu < 1000) mtu = 9000;
auto ipv6 = ui->vpn_ipv6->isChecked();
-#ifndef Q_OS_WIN
+ //
auto impl = ui->vpn_implementation->currentIndex();
vpnChanged |= NekoRay::dataStore->vpn_implementation != impl;
NekoRay::dataStore->vpn_implementation = impl;
-#endif
+ //
vpnChanged |= NekoRay::dataStore->fake_dns != fakedns;
vpnChanged |= NekoRay::dataStore->vpn_mtu != mtu;
vpnChanged |= NekoRay::dataStore->vpn_ipv6 != ipv6;
diff --git a/ui/mainwindow.cpp b/ui/mainwindow.cpp
index 77a00ed..167292b 100644
--- a/ui/mainwindow.cpp
+++ b/ui/mainwindow.cpp
@@ -1,6 +1,7 @@
#include "./ui_mainwindow.h"
#include "mainwindow.h"
+#include "fmt/Preset.hpp"
#include "db/ProfileFilter.hpp"
#include "db/ConfigBuilder.hpp"
#include "sub/GroupUpdater.hpp"
@@ -1401,6 +1402,7 @@ bool MainWindow::StartVPNProcess() {
auto config = ReadFileText(configFn)
.replace("%IPV6_ADDRESS%", NekoRay::dataStore->vpn_ipv6 ? "\"inet6_address\": \"fdfe:dcba:9876::1/128\"," : "")
.replace("%MTU%", Int2String(NekoRay::dataStore->vpn_mtu))
+ .replace("%STACK%", Preset::SingBox::VpnImplementation[NekoRay::dataStore->vpn_implementation])
.replace("%PORT%", Int2String(NekoRay::dataStore->inbound_socks_port));
#else
auto protectPath = QDir::currentPath() + "/protect";