Repository navigation
v0.6.0
v0.6.0 — Routers
- 🧭 Routers. A
routeroption onVerifiedSource,VerifiedFileandVerifiedAssetfinds a CID's hosts at runtime, from a content-routing index, a gateway or a table, so a page can ship only its anchor: every byte still verifies against it. - 📡 Routers learn. A router can also carry the requests: it gets each one's verdict,
verified,rejected,failedorunused, and so learns which hosts serve, how fast, and which lie. - 🔁 Smarter failover. A location that fails now moves behind the ones that have not failed until it serves again, and one that serves wrong bytes stays banned for the whole session, for that CID only.
- ⚡ No wait for hints. A page that configures its locations and names a
hintsdocument sends its first requests at once, and fetches the document in the background. - 📦 Bare manifests.
pack assetsalso writes a bundle's manifest block beside its CAR (bundle.car→bundle.masl), the file a router names for a bundle; clients accept it wherever they read a bundle proof.
Detailed changes
Added
- Routers (
SPEC.md§6): every location now comes from a router. The built-in one followssource,proofandhintsas before; arouteroption onVerifiedSource,VerifiedFileandVerifiedAssetreplaces it with your own — a content-routing index, a gateway, a table — so a page can ship only its anchor and find hosts at runtime. A router'slocate(cid, { defaults })yields the URLs of a CID's bytes, best first, and gets the built-in router's locations asdefaults, so its yield order is its strategy: the page's own hosts first, its own first, or whichever answer first. The client reads the stream lazily, taking the next location only when the ones it holds have failed, and asks again once all have. A located URL is where the CID's own bytes are, the rule of FISL: for a ranged file's anchor that is{proof}/root, and the client reads the proof tree beside it. A router may also carry the requests (fetch): each comes with the CID, the location, the client's own fetch, and a verdict —verified,rejected,failedorunused— so a router learns which hosts serve, how fast, and which lie, and can add credentials. Routers are as untrusted as hints documents: every byte still verifies against the anchor. The README shows a router over a FISL index in a few lines. pack assetsalso writes the manifest block alone beside the CAR (bundle.car→bundle.masl): the anchor's own bytes, the file a router names for a bundle. Clients accept a bare manifest block wherever they read a bundle proof: a body that hashes to the anchor is the block, anything else is read as a CAR.
Changed
- A failing location is demoted. A location that fails in transport — a network error, a non-2xx status, a
200to aRangerequest, a missing proof file — now moves behind the ones that have not failed until it serves again, instead of being tried first on every read; a fetch asks the router for a fresh location before going back to it, and gives up after 16 failed locations. A location that serves wrong bytes is still banned, now for the client's whole session (a failed open no longer forgets it), and only for the CID it got wrong: for any other it is demoted. - Explicit hints documents no longer hold up the open. A page that configures its locations and names a
hintsdocument sendsroot, the first proof piece and the first read's range at once, and fetches the document in the background; its URLs still back up the configured ones. - A bundle file that fails verification at a configured base bans that file's URL, not the whole base: the base still serves the bundle's other files.
- The router specification lands in
SPEC.mdas §6 Routers; the previous §6–§9 (Hosts, Publishing, IPFS interoperability, Non-goals) are renumbered §7–§10.
Fixed
- A response body that arrives in one piece is copied before it is verified: a
fetchFn(or a router'sfetch) that reuses its buffers can no longer change bytes after they verified. - A read whose signal aborts stops waiting for a file's open or a bundle's manifest; the open goes on for other reads.
Full Changelog: v0.5.0...v0.6.0