From e8147589f7af1e8a848d3df1a97157f430ed36c3 Mon Sep 17 00:00:00 2001
From: arm64v8a <48624112+arm64v8a@users.noreply.github.com>
Date: Tue, 25 Jul 2023 13:03:02 +0900
Subject: [PATCH] fix
---
db/ConfigBuilder.cpp | 20 ++++-
res/vpn/sing-box-vpn.json | 12 ++-
ui/edit/edit_hysteria.ui | 171 ++++++++++++++++++++------------------
ui/edit/edit_naive.ui | 57 ++++++-------
ui/mainwindow_grpc.cpp | 1 -
5 files changed, 144 insertions(+), 117 deletions(-)
diff --git a/db/ConfigBuilder.cpp b/db/ConfigBuilder.cpp
index 3b275f2..c05588f 100644
--- a/db/ConfigBuilder.cpp
+++ b/db/ConfigBuilder.cpp
@@ -863,6 +863,13 @@ namespace NekoGui {
{"detour", "direct"},
};
+ // block
+ if (!status->forTest)
+ dnsServers += QJsonObject{
+ {"tag", "dns-block"},
+ {"address", "rcode://success"},
+ };
+
// Fakedns
if (dataStore->fake_dns && IS_NEKO_BOX_INTERNAL_TUN && dataStore->spmode_vpn && !status->forTest) {
dnsServers += QJsonObject{
@@ -893,6 +900,18 @@ namespace NekoGui {
add_rule_dns(status->domainListDNSRemote, "dns-remote");
add_rule_dns(status->domainListDNSDirect, "dns-direct");
+ // built-in rules
+ if (!status->forTest) {
+ dnsRules += QJsonObject{
+ {"query_type", QJsonArray{32, 33}},
+ {"server", "dns-block"},
+ };
+ dnsRules += QJsonObject{
+ {"domain_suffix", ".lan"},
+ {"server", "dns-block"},
+ };
+ }
+
// fakedns rule
if (dataStore->fake_dns && IS_NEKO_BOX_INTERNAL_TUN && dataStore->spmode_vpn && !status->forTest) {
dnsRules += QJsonObject{
@@ -1071,7 +1090,6 @@ namespace NekoGui {
.replace("%STRICT_ROUTE%", dataStore->vpn_strict_route ? "true" : "false")
.replace("%FINAL_OUT%", no_match_out)
.replace("%DNS_ADDRESS%", BOX_UNDERLYING_DNS)
- .replace("%FAKE_DNS_ENABLE%", dataStore->fake_dns ? "true" : "false")
.replace("%FAKE_DNS_INBOUND%", dataStore->fake_dns ? "tun-in" : "empty")
.replace("%PORT%", Int2String(dataStore->inbound_socks_port));
// hook.js
diff --git a/res/vpn/sing-box-vpn.json b/res/vpn/sing-box-vpn.json
index 1b3b365..adb32e3 100644
--- a/res/vpn/sing-box-vpn.json
+++ b/res/vpn/sing-box-vpn.json
@@ -4,7 +4,7 @@
},
"dns": {
"fakeip": {
- "enabled": %FAKE_DNS_ENABLE%,
+ "enabled": true,
"inet4_range": "198.18.0.0/15",
"inet6_range": "fc00::/18"
},
@@ -29,6 +29,13 @@
}
],
"rules": [
+ {
+ "query_type": [
+ 32,
+ 33
+ ],
+ "server": "dns-block"
+ },
{
"domain_suffix": [
".lan"
@@ -132,9 +139,10 @@
"nekobox_core.exe"
],
"outbound": "direct"
- },
+ }
//%PROCESS_NAME_RULE%
//%CIDR_RULE%
+ ,
{
"port": 53,
"outbound": "dns-out"
diff --git a/ui/edit/edit_hysteria.ui b/ui/edit/edit_hysteria.ui
index 104083c..53f71c3 100644
--- a/ui/edit/edit_hysteria.ui
+++ b/ui/edit/edit_hysteria.ui
@@ -13,30 +13,34 @@
EditHysteria
-
+
+ -
+
+
+ Hop Port
+
+
+
-
- -
-
+
-
+
- Auth Type
+ Hop Interval (s)
- -
-
+
-
+
+
+ -
+
- Protocol
+ Upload (Mbps)
- -
-
-
- -
-
-
-
@@ -47,7 +51,17 @@
- -
+
-
+
+
+ -
+
+
+ Protocol
+
+
+
+ -
-
@@ -83,24 +97,24 @@
- -
-
+
-
+
- Hop Interval (s)
+ Obfs Password
- -
-
+
-
+
- -
-
+
-
+
- Certificate
+ Auth Type
- -
+
-
-
@@ -119,7 +133,37 @@
- -
+
-
+
+
+ Auth Payload
+
+
+
+ -
+
+
+ -
+
+
+ SNI
+
+
+
+ -
+
+
+ -
+
+
+ Only 1 value
+
+
+ ALPN
+
+
+
+ -
-
@@ -133,84 +177,40 @@
- -
-
+
-
+
- Hop Port
+ Certificate
- -
+
-
PushButton
- -
-
-
- Upload (Mbps)
-
-
-
- -
-
-
- Obfs Password
-
-
-
- -
-
-
- SNI
-
-
-
- -
-
-
- -
-
-
- Only 1 value
-
-
- ALPN
-
-
-
- -
-
-
- -
-
-
- Auth Payload
-
-
-
- -
-
-
- -
-
-
- -
+
-
recv_window
- -
+
-
+
+
+ -
recv_window_conn
+ -
+
+
@@ -221,10 +221,21 @@
+ hopPort
+ hopInterval
uploadMbps
downloadMbps
+ protocol
+ disableMtuDiscovery
+ obfsPassword
+ authPayloadType
+ authPayload
sni
+ alpn
+ allowInsecure
certificate
+ streamReceiveWindow
+ connectionReceiveWindow
diff --git a/ui/edit/edit_naive.ui b/ui/edit/edit_naive.ui
index 805697e..e25e528 100644
--- a/ui/edit/edit_naive.ui
+++ b/ui/edit/edit_naive.ui
@@ -13,14 +13,17 @@
EditNaive
-
- -
-
+
+
-
+
- Protocol
+ Username
+ -
+
+
-
@@ -31,6 +34,13 @@
-
+ -
+
+
+ Protocol
+
+
+
-
-
@@ -52,13 +62,6 @@
- -
-
-
- SNI
-
-
-
-
@@ -66,16 +69,13 @@
- -
-
+
-
+
- Username
+ SNI
- -
-
-
-
@@ -86,6 +86,13 @@
+ -
+
+
+ PushButton
+
+
+
-
@@ -96,13 +103,6 @@
-
- -
-
-
- PushButton
-
-
-
@@ -112,15 +112,6 @@
-
- username
- password
- protocol
- extra_headers
- sni
- certificate
- insecure_concurrency
-
diff --git a/ui/mainwindow_grpc.cpp b/ui/mainwindow_grpc.cpp
index d23c671..fa0eb40 100644
--- a/ui/mainwindow_grpc.cpp
+++ b/ui/mainwindow_grpc.cpp
@@ -335,7 +335,6 @@ void MainWindow::neko_start(int _id) {
if (!mu_stopping.tryLock()) {
MessageBoxWarning(software_name, "Another profile is stopping...");
mu_starting.unlock();
- mu_stopping.unlock();
return;
}
mu_stopping.unlock();