diff --git a/.env.example b/.env.example index 336cee7..6753f8f 100644 --- a/.env.example +++ b/.env.example @@ -113,3 +113,11 @@ RAILWAY_API_TOKEN= # 'queries' logs one line per query (no client addresses are stored anywhere), # 'off' silences startup lines too. # MOSHPIT_DNS_LOG= + +# The resolvers advertised on pit.moshcode.sh/dns. Addresses, optionally named: +# MOSHPIT_DNS_RESOLVERS=dns1.pit.moshcode.sh=203.0.113.7,dns2.pit.moshcode.sh=203.0.113.8 +# Unset, the page says the resolvers are not published yet and explains how to +# run one — it never invents an address for someone to paste into their network +# settings. Set on the WEB app (the resolver process does not read these). +# MOSHPIT_DNS_RESOLVERS= +# MOSHPIT_DOH_URL=https://dns.pit.moshcode.sh/dns-query diff --git a/app/globals.css b/app/globals.css index 0f2d2cd..bab2b4a 100644 --- a/app/globals.css +++ b/app/globals.css @@ -488,3 +488,20 @@ dialog.qhelp::backdrop { background: rgba(0,0,0,.72); backdrop-filter: blur(2px) font-family: var(--mono); background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px; } + +/* ---- /pit/dns — resolver setup (PRD 0004 R1) ---- */ +.dns-addrs { list-style: none; display: flex; flex-wrap: wrap; gap: 12px; padding: 0; margin: 0 0 18px; } +.dns-addrs li { + display: flex; flex-direction: column; gap: 4px; + background: var(--panel); border: 1px solid var(--line); + border-left: 3px solid var(--acid); border-radius: 8px; padding: 12px 16px; +} +/* The address is the thing people copy, so it gets the size and the contrast. */ +.dns-ip { font-family: var(--mono); font-size: 1.25rem; color: var(--acid); user-select: all; } +.dns-host { font-family: var(--mono); font-size: .8rem; color: var(--ash); } +.dns-pre { + background: #0b0d0a; border: 1px solid var(--line); border-left: 3px solid var(--acid); + border-radius: 8px; padding: 14px 16px; overflow-x: auto; max-width: 62ch; + font-family: var(--mono); font-size: .88rem; line-height: 1.7; color: var(--bone); +} +.dns-pre code { font-family: inherit; background: none; padding: 0; } diff --git a/app/pit/dns/page.tsx b/app/pit/dns/page.tsx new file mode 100644 index 0000000..a65d287 --- /dev/null +++ b/app/pit/dns/page.tsx @@ -0,0 +1,185 @@ +import type { Metadata } from "next"; +import Nav from "@/components/Nav"; +import { resolverConfig } from "@/lib/moshpit-resolvers"; + +export const runtime = "nodejs"; +export const dynamic = "force-dynamic"; + +export const metadata: Metadata = { + title: "Moshpit DNS — reach .moshpit without an extension", + description: + "Point your device at the Moshpit resolvers and custom TLDs resolve like any other name. The rest of the internet keeps working.", +}; + +/** + * pit.moshcode.sh/dns — the setup instructions for the public resolvers. + * + * The addresses come from the environment (see lib/moshpit-resolvers.ts): a + * page that hardcoded them would keep telling people to use a box that moved. + * When none are configured the page says so plainly and explains how to run + * one, because inventing an address for someone to paste into their network + * settings is worse than admitting the resolvers are not up yet. + */ +export default function MoshpitDnsPage() { + const { resolvers, doh, published } = resolverConfig(); + + return ( +
+ moshpit dns +
+
+ Moshpit names live outside the traditional DNS root, so a normal browser has
+ nowhere to look them up. These resolvers know where. Point a laptop, a phone or a
+ whole router at one and .moshpit, .eggs,{" "}
+ .yeah resolve like any other name — while .com,{" "}
+ .org and the rest of the internet keep working exactly as before,
+ forwarded on to 8.8.8.8 and 1.1.1.1.
+
+ No extension, no app, no account. Every operating system already has this setting. +
+// the addresses
+ {published ? ( + <> +{r.address}
+ {r.name ? {r.name} : null}
+ + Use both, in that order. The second is there so the first can be rebooted + without the namespace going with it. You type the addresses, not the names — + a resolver's own name cannot be looked up until you already have a + working resolver. +
+ > + ) : ( + <> ++ Not published yet. The resolver is built and tested, but no + public instance is announced here — and this page will not invent an address + for you to paste into your network settings. +
++ You can run your own today (see below), and it works for every name in the + namespace, not just yours. +
+ > + )} +// set it up
++, drag it to the top, Save.
+ resolvectl dns <interface> <address>{" "}
+ under systemd-resolved, or a nameserver line in{" "}
+ /etc/resolv.conf.
+ {doh}.
+ >
+ ) : (
+ <> An endpoint is published here once a resolver is up.>
+ )}
+ // check it worked
+
+ {`dig +short anything.moshpit # an address, not an error
+dig +short example.com # the ordinary internet, still fine
+
+nslookup anything.moshpit # the Windows spelling`}
+
+
+ A TXT lookup on any Moshpit name reports which registry and gateway
+ answered, which is the fastest way to tell a resolver problem from a site problem.
+
// what still breaks
+
+ https:// on a Moshpit name will warn. No public certificate authority
+ will issue a certificate for scrambled.eggs, because none of them
+ recognise a namespace that does not descend from the ICANN root. Plain{" "}
+ http:// works, and so does the clearnet page for the name here on{" "}
+ pit.moshcode.sh. A certificate authority you opt into is the real
+ answer, and it is not built yet.
+
+ Clearnet lookups are forwarded to Google and Cloudflare, which is what a forwarder + does — run your own resolver if that trade is wrong for you, and point it wherever + you like. +
+// run your own
++ The resolver is in the open, has no dependencies and no database, and reads the + registry over ordinary HTTPS. Nothing about it privileges ours — a private pit + points at a different registry, a household one runs on whatever is already on the + shelf. +
+
+ {`git clone https://github.com/moshcoder/moshcoding
+cd moshcoding && bun run dns # port 5354, no privileges needed
+
+dig @127.0.0.1 -p 5354 +short anything.moshpit`}
+
+ + Setup, deployment and the operating notes:{" "} + + docs/moshpit-dns.md + + . Claim a name first over at the pit. +
+// reaching a .moshpit address
These names live outside the traditional DNS root, so a normal browser doesn't
- know where to look. This page is the way in until the resolver ships: names are
- registered and looked up here over ordinary HTTPS, and{" "}
- pit.moshcode.sh stays a working entry point for anyone without it.
+ know where to look. Two ways in.{" "}
+
+ Point your device at the Moshpit resolvers
+ {" "}
+ and .anything resolves everywhere on that device — one setting, no
+ install, and the rest of the internet keeps working. Or skip it: names are
+ registered and looked up here over ordinary HTTPS, and pit.moshcode.sh{" "}
+ stays a working entry point for anyone who has changed nothing.
The browser extension that resolves .anything natively is not out yet.
diff --git a/docs/moshpit-dns.md b/docs/moshpit-dns.md
index 8b14955..6725873 100644
--- a/docs/moshpit-dns.md
+++ b/docs/moshpit-dns.md
@@ -98,9 +98,20 @@ dns2.pit A