try to fix fakedns

This commit is contained in:
HystericalDragon
2023-07-23 16:54:48 +08:00
parent 9eb1a20408
commit 42b4367f01
2 changed files with 4 additions and 3 deletions

View File

@@ -864,7 +864,7 @@ namespace NekoGui {
}; };
// Fakedns // Fakedns
if (IS_NEKO_BOX_INTERNAL_TUN && dataStore->spmode_vpn && !status->forTest) { if (dataStore->fake_dns && IS_NEKO_BOX_INTERNAL_TUN && dataStore->spmode_vpn && !status->forTest) {
dnsServers += QJsonObject{ dnsServers += QJsonObject{
{"tag", "dns-fake"}, {"tag", "dns-fake"},
{"address", "fakeip"}, {"address", "fakeip"},
@@ -894,7 +894,7 @@ namespace NekoGui {
add_rule_dns(status->domainListDNSDirect, "dns-direct"); add_rule_dns(status->domainListDNSDirect, "dns-direct");
// fakedns rule // fakedns rule
if (IS_NEKO_BOX_INTERNAL_TUN && dataStore->spmode_vpn && !status->forTest) { if (dataStore->fake_dns && IS_NEKO_BOX_INTERNAL_TUN && dataStore->spmode_vpn && !status->forTest) {
dnsRules += QJsonObject{ dnsRules += QJsonObject{
{"inbound", "tun-in"}, {"inbound", "tun-in"},
{"server", "dns-fake"}, {"server", "dns-fake"},
@@ -1061,6 +1061,7 @@ namespace NekoGui {
auto configFn = ":/neko/vpn/sing-box-vpn.json"; auto configFn = ":/neko/vpn/sing-box-vpn.json";
if (QFile::exists("vpn/sing-box-vpn.json")) configFn = "vpn/sing-box-vpn.json"; if (QFile::exists("vpn/sing-box-vpn.json")) configFn = "vpn/sing-box-vpn.json";
auto config = ReadFileText(configFn) auto config = ReadFileText(configFn)
.replace("%ENABLED_FAKEDNS%", dataStore->fake_dns ? "true" : "false")
.replace("//%IPV6_ADDRESS%", dataStore->vpn_ipv6 ? R"("inet6_address": "fdfe:dcba:9876::1/126",)" : "") .replace("//%IPV6_ADDRESS%", dataStore->vpn_ipv6 ? R"("inet6_address": "fdfe:dcba:9876::1/126",)" : "")
.replace("//%SOCKS_USER_PASS%", socks_user_pass) .replace("//%SOCKS_USER_PASS%", socks_user_pass)
.replace("//%PROCESS_NAME_RULE%", process_name_rule) .replace("//%PROCESS_NAME_RULE%", process_name_rule)

View File

@@ -4,7 +4,7 @@
}, },
"dns": { "dns": {
"fakeip": { "fakeip": {
"enabled": true, "enabled": %ENABLED_FAKEDNS%,
"inet4_range": "198.18.0.0/15", "inet4_range": "198.18.0.0/15",
"inet6_range": "fc00::/18" "inet6_range": "fc00::/18"
}, },