mirror of
https://github.com/MatsuriDayo/nekoray.git
synced 2025-12-17 20:44:38 +03:00
vpn tcpip stack select for windows
This commit is contained in:
@@ -7,6 +7,8 @@
|
||||
%IPV6_ADDRESS%
|
||||
"mtu": %MTU%,
|
||||
"auto_route": true,
|
||||
"stack": "%STACK%",
|
||||
"endpoint_independent_nat": true,
|
||||
"sniff": false
|
||||
}
|
||||
],
|
||||
|
||||
@@ -14,4 +14,8 @@ namespace Preset {
|
||||
" }\n"
|
||||
"}";
|
||||
}
|
||||
|
||||
namespace SingBox {
|
||||
inline QStringList VpnImplementation = {"gvisor", "lwip", "system"};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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-*
|
||||
|
||||
@@ -124,7 +124,7 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<widget class="QGroupBox" name="groupBox1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_9" stretch="0,8,1,1">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_13">
|
||||
@@ -221,7 +221,7 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="horizontalGroupBox">
|
||||
<widget class="QGroupBox" name="horizontalGroupBox1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_18">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="check_include_pre">
|
||||
@@ -265,7 +265,7 @@
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<item row="1" column="0">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<widget class="QGroupBox" name="groupBox2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_15">
|
||||
@@ -402,7 +402,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QGroupBox" name="horizontalGroupBox">
|
||||
<widget class="QGroupBox" name="horizontalGroupBox2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_20">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="start_minimal">
|
||||
|
||||
@@ -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 <QFile>
|
||||
@@ -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;
|
||||
|
||||
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user