Skip to content

dns: enable Moshpit names on the machine, on any OS - #141

Merged
ralyodio merged 1 commit into
mainfrom
feat/dns-enable
Jul 31, 2026
Merged

dns: enable Moshpit names on the machine, on any OS#141
ralyodio merged 1 commit into
mainfrom
feat/dns-enable

Conversation

@ralyodio

Copy link
Copy Markdown
Contributor

moshcode dns could 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.

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

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:

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 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-run prints 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

  • Routing up, bridge down → every Moshpit name fails instead of falling through. status says so loudly.
  • Routing is a snapshot. Arbitrary endings share no suffix, so all ~200 claimed TLDs are enumerated; one claimed later won't resolve until enable is re-run. status compares 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 enable output 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

`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>
@github-actions

Copy link
Copy Markdown

vu1nz Security Review

0 finding(s) in PR #?

No security issues found.

@ralyodio
ralyodio merged commit 8e65ab8 into main Jul 31, 2026
3 checks passed
@ralyodio
ralyodio deleted the feat/dns-enable branch July 31, 2026 10:32
@ralyodio ralyodio mentioned this pull request Jul 31, 2026
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>
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