Rename VPN -> TUN

This commit is contained in:
arm64v8a
2023-07-14 13:47:52 +09:00
parent 282dd5aacf
commit 3c4556e78c
14 changed files with 64 additions and 64 deletions

View File

@@ -1056,9 +1056,9 @@ namespace NekoGui {
auto source = qjs::ReadHookJS(); auto source = qjs::ReadHookJS();
if (!source.isEmpty()) { if (!source.isEmpty()) {
qjs::QJS js(source); qjs::QJS js(source);
auto js_result = js.EvalFunction("hook.hook_vpn_config", config); auto js_result = js.EvalFunction("hook.hook_tun_config", config);
if (config != js_result) { if (config != js_result) {
MW_show_log("hook.js modified your VPN config."); MW_show_log("hook.js modified your Tun config.");
config = js_result; config = js_result;
} }
} }
@@ -1087,9 +1087,9 @@ namespace NekoGui {
auto source = qjs::ReadHookJS(); auto source = qjs::ReadHookJS();
if (!source.isEmpty()) { if (!source.isEmpty()) {
qjs::QJS js(source); qjs::QJS js(source);
auto js_result = js.EvalFunction("hook.hook_vpn_script", script); auto js_result = js.EvalFunction("hook.hook_tun_script", script);
if (script != js_result) { if (script != js_result) {
MW_show_log("hook.js modified your VPN script."); MW_show_log("hook.js modified your Tun script.");
script = js_result; script = js_result;
} }
} }

View File

@@ -22,8 +22,8 @@ interface nekoray_in {
// 目前提供的 hook 点 // 目前提供的 hook 点
interface nekoray_hook { interface nekoray_hook {
hook_core_config(config: string): string hook_core_config(config: string): string
hook_vpn_config(config: string): string hook_tun_config(config: string): string
hook_vpn_script(script: string): string hook_tun_script(script: string): string
hook_import(content: string): string hook_import(content: string): string
} }
@@ -41,11 +41,11 @@ class my_hook implements nekoray_hook {
return JSON.stringify(json) return JSON.stringify(json)
} }
hook_vpn_config(config: string): string { hook_tun_config(config: string): string {
return config // 返回输入,表示不修改 return config // 返回输入,表示不修改
} }
hook_vpn_script(script: string): string { hook_tun_script(script: string): string {
console.log("Script") // 输出到 stdout console.log("Script") // 输出到 stdout
this.nekoray.log("Script:", script) // 输出到日志 this.nekoray.log("Script:", script) // 输出到日志
return script return script
@@ -83,10 +83,10 @@ var my_hook = /** @class */ (function () {
json["dns"]["rules"].push(my_rule); json["dns"]["rules"].push(my_rule);
return JSON.stringify(json); return JSON.stringify(json);
}; };
my_hook.prototype.hook_vpn_config = function (config) { my_hook.prototype.hook_tun_config = function (config) {
return config; // 返回输入,表示不修改 return config; // 返回输入,表示不修改
}; };
my_hook.prototype.hook_vpn_script = function (script) { my_hook.prototype.hook_tun_script = function (script) {
console.log("Script"); // 输出到 stdout console.log("Script"); // 输出到 stdout
this.nekoray.log("Script:", script); // 输出到日志 this.nekoray.log("Script:", script); // 输出到日志
return script; return script;

View File

@@ -64,7 +64,7 @@ func setupCore() {
if getNekorayTunIndex() == 0 { if getNekorayTunIndex() == 0 {
return resolver_def.LookupIP(context.Background(), "ip", host) return resolver_def.LookupIP(context.Background(), "ip", host)
} }
// Windows VPN mode use Go resolver // Windows Tun Mode use Go resolver
return resolver_go.LookupIP(context.Background(), "ip", host) return resolver_go.LookupIP(context.Background(), "ip", host)
} }
neko_common.GetCurrentInstance = func() interface{} { neko_common.GetCurrentInstance = func() interface{} {

View File

@@ -141,7 +141,7 @@ func getBindInterfaceIndex(address string) uint32 {
} }
} }
// Not in VPN mode // Not in Tun Mode
if nextInterface == 0 { if nextInterface == 0 {
return 0 return 0
} }

View File

@@ -25,7 +25,7 @@ func nekorayLinuxProtect(fd int) bool {
} }
} }
// check is in VPN mode // check is in Tun Mode
if is_fwmark_exist(514) { if is_fwmark_exist(514) {
if cap_net_admin == 1 { if cap_net_admin == 1 {
// have permission // have permission

View File

@@ -3,7 +3,7 @@ cd qtsdk
if [ "$DL_QT_VER" == "5.15" ]; then if [ "$DL_QT_VER" == "5.15" ]; then
curl -LSO https://github.com/MatsuriDayo/nekoray_qt_runtime/releases/download/20220503/Qt5.15.7-Windows-x86_64-VS2019-16.11.20-20221103.7z curl -LSO https://github.com/MatsuriDayo/nekoray_qt_runtime/releases/download/20220503/Qt5.15.7-Windows-x86_64-VS2019-16.11.20-20221103.7z
else else
curl -LSO https://github.com/MatsuriDayo/nekoray_qt_runtime/releases/download/20220503/Qt6.5.0-Windows-x86_64-VS2022-17.5.5-20230507.7z curl -LSO https://github.com/MatsuriDayo/nekoray_qt_runtime/releases/download/20220503/Qt6.5.1-Windows-x86_64-VS2022-17.6.2-20230601.7z
fi fi
7z x *.7z 7z x *.7z
rm *.7z rm *.7z

View File

@@ -19,7 +19,7 @@ Depends: libxcb-xinerama0, libqt5core5a, libqt5gui5, libqt5network5, libqt5widge
Description: Qt based cross-platform GUI proxy configuration manager (backend: v2ray / sing-box) Description: Qt based cross-platform GUI proxy configuration manager (backend: v2ray / sing-box)
EOF EOF
# Start VPN mode without password # Start Tun Mode without password
cat >nekoray/opt/nekoray/pkexec <<-EOF cat >nekoray/opt/nekoray/pkexec <<-EOF
#!/bin/sh #!/bin/sh

View File

@@ -3,7 +3,7 @@ set -e
set -x set -x
if [ "$EUID" -ne 0 ]; then if [ "$EUID" -ne 0 ]; then
echo "[Warning] vpn script not running as root" echo "[Warning] Tun script not running as root"
fi fi
if [ "$(uname)" == "Darwin" ]; then if [ "$(uname)" == "Darwin" ]; then

View File

@@ -219,12 +219,12 @@
</message> </message>
<message> <message>
<source>It is recommended to leave it blank, but it sometimes does not work, at this time you can set this option. <source>It is recommended to leave it blank, but it sometimes does not work, at this time you can set this option.
For NekoRay, this rewrites the underlying(localhost) DNS in VPN mode. For NekoRay, this rewrites the underlying(localhost) DNS in Tun Mode.
For NekoBox, this rewrites the underlying(localhost) DNS in VPN mode, normal mode, and also URL Test.</source> For NekoBox, this rewrites the underlying(localhost) DNS in Tun Mode, normal mode, and also URL Test.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<source>If you VPN mode is not working, try to change this option.</source> <source>If you Tun Mode is not working, try to change this option.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
@@ -695,7 +695,7 @@ These settings can be changed later.</source>
<context> <context>
<name>DialogVPNSettings</name> <name>DialogVPNSettings</name>
<message> <message>
<source>VPN Settings</source> <source>Tun Settings</source>
<translation>تنظیمات vpn</translation> <translation>تنظیمات vpn</translation>
</message> </message>
<message> <message>
@@ -703,7 +703,7 @@ These settings can be changed later.</source>
<translation>مخفی کردن کنسول</translation> <translation>مخفی کردن کنسول</translation>
</message> </message>
<message> <message>
<source>VPN Enable IPv6</source> <source>Tun Enable IPv6</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
@@ -1084,7 +1084,7 @@ This needs to be run NekoBox with administrator privileges.</source>
<translation>بروزرسانی</translation> <translation>بروزرسانی</translation>
</message> </message>
<message> <message>
<source>VPN Mode</source> <source>Tun Mode</source>
<translation>حالتvpn</translation> <translation>حالتvpn</translation>
</message> </message>
<message> <message>
@@ -1284,7 +1284,7 @@ This needs to be run NekoBox with administrator privileges.</source>
<translation>دامنه را حل کنید</translation> <translation>دامنه را حل کنید</translation>
</message> </message>
<message> <message>
<source>VPN Settings</source> <source>Tun Settings</source>
<translation>تنظیمات vpn</translation> <translation>تنظیمات vpn</translation>
</message> </message>
<message> <message>
@@ -1308,12 +1308,12 @@ This needs to be run NekoBox with administrator privileges.</source>
<translation>خطا</translation> <translation>خطا</translation>
</message> </message>
<message> <message>
<source>VPN settings changed</source> <source>Tun Settings changed</source>
<translation>تنظیمات VPN تغییر کرد</translation> <translation>تنظیمات Tun تغییر کرد</translation>
</message> </message>
<message> <message>
<source>Restart VPN to take effect.</source> <source>Restart Tun to take effect.</source>
<translation>VPN را مجدداً راه اندازی کنید تا اعمال شود.</translation> <translation>Tun را مجدداً راه اندازی کنید تا اعمال شود.</translation>
</message> </message>
<message> <message>
<source>Confirmation</source> <source>Confirmation</source>
@@ -1336,7 +1336,7 @@ This needs to be run NekoBox with administrator privileges.</source>
<translation>تنظیمات</translation> <translation>تنظیمات</translation>
</message> </message>
<message> <message>
<source>Current server is incompatible with VPN. Please stop the server first, enable VPN mode, and then restart.</source> <source>Current server is incompatible with Tun. Please stop the server first, enable Tun Mode, and then restart.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
@@ -1415,8 +1415,8 @@ End: %2</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<source>Failed to stop VPN process</source> <source>Failed to stop Tun process</source>
<translation>فرآیند VPN متوقف نشد</translation> <translation>فرآیند Tun متوقف نشد</translation>
</message> </message>
<message> <message>
<source>Input</source> <source>Input</source>

View File

@@ -213,15 +213,15 @@
</message> </message>
<message> <message>
<source>It is recommended to leave it blank, but it sometimes does not work, at this time you can set this option. <source>It is recommended to leave it blank, but it sometimes does not work, at this time you can set this option.
For NekoRay, this rewrites the underlying(localhost) DNS in VPN mode. For NekoRay, this rewrites the underlying(localhost) DNS in Tun Mode.
For NekoBox, this rewrites the underlying(localhost) DNS in VPN mode, normal mode, and also URL Test.</source> For NekoBox, this rewrites the underlying(localhost) DNS in Tun Mode, normal mode, and also URL Test.</source>
<translation> <translation>
NekoRay VPN underlying(localhost) DNS NekoRay Tun underlying(localhost) DNS
NekoBox VPN URL underlying(localhost) DNS</translation> NekoBox Tun URL underlying(localhost) DNS</translation>
</message> </message>
<message> <message>
<source>If you VPN mode is not working, try to change this option.</source> <source>If you Tun Mode is not working, try to change this option.</source>
<translation>VPN模式有问</translation> <translation> Tun </translation>
</message> </message>
<message> <message>
<source>Default On</source> <source>Default On</source>
@@ -689,16 +689,16 @@ These settings can be changed later.</source>
<context> <context>
<name>DialogVPNSettings</name> <name>DialogVPNSettings</name>
<message> <message>
<source>VPN Settings</source> <source>Tun Settings</source>
<translation>VPN </translation> <translation>Tun </translation>
</message> </message>
<message> <message>
<source>Hide Console</source> <source>Hide Console</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<source>VPN Enable IPv6</source> <source>Tun Enable IPv6</source>
<translation> VPN IPv6</translation> <translation> Tun IPv6</translation>
</message> </message>
<message> <message>
<source>Bypass CIDR</source> <source>Bypass CIDR</source>
@@ -733,7 +733,7 @@ These settings can be changed later.</source>
If still not working, see documentation for more information. If still not working, see documentation for more information.
https://matsuridayo.github.io/n-configuration/#vpn-tun</source> https://matsuridayo.github.io/n-configuration/#vpn-tun</source>
<translation> VPN nekobox_core <translation> Tun nekobox_core
https://matsuridayo.github.io/n-configuration/#vpn-tun</translation> https://matsuridayo.github.io/n-configuration/#vpn-tun</translation>
@@ -1324,12 +1324,12 @@ End: %2</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<source>VPN Mode</source> <source>Tun Mode</source>
<translation>VPN </translation> <translation>Tun </translation>
</message> </message>
<message> <message>
<source>Failed to stop VPN process</source> <source>Failed to stop Tun process</source>
<translation> VPN </translation> <translation> Tun </translation>
</message> </message>
<message> <message>
<source>Enable System Proxy</source> <source>Enable System Proxy</source>
@@ -1340,12 +1340,12 @@ End: %2</source>
<translation> VPN</translation> <translation> VPN</translation>
</message> </message>
<message> <message>
<source>VPN settings changed</source> <source>Tun Settings changed</source>
<translation>VPN </translation> <translation>Tun </translation>
</message> </message>
<message> <message>
<source>Restart VPN to take effect.</source> <source>Restart Tun to take effect.</source>
<translation> VPN </translation> <translation> Tun </translation>
</message> </message>
<message> <message>
<source>Start</source> <source>Start</source>
@@ -1396,8 +1396,8 @@ End: %2</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<source>VPN Settings</source> <source>Tun Settings</source>
<translation>VPN </translation> <translation>Tun </translation>
</message> </message>
<message> <message>
<source>Restart Program</source> <source>Restart Program</source>
@@ -1408,8 +1408,8 @@ End: %2</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<source>Current server is incompatible with VPN. Please stop the server first, enable VPN mode, and then restart.</source> <source>Current server is incompatible with Tun. Please stop the server first, enable Tun Mode, and then restart.</source>
<translation> VPN VPN </translation> <translation> Tun Tun </translation>
</message> </message>
<message> <message>
<source>Open Config Folder</source> <source>Open Config Folder</source>

View File

@@ -411,8 +411,8 @@ void DialogBasicSettings::on_core_settings_clicked() {
auto core_box_underlying_dns_l = new QLabel(tr("Override underlying DNS")); auto core_box_underlying_dns_l = new QLabel(tr("Override underlying DNS"));
core_box_underlying_dns_l->setToolTip(tr( core_box_underlying_dns_l->setToolTip(tr(
"It is recommended to leave it blank, but it sometimes does not work, at this time you can set this option.\n" "It is recommended to leave it blank, but it sometimes does not work, at this time you can set this option.\n"
"For NekoRay, this rewrites the underlying(localhost) DNS in VPN mode.\n" "For NekoRay, this rewrites the underlying(localhost) DNS in Tun Mode.\n"
"For NekoBox, this rewrites the underlying(localhost) DNS in VPN mode, normal mode, and also URL Test.")); "For NekoBox, this rewrites the underlying(localhost) DNS in Tun Mode, normal mode, and also URL Test."));
core_box_underlying_dns = new MyLineEdit; core_box_underlying_dns = new MyLineEdit;
core_box_underlying_dns->setText(NekoGui::dataStore->core_box_underlying_dns); core_box_underlying_dns->setText(NekoGui::dataStore->core_box_underlying_dns);
core_box_underlying_dns->setMinimumWidth(300); core_box_underlying_dns->setMinimumWidth(300);
@@ -439,7 +439,7 @@ void DialogBasicSettings::on_core_settings_clicked() {
layout->addWidget(core_box_clash_api_secret, line, 1); layout->addWidget(core_box_clash_api_secret, line, 1);
} else { } else {
auto core_ray_direct_dns_l = new QLabel("NKR_CORE_RAY_DIRECT_DNS"); auto core_ray_direct_dns_l = new QLabel("NKR_CORE_RAY_DIRECT_DNS");
core_ray_direct_dns_l->setToolTip(tr("If you VPN mode is not working, try to change this option.")); core_ray_direct_dns_l->setToolTip(tr("If you Tun Mode is not working, try to change this option."));
core_ray_direct_dns = new QCheckBox; core_ray_direct_dns = new QCheckBox;
core_ray_direct_dns->setChecked(NekoGui::dataStore->core_ray_direct_dns); core_ray_direct_dns->setChecked(NekoGui::dataStore->core_ray_direct_dns);
connect(core_ray_direct_dns, &QCheckBox::clicked, this, [&] { CACHE.needRestart = true; }); connect(core_ray_direct_dns, &QCheckBox::clicked, this, [&] { CACHE.needRestart = true; });
@@ -454,7 +454,7 @@ void DialogBasicSettings::on_core_settings_clicked() {
layout->addWidget(core_ray_freedom_domainStrategy, line, 1); layout->addWidget(core_ray_freedom_domainStrategy, line, 1);
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
auto core_ray_windows_disable_auto_interface_l = new QLabel("NKR_CORE_RAY_WINDOWS_DISABLE_AUTO_INTERFACE"); auto core_ray_windows_disable_auto_interface_l = new QLabel("NKR_CORE_RAY_WINDOWS_DISABLE_AUTO_INTERFACE");
core_ray_windows_disable_auto_interface_l->setToolTip(tr("If you VPN mode is not working, try to change this option.")); core_ray_windows_disable_auto_interface_l->setToolTip(tr("If you Tun Mode is not working, try to change this option."));
core_ray_windows_disable_auto_interface = new QCheckBox; core_ray_windows_disable_auto_interface = new QCheckBox;
core_ray_windows_disable_auto_interface->setChecked(NekoGui::dataStore->core_ray_windows_disable_auto_interface); core_ray_windows_disable_auto_interface->setChecked(NekoGui::dataStore->core_ray_windows_disable_auto_interface);
connect(core_ray_windows_disable_auto_interface, &QCheckBox::clicked, this, [&] { CACHE.needRestart = true; }); connect(core_ray_windows_disable_auto_interface, &QCheckBox::clicked, this, [&] { CACHE.needRestart = true; });

View File

@@ -11,7 +11,7 @@
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>VPN Settings</string> <string>Tun Settings</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
@@ -89,7 +89,7 @@
<item> <item>
<widget class="QCheckBox" name="vpn_ipv6"> <widget class="QCheckBox" name="vpn_ipv6">
<property name="text"> <property name="text">
<string>VPN Enable IPv6</string> <string>Tun Enable IPv6</string>
</property> </property>
</widget> </widget>
</item> </item>

View File

@@ -534,7 +534,7 @@ void MainWindow::dialog_message_impl(const QString &sender, const QString &info)
} }
refresh_proxy_list(); refresh_proxy_list();
if (info.contains("VPNChanged") && NekoGui::dataStore->spmode_vpn) { if (info.contains("VPNChanged") && NekoGui::dataStore->spmode_vpn) {
MessageBoxWarning(tr("VPN settings changed"), tr("Restart VPN to take effect.")); MessageBoxWarning(tr("Tun Settings changed"), tr("Restart Tun to take effect."));
} }
if (suggestRestartProxy && NekoGui::dataStore->started_id >= 0 && if (suggestRestartProxy && NekoGui::dataStore->started_id >= 0 &&
QMessageBox::question(GetMessageBoxParent(), tr("Confirmation"), tr("Settings changed, restart proxy?")) == QMessageBox::StandardButton::Yes) { QMessageBox::question(GetMessageBoxParent(), tr("Confirmation"), tr("Settings changed, restart proxy?")) == QMessageBox::StandardButton::Yes) {
@@ -768,7 +768,7 @@ void MainWindow::neko_set_spmode_vpn(bool enable, bool save) {
} }
} else { } else {
if (NekoGui::dataStore->need_keep_vpn_off) { if (NekoGui::dataStore->need_keep_vpn_off) {
MessageBoxWarning(software_name, tr("Current server is incompatible with VPN. Please stop the server first, enable VPN mode, and then restart.")); MessageBoxWarning(software_name, tr("Current server is incompatible with Tun. Please stop the server first, enable Tun Mode, and then restart."));
neko_set_spmode_FAILED neko_set_spmode_FAILED
} }
if (!StartVPNProcess()) { if (!StartVPNProcess()) {
@@ -1850,7 +1850,7 @@ bool MainWindow::StopVPNProcess(bool unconditional) {
ok = p.exitCode() == 0; ok = p.exitCode() == 0;
#endif #endif
if (!unconditional) { if (!unconditional) {
ok ? vpn_pid = 0 : MessageBoxWarning(tr("Error"), tr("Failed to stop VPN process")); ok ? vpn_pid = 0 : MessageBoxWarning(tr("Error"), tr("Failed to stop Tun process"));
} }
return ok; return ok;
} }

View File

@@ -172,7 +172,7 @@
</sizepolicy> </sizepolicy>
</property> </property>
<property name="text"> <property name="text">
<string>VPN Mode</string> <string>Tun Mode</string>
</property> </property>
</widget> </widget>
</item> </item>
@@ -860,7 +860,7 @@
</action> </action>
<action name="menu_vpn_settings"> <action name="menu_vpn_settings">
<property name="text"> <property name="text">
<string>VPN Settings</string> <string>Tun Settings</string>
</property> </property>
</action> </action>
<action name="actionRestart_Program"> <action name="actionRestart_Program">