moshcode 0.79.0 → 0.80.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/dns.mjs +18 -1
- package/src/iana-tlds.mjs +1461 -0
package/package.json
CHANGED
package/src/dns.mjs
CHANGED
|
@@ -1163,7 +1163,23 @@ export function forwardQuery(msg, upstream, { timeoutMs = 3000 } = {}) {
|
|
|
1163
1163
|
export function isOurs(name, tldSet) {
|
|
1164
1164
|
if (!(tldSet instanceof Set) || tldSet.size === 0) return false;
|
|
1165
1165
|
const parsed = parseRegistryName(name);
|
|
1166
|
-
|
|
1166
|
+
if (!parsed) return false;
|
|
1167
|
+
// A real top-level domain is never ours, whatever the registry says it sold.
|
|
1168
|
+
//
|
|
1169
|
+
// Answering for one does not add a name, it removes the internet: every
|
|
1170
|
+
// lookup under that TLD stops being forwarded and starts being answered from
|
|
1171
|
+
// a namespace that has never heard of it. `.sh` was claimed for $2 and took
|
|
1172
|
+
// `pit.moshcode.sh` — the registry every bridge fetches its endings from —
|
|
1173
|
+
// off the air for anyone running a bridge, which is a resolver that cannot
|
|
1174
|
+
// resolve the thing it needs in order to resolve. It also blackholed the real
|
|
1175
|
+
// Saint Helena ccTLD on those machines, quietly, with a parking IP.
|
|
1176
|
+
//
|
|
1177
|
+
// Checked here rather than trusted from the registry because this is the half
|
|
1178
|
+
// that protects a person who is already running a bridge, today, against
|
|
1179
|
+
// endings that were sold before anyone noticed. The registry refusing to sell
|
|
1180
|
+
// new ones is the other half and it fixes nothing already on disk.
|
|
1181
|
+
if (isRealTld(parsed.tld)) return false;
|
|
1182
|
+
return tldSet.has(parsed.tld);
|
|
1167
1183
|
}
|
|
1168
1184
|
|
|
1169
1185
|
export function createServer(options = {}) {
|
|
@@ -2320,6 +2336,7 @@ import { applyTrust, applyUntrust, createAutoTrust, trustName, verifyStockTls }
|
|
|
2320
2336
|
import { readFile, writeFile } from "node:fs/promises";
|
|
2321
2337
|
import { existsSync } from "node:fs";
|
|
2322
2338
|
import { fileURLToPath } from "node:url";
|
|
2339
|
+
import { isRealTld } from "./iana-tlds.mjs";
|
|
2323
2340
|
import { installService, removeService, serviceUnit, servicePaths, UNIT_NAME } from "./dns-service.mjs";
|
|
2324
2341
|
import {
|
|
2325
2342
|
applyPlan, daemonStatus, describePlan, detectPlatform, disablePlan, enablePlan,
|