Add a 🤘 Pit toggle: resolve Moshpit names for the session, like the Tor toggle - #102
Merged
Merged
Conversation
…or toggle The AI sidebar gets a Pit button next to Tor. The launcher's helper (now 3.3.0) serves /pit/start, /pit/stop and /pit/status: a loopback SOCKS5 resolver on 127.0.0.1:9081 that answers through the Moshpit DNS-over-HTTPS resolver and relays the connection. The extension installs a PAC that sends only hosts the system resolver has no answer for to it, so clearnet names are never touched, nothing on the machine changes and no root is needed. Session-scoped and exclusive with Tor (the PAC asks the system resolver, which under Tor would leak lookups). Whole-machine resolution is still moshcode dns enable; the settings copy now says both. Fix along the way: closing a listening socket from another thread does not wake accept(), so /pit/stop left the port bound; the listener now polls a stop flag and stop() joins before replying. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
ThreatCrush Security Scan53 finding(s) HIGH/CRITICAL: 1 | MEDIUM: 32 | LOW: 20
…and 3 more. Full results in the Security tab. Snippets are redacted; ThreatCrush never prints matched credential material. |
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.
What
A 🤘 Pit button in the AI sidebar, next to 🧅 Tor, that turns Moshpit name resolution on and off for the running browser session. Asked for as "just a button like the tor one", and built the same way.
How it works
launcher/tron-tor-helper(→ 3.3.0)/pit/start,/pit/stop,/pit/status./pit/startbinds a loopback SOCKS5 resolver on 127.0.0.1:9081 that answers names through the Moshpit DoH resolver (https://dns.moshcode.sh/dns-query, RFC 8484, TTL-cached) and relays the connection; it probesmosh.eggsso the toggle can report that names really resolve. Nothing listens or is contacted until the toggle asks.extensions/ai-sidebar/pit-proxy.jsFindProxyForURLcallsdnsResolve(host): anything the system resolver can answer goes DIRECT, untouched; only a host it has no answer for goes to the pit. That is the house policy (clearnet wins, pit as fallback) with no ending list to fetch — real TLDs like.io/.devare claimed as Moshpit endings too, so a list could not decide. Notmandatory, so a broken PAC degrades to DIRECT.background.jspit-set/pit-statusmessages, PIT badge, session-scoped state (off on every fresh launch, like Tor). Tor and the pit are exclusive: the PAC asks the system resolver about every host, which under Tor would leak lookups, so turning Tor on takes the pit down and enabling the pit under Tor is refused with a reason.sidepanel.*showNetStatus/hideNetStatussince both toggles share it.options.htmlmoshcode dns enablefor the whole machine, 🤘 Pit for this session.launcher/tronbrowserHELPER_VERSIONbumped to 3.3.0 so a running 3.2.8 helper is replaced on next launch.docs/moshpit-pit-toggle.mdWhole-machine resolution is still
moshcode dns enable; this is the no-root, this-browser-only alternative the pit's own DNS page promises.Fix found while testing
Closing a listening socket from another thread does not wake a blocked
accept(), so the first cut of/pit/stopreplied{"stopped": true}while the port stayed bound. The listener now polls a stop flag with a short accept timeout andstop()joins before replying.Verified
pnpm testinapps/desktop: 136 tests pass across 11 files, including 6 new PAC tests (unresolvable host → SOCKS5, resolvable → DIRECT, loopback/intranet/IP literals → DIRECT, case + trailing dot, bad port).pnpm lintclean;sh -non the launcher;bash -nonbuild-release.sh./pit/start→ probemosh.eggs → 67.205.189.229;curl --socks5-hostname … http://mosh.eggs/→ 302 topit.moshcode.sh/n/mosh.eggs; clearnet http and https relay through the same port; unknown host → SOCKS reply 04;/pit/stopcloses the port; start again works; SIGTERM closes it.Not in this PR
https://on a pit name without the Moshpit CA still warns (the pit page documents why);moshcode dns enableinstalls the CA and the launcher already mirrors it into Chromium's trust store, so the two compose..cmdshim starts no helper) — see the doc.Ship notes
Needs a
v*tag for the helper and extension to reach users (tron upgradepulls the tagged tarball). Not browser-tested in a live TronBrowser session yet: the PAC'sdnsResolvepath and the badge are the parts to click through.🤖 Generated with Claude Code