@ai-ecoverse/slicc-kernel 1.188.1 → 1.189.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/README.md CHANGED
@@ -353,7 +353,7 @@ await kernel.run(['curl', '-sS', 'https://example.com/']);
353
353
  - **How `compiledTlsEngine(factory, module)` works:** the package's glue only instantiates from bytes. So while the engine loads, `WebAssembly.instantiate` answers that one call, which it knows by the bytes the glue was given, with an instance of `module`. Every other call goes to the real function, and the real function is back in place once the engine has loaded or failed.
354
354
  - **The option is `() => Promise<TlsEngineModule>`**, asked at the first `CONNECT` and once per kernel, so any other way of loading the engine works too.
355
355
 
356
- **DNS:** the kernel's [DNS stub](#dns) answers on `127.0.0.53` here too, over UDP and TCP, and `network: { doh }` names the DNS over HTTPS endpoint it forwards other names to, through the transport's `fetch`. With `network: { transport: fetchTransport(), doh: 'https://cloudflare-dns.com/dns-query' }`, BIND's `dig example.com`, `host` and `nslookup` need no server argument: they read `/etc/resolv.conf`, ask the stub over UDP, and ask again over TCP when an answer comes back truncated. Without `doh` (and without an [uplink](#uplink) with a `nameserver`), a name the kernel doesn't know itself is `SERVFAIL`.
356
+ **DNS:** the kernel's [DNS stub](#dns) answers on `127.0.0.53` here too, over UDP and TCP, and `network: { doh }` names the DNS over HTTPS endpoint it forwards other names to, through the transport's `fetch`. With `network: { transport: fetchTransport(), doh: 'https://cloudflare-dns.com/dns-query' }` (and an exit [uplink](#uplink) without names of its own, if programs are to connect to what they resolve), BIND's `dig example.com`, `host` and `nslookup` need no server argument: they read `/etc/resolv.conf`, ask the stub over UDP, and ask again over TCP when an answer comes back truncated. Without `doh` (and without an [uplink](#uplink) with a `nameserver`), a name the kernel doesn't know itself is `SERVFAIL`.
357
357
 
358
358
  #### A file system the Durable Object serves
359
359
 
@@ -858,8 +858,8 @@ WASIX programs get `AF_INET`/`AF_INET6` `SOCK_DGRAM` sockets, and `AF_UNIX` ones
858
858
 
859
859
  The kernel answers DNS itself, so DNS clients (BIND's `dig`, `host` and `nslookup`) see the same names as `getaddrinfo` (#1244).
860
860
  - **Where it listens:** UDP and TCP port 53 on the kernel's loopback; `/etc/resolv.conf` names `127.0.0.53`, as systemd-resolved does, but any loopback address reaches it. TCP takes several queries on one connection (2-byte length framing), at most 64 connections at once, each closed after 10 s without a query or when an answer can't be written within 10 s (a client that stops reading). Over UDP at most 64 questions are answered at once; while that many wait (on the forwarder, say), more are dropped, as by a full receive queue. Port 53 is the kernel's, as the proxy's and CDP's ports are: a program's `bind` to it, root's included, is `EADDRINUSE` on UDP and TCP, so no program can answer other users' questions, and `kernel.dial` refuses it.
861
- - **What it answers itself,** from the [kernel's resolver](#node-name): `A` and `AAAA` for `/etc/hosts` names, the node name, `localhost` and `*.localhost`, `host.slicc.internal`, and the [uplink](#uplink)'s names (a tray's `<device>.slicc.internal`, MagicDNS); `PTR` from `/etc/hosts` and the built-in entries (`127.0.0.0/8` is `localhost`). TTLs are 30 s. Answers for `localhost` and `slicc.internal` are authoritative (`aa`), and a name there that nothing knows is `NXDOMAIN`. Other types for a name the kernel knows (`MX` for `host.slicc.internal`) get an empty answer.
862
- - **Everything else** (other names, other types, other classes, address literals, an `AAAA` the uplink has no answer to, a name whose uplink lookup failed) goes to a forwarder, and there is none by default: those questions are `SERVFAIL`, and nothing leaves the kernel. An [uplink](#uplink) whose `nameserver` names its DNS server (an address it routes, such as Tailscale's `100.100.100.100`) gets them over its own TCP, length-framed as RFC 1035 has it, so they go where that uplink and its exit send them. Without one, `network: { doh }` names a DNS over HTTPS endpoint (RFC 8484, `POST`, id 0) that the [transport](#network) is asked; `doh: false` or none is no forwarder. A forwarder's answer must repeat the question (name, type and class) or it is `SERVFAIL`, as are a failed connection, an HTTP error or a non-`application/dns-message` answer, and no answer within 5 s. The answer goes back as the forwarder gave it, with the query's id. Over UDP, an answer longer than 512 bytes (or the query's EDNS size, at most 4096) comes back truncated (`tc`, no records), so the client asks again over TCP.
861
+ - **What it answers itself,** from the [kernel's resolver](#node-name): `A` and `AAAA` for `/etc/hosts` names, the node name, `localhost` and `*.localhost`, `host.slicc.internal`, and the [uplink](#uplink)'s names, those its `resolve` answers (a tray's `<device>.slicc.internal`, MagicDNS); `PTR` from `/etc/hosts` and the built-in entries (`127.0.0.0/8` is `localhost`). TTLs are 30 s. Answers for `localhost` and `slicc.internal` are authoritative (`aa`), and a name there that nothing knows is `NXDOMAIN`. Other types for a name the kernel knows (`MX` for `host.slicc.internal`) get an empty answer.
862
+ - **Everything else** (other names, other types, other classes, address literals, an `AAAA` the uplink has no answer to, a name whose uplink lookup failed) goes to a forwarder, unchanged: its CNAME chain, TTLs and authority section reach the client as the forwarder sent them. The stub never answers from what the kernel's resolver learned from that forwarder. There is no forwarder by default: those questions are `SERVFAIL`, and nothing leaves the kernel. An [uplink](#uplink) whose `nameserver` names its DNS server (an address it routes, such as Tailscale's `100.100.100.100`) gets them over its own TCP, length-framed as RFC 1035 has it, so they go where that uplink and its exit send them. Without one, `network: { doh }` names a DNS over HTTPS endpoint (RFC 8484, `POST`, id 0) that the [transport](#network) is asked; `doh: false` or none is no forwarder. A forwarder's answer must repeat the question (name, type and class) or it is `SERVFAIL`, as are a failed connection, an HTTP error or a non-`application/dns-message` answer, and no answer within 5 s. The answer goes back as the forwarder gave it, with the query's id. Over UDP, an answer longer than 512 bytes (or the query's EDNS size, at most 4096) comes back truncated (`tc`, no records), so the client asks again over TCP.
863
863
  - **What a forwarder sees:** the question's bytes as the program wrote them (id set to 0), EDNS options included, so a program can carry data to the forwarder in DNS names, as anywhere DNS is resolved. That gives no process more than it has: every process may already use the proxy and the transport, and connect to what the uplink routes; the kernel has no per-user network policy that the stub would bypass.
864
864
  - **`/etc/resolv.conf`:** at boot, the kernel writes `nameserver 127.0.0.53` and `options edns0` there when there is no such file (a symlink counts as one), owned by root with mode `0644`. A file root wrote stays, and so does none at all when `/etc/resolv.conf` is a [protected path](#protected-paths). One that root removes comes back at the next boot. It has no `search` line, because musl's `getaddrinfo` (WASIX programs) would then try every short name in that domain first.
865
865
 
@@ -888,7 +888,7 @@ Until this, `TZ` was unset, so `date` printed UTC while cron read schedules in t
888
888
  - `traits`: `{ tcp: true, udp, ipv6 }`. Without `ipv6: true`, the kernel asks only for, and keeps only, IPv4 addresses. With `udp: true` and a `udp` function, routed datagrams go through it.
889
889
  - `routes`: the first route table, `{ prefixes, exit }`, which `kernel.setRoutes` replaces when it changes. The kernel matches it itself, so a destination outside it costs no round trip.
890
890
  - `nameserver` (optional): an address the uplink routes where a DNS server answers on TCP port 53 (Tailscale: `100.100.100.100`). The kernel's [DNS](#dns) stub forwards the questions it can't answer there.
891
- - `resolve(name, family, signal)`: resolves with the name's addresses, as a list or as `{ addresses, ttl }` (seconds). `[]` means the name is not the uplink's. `family` is `4`, `6` or `0` (either), and `signal` aborts when the kernel stops waiting.
891
+ - `resolve(name, family, signal)` (optional): resolves with the name's addresses, as a list or as `{ addresses, ttl }` (seconds). `[]` means the name is not the uplink's, and an uplink without `resolve` has no names of its own. `family` is `4`, `6` or `0` (either), and `signal` aborts when the kernel stops waiting. Answer only the uplink's own names (a tailnet's, MagicDNS): the [DNS](#dns) stub answers a name the uplink resolves itself, with the kernel's TTL and no CNAME chain, and forwards every other one, so an exit uplink that resolved every name would hide the forwarder's answers from `dig` and `host`.
892
892
  - `dial({ network: 'tcp', host, port, signal })`: opens a TCP connection and resolves with `{ localAddr, remoteAddr, read(), write(bytes), closeWrite(), close() }`.
893
893
  - `read()` resolves with the next bytes, or `null` at the end.
894
894
  - `write` resolves with how many bytes it took.
@@ -898,7 +898,7 @@ Until this, `TZ` was unset, so `date` printed UTC while cron read schedules in t
898
898
 
899
899
  **Name resolution** (WASIX `sock_addr_resolve`; `Module.sliccKernel.net.resolve(name, family)` for Emscripten programs):
900
900
  - `/etc/hosts` names are answered by the kernel itself: `localhost`, every `*.localhost`, `host.slicc.internal`, and literal addresses, IPv6 included.
901
- - Any other name goes to the uplink. With no uplink or no answer, the name is not found (`EAI_NONAME`).
901
+ - Any other name goes to the uplink's `resolve`. When it has no answer (or the uplink has no `resolve`), the kernel asks the stub's [DNS forwarder](#dns) (the uplink's `nameserver`, else `network.doh`) for the name's `A` records, and `AAAA` when the uplink has `ipv6`, following its CNAME chain, with the shortest TTL of the records it keeps. So with an exit uplink that has no names of its own and `network.doh`, `getaddrinfo` and `dig` both see the forwarder's answer, and a program connects to it through the uplink's `dial`. Names under `localhost` and `slicc.internal` never go to the forwarder. With no uplink, or no answer from either (the forwarder's `NXDOMAIN` included), the name is not found (`EAI_NONAME`). A forwarder that answers `SERVFAIL` (or another error), or nothing within 10 s, fails the lookup with `ETIMEDOUT`, as an uplink that doesn't answer does, and the failure is not cached; wasix-libc's `getaddrinfo` reports that as not found too.
902
902
  - Answers are cached for their TTL, at most 60 s, so a change of exit node takes effect quickly.
903
903
  - **DNS cannot bridge into the kernel:** an answer that is loopback (`127.0.0.0/8`, `::1`), unspecified (`0.0.0.0`, `::`), the host (`10.0.2.2`), link-local, multicast or otherwise reserved, including the `::ffff:` forms, is dropped and logged with `console.warn`. A name cannot lead a program back to the kernel's loopback.
904
904
  - An uplink that does not answer within 10 s resolves nothing.
@@ -1358,7 +1358,7 @@ function createParentRefreshCount() {
1358
1358
  }
1359
1359
 
1360
1360
  // src/version.ts
1361
- var KERNEL_VERSION = true ? "1.188.1" : "0.0.0-dev";
1361
+ var KERNEL_VERSION = true ? "1.189.0" : "0.0.0-dev";
1362
1362
  var OS_RELEASE = "6.0.0-slicc";
1363
1363
  function procVersion() {
1364
1364
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC