Skip to content

Change default DNS resolvers and MTU to 1500#36

Merged
hawkff merged 3 commits into
mainfrom
config/default-quad9-mtu1500
Jun 19, 2026
Merged

Change default DNS resolvers and MTU to 1500#36
hawkff merged 3 commits into
mainfrom
config/default-quad9-mtu1500

Conversation

@hawkff

@hawkff hawkff commented Jun 19, 2026

Copy link
Copy Markdown
Owner

Summary

  • Change fresh-install remote DNS default to Quad9 DoH: https://dns.quad9.net/dns-query
  • Change fresh-install direct DNS default to Cloudflare IP DoH: https://1.1.1.1/dns-query
  • Change fresh-install global VPN/TUN MTU default from 9000 to 1500

Notes

  • This only changes hardcoded defaults in DataStore.kt and global_preferences.xml.
  • Existing installs with saved preferences keep their current values.
  • No profile import/export behavior is changed.

Validation

  • git diff --check
  • GitHub CI passed
  • CodeRabbit passed
  • Greptile passed

@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Default values in DataStore.kt and global_preferences.xml are updated: MTU drops from 9000 to 1500, remoteDns switches from https://dns.google/dns-query to https://dns.quad9.net/dns-query, and directDns switches from https://223.5.5.5/dns-query to https://1.1.1.1/dns-query.

Changes

Default Configuration Value Updates

Layer / File(s) Summary
MTU and DNS endpoint defaults
app/src/main/java/io/nekohasekai/sagernet/database/DataStore.kt, app/src/main/res/xml/global_preferences.xml
mtu default reduced from 9000 to 1500; remoteDns default changed from https://dns.google/dns-query to https://dns.quad9.net/dns-query; directDns default changed from https://223.5.5.5/dns-query to https://1.1.1.1/dns-query. Both the Kotlin DataStore property defaults and the XML preference defaultValue attributes are updated in sync.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐇 Hop, hop, defaults refined!
MTU trimmed, endpoints redesigned,
Quad9 and Cloudflare combined,
The rabbit rewired DNS aligned —
Network preferences optimized! 🌐

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main changes: updating default DNS to Quad9 and MTU to 1500, which are the primary modifications across both modified files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The PR description clearly outlines the three main changes: DNS defaults (Quad9), and MTU reduction (9000→1500), matching the changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Comment @coderabbitai help to get the list of available commands and usage tips.

Comment thread app/src/main/java/io/nekohasekai/sagernet/database/DataStore.kt Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with 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.

Inline comments:
In `@app/src/main/java/io/nekohasekai/sagernet/database/DataStore.kt`:
- 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.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 634601e7-9d20-4b89-947e-b1ec97adf675

📥 Commits

Reviewing files that changed from the base of the PR and between 03725eb and a3eb787.

📒 Files selected for processing (2)
  • app/src/main/java/io/nekohasekai/sagernet/database/DataStore.kt
  • app/src/main/res/xml/global_preferences.xml

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.

@hawkff hawkff merged commit b4ca0a6 into main Jun 19, 2026
5 checks passed
@hawkff hawkff deleted the config/default-quad9-mtu1500 branch June 19, 2026 22:25
@hawkff hawkff changed the title Change default DNS to Quad9 and MTU to 1500 Change default DNS resolvers and MTU to 1500 Jun 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant