Skip to content

feat: add DNS override settings (listen, fake-ip-range)#187

Open
zhkong wants to merge 3 commits into
spencerwooo:mainfrom
zhkong:main
Open

feat: add DNS override settings (listen, fake-ip-range)#187
zhkong wants to merge 3 commits into
spencerwooo:mainfrom
zhkong:main

Conversation

@zhkong
Copy link
Copy Markdown

@zhkong zhkong commented Feb 27, 2026

Summary

Add DNS configuration override support to mihoro, allowing users to control mihomo's DNS settings from mihoro.toml.

New fields added under [mihomo_config.dns]:

  • enable — enable/disable DNS (default: true)
  • listen — DNS listen address (default: 0.0.0.0:5353)
  • fake_ip_range — fake IP CIDR range (default: 198.18.0.1/16)

Referenced from https://wiki.metacubex.one/config/dns

Changes

  • Added MihomoDnsConfig struct for TOML config with serde defaults
  • Added dns field to both MihomoConfig and MihomoYamlConfig
  • Updated apply_mihomo_override() to merge DNS overrides while keeping remote DNS fields intact

Example config

[mihomo_config.dns]
enable = true
listen = "0.0.0.0:5353"
fake_ip_range = "198.18.0.1/16"

@zhkong zhkong force-pushed the main branch 2 times, most recently from e0cc3c7 to c54154d Compare February 28, 2026 02:50
Add TUN mode settings to mihomo config override system, allowing users
to enable TUN via [mihomo_config.tun] in mihoro.toml with options for
stack, auto-route, auto-detect-interface, and dns-hijack.
@spencerwooo spencerwooo added the enhancement New feature or request label Apr 15, 2026
@spencerwooo
Copy link
Copy Markdown
Owner

Thank you for your contributions, but I'm afraid I need some more time to consider how complicated fields like dns are managed in mihoro.

Copy link
Copy Markdown
Owner

@spencerwooo spencerwooo left a comment

Choose a reason for hiding this comment

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

I would prefer if we just scope this PR to managing dns for now. TUN support is blocked on letting mihoro run as root first, so I don’t think we should land that here yet.

The dns section in mihomo is large and fairly interdependent, and we don't have the bandwidth to support partial config merging grammar in mihoro.

If we support DNS overrides in mihoro, I’d prefer mihoro to own the entire dns block when [mihomo_config.dns] is present, and otherwise leave the remote dns block untouched.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants