dns: enable Moshpit names on the machine, on any OS - #141
Merged
Conversation
`moshcode dns` could print a systemd-resolved config and run a resolver in the
foreground. Everything between those two — actually applying the routing,
keeping the bridge alive, saying whether it worked — was left to the reader,
and only Linux was covered at all.
moshcode dns enable run the bridge and route Moshpit TLDs to it
moshcode dns disable stop it and remove the routing
moshcode dns status what is running, what is routed, does it work
Each OS gets the mechanism that routes ONE SUFFIX rather than the one that
replaces the machine's resolver:
macOS /etc/resolver/<tld>, read per query — nothing to restart
Linux systemd-resolved `Domains=~tld` routing-only domains, or dnsmasq
Windows one NRPT rule per namespace
That choice is the whole safety story. Becoming the machine's nameserver would
put every lookup on the box behind this bridge; routing only the Moshpit TLDs
means the worst failure is that Moshpit names stop working.
Windows NRPT rules have nowhere to put a port, so the bridge must be on 53
there. Refused at plan time with the reason, because the runtime symptom would
be a rule that looks right pointing at a port nothing listens on.
Plans are data, not actions. `--dry-run` prints the exact file contents and
commands before anything runs — this edits system DNS under sudo, so being
inspectable first is the point — and every platform's behaviour is testable
from any platform, which is the only way the Windows and macOS paths get
exercised at all.
Two states are called out rather than left to be discovered:
- routing in place with the bridge down means every Moshpit name fails
instead of falling through, so `status` says so loudly.
- routing is a snapshot. Arbitrary endings share no suffix to match on, so
all ~200 claimed TLDs are enumerated, and one claimed later will not
resolve until enable is re-run. `status` compares the two counts and says
when they have drifted.
Not yet a systemd unit / launchd job / Windows service, so the bridge does not
survive a reboot. Said plainly in the enable output rather than discovered when
names stop resolving.
13 new tests; 43 across the dns suites.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
vu1nz Security Review0 finding(s) in PR #? No security issues found. |
Merged
ralyodio
added a commit
that referenced
this pull request
Jul 31, 2026
* chore(release): v0.13.3 install.sh resolves releases/latest, so everything merged since v0.13.2 has been sitting on main unreachable — `moshcode dns enable` exists in the source and not in anyone's binary. The headline is the DNS bridge (#141). Moshpit names now resolve for every program on the machine, not just inside TronBrowser: each OS gets the mechanism that routes ONE SUFFIX rather than the one that replaces the resolver — /etc/resolver on macOS, systemd-resolved routing-only domains or dnsmasq on Linux, an NRPT rule per namespace on Windows. moshcode dns enable / disable / status moshcode uninstall <engine|tool> (#150, completion in #151) The pit gained most of a namespace registry in between: key pins per name (#137), pasted bulk claiming with per-line price and target (#138, #142, #143, #146), all-numeric endings (#147), /n/<name> serving a name or a directory (#145, #149), and Buy Now on an unclaimed name (#148). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * chore: restore the em-dash the version bump escaped The bump rewrote package.json through a JSON serialiser that defaults to ASCII, turning the em-dash in `description` into —. Valid JSON and the same string once parsed, but a gratuitous diff in a commit that should touch one line. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
moshcode dnscould print a systemd-resolved config and run a resolver in the foreground. Everything between those two — applying the routing, keeping the bridge alive, saying whether it worked — was left to the reader, and only Linux was covered.This makes Moshpit resolution work for curl, any browser, any app — not just TronBrowser.
One suffix, not the whole resolver
Each OS gets the mechanism that routes a single suffix rather than the one that replaces the machine's nameserver:
/etc/resolver/<tld>, read per query — nothing to restartDomains=~tldrouting-only domains, or dnsmasqThat choice is the whole safety story. Becoming the machine's nameserver would put every lookup on the box behind this bridge; routing only the Moshpit TLDs means the worst failure is that Moshpit names stop working.
Windows can't express a port
NRPT rules have nowhere to put one, so the bridge must be on 53 there. Refused at plan time with the reason — the runtime symptom would be a rule that looks correct pointing at a port nothing listens on.
Plans are data
--dry-runprints the exact file contents and commands before anything runs. This edits system DNS under sudo, so being inspectable first is the point. It also means every platform's behaviour is testable from any platform — the only way the Windows and macOS paths get exercised at all.Two states called out rather than discovered
statussays so loudly.enableis re-run.statuscompares the counts and reports drift.Known limitation
Not yet a systemd unit / launchd job / Windows service, so the bridge doesn't survive a reboot. Stated in the
enableoutput rather than discovered when names stop resolving. Natural follow-up.Tests
13 new, 43 across the dns suites. Full-suite run exceeds 2 minutes locally (pre-existing slow tests), so it's running separately — I'll report if anything else breaks.
🤖 Generated with Claude Code