Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ object DataStore : OnPreferenceDataStoreChangeListener {
var trafficSniffing by configurationStore.stringToInt(Key.TRAFFIC_SNIFFING) { 1 }
var resolveDestination by configurationStore.boolean(Key.RESOLVE_DESTINATION)

var mtu by configurationStore.stringToInt(Key.MTU) { 9000 }
var mtu by configurationStore.stringToInt(Key.MTU) { 1500 }

var bypassLan by configurationStore.boolean(Key.BYPASS_LAN)
var bypassLanInCore by configurationStore.boolean(Key.BYPASS_LAN_IN_CORE)
Expand All @@ -125,8 +125,8 @@ object DataStore : OnPreferenceDataStoreChangeListener {

var globalCustomConfig by configurationStore.string(Key.GLOBAL_CUSTOM_CONFIG) { "" }

var remoteDns by configurationStore.string(Key.REMOTE_DNS) { "https://dns.google/dns-query" }
var directDns by configurationStore.string(Key.DIRECT_DNS) { "https://223.5.5.5/dns-query" }
var remoteDns by configurationStore.string(Key.REMOTE_DNS) { "https://dns.quad9.net/dns-query" }
var directDns by configurationStore.string(Key.DIRECT_DNS) { "https://1.1.1.1/dns-query" }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Direct DNS default does not match the stated Quad9 objective.

directDns is set to Cloudflare (1.1.1.1), but the PR objective specifies Quad9 IP-based DoH (9.9.9.9) for DNSSEC + malicious-domain blocking defaults. Please align both code and XML to the intended provider.

Suggested fix
--- a/app/src/main/java/io/nekohasekai/sagernet/database/DataStore.kt
+++ b/app/src/main/java/io/nekohasekai/sagernet/database/DataStore.kt
@@
-    var directDns by configurationStore.string(Key.DIRECT_DNS) { "https://1.1.1.1/dns-query" }
+    var directDns by configurationStore.string(Key.DIRECT_DNS) { "https://9.9.9.9/dns-query" }

--- a/app/src/main/res/xml/global_preferences.xml
+++ b/app/src/main/res/xml/global_preferences.xml
@@
-            app:defaultValue="https://1.1.1.1/dns-query"
+            app:defaultValue="https://9.9.9.9/dns-query"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/src/main/java/io/nekohasekai/sagernet/database/DataStore.kt` at line 129,
The default DNS provider in the directDns variable is set to Cloudflare
(1.1.1.1) instead of the intended Quad9 provider (9.9.9.9) for DNSSEC and
malicious-domain blocking. Change the hardcoded default value in the directDns
declaration from "https://1.1.1.1/dns-query" to "https://9.9.9.9/dns-query" to
align with the PR objective.

var enableDnsRouting by configurationStore.boolean(Key.ENABLE_DNS_ROUTING) { true }
var enableFakeDns by configurationStore.boolean(Key.ENABLE_FAKEDNS) { true }

Expand Down
6 changes: 3 additions & 3 deletions app/src/main/res/xml/global_preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
app:title="@string/tun_implementation"
app:useSimpleSummaryProvider="true" />
<moe.matsuri.nb4a.ui.MTUPreference
app:defaultValue="9000"
app:defaultValue="1500"
app:entries="@array/mtu_select"
app:entryValues="@array/mtu_select"
app:icon="@drawable/baseline_public_24"
Expand Down Expand Up @@ -195,7 +195,7 @@

<PreferenceCategory app:title="@string/cag_dns">
<EditTextPreference
app:defaultValue="https://dns.google/dns-query"
app:defaultValue="https://dns.quad9.net/dns-query"
app:icon="@drawable/ic_action_dns"
app:key="remoteDns"
app:title="@string/remote_dns"
Expand All @@ -208,7 +208,7 @@
app:title="@string/domain_strategy_for_remote"
app:useSimpleSummaryProvider="true" />
<EditTextPreference
app:defaultValue="https://223.5.5.5/dns-query"
app:defaultValue="https://1.1.1.1/dns-query"
app:icon="@drawable/ic_action_dns"
app:key="directDns"
app:title="@string/direct_dns"
Expand Down
Loading