Tunnels for your services, coorperatively coordinated over AT Protocol.

Serve a site from a browser tab, with DNS-over-HTTPS fallback and pluggable usage #22

Open byjp.me
targeting main from browser-demo-v2
Open opened by byjp.me
targeting main from browser-demo-v2

Replaces the earlier browser-demo PR, which targeted a branch that has since merged and predated the WebSocket-only tunnel. Ported onto today's main, with JP's two decisions.

DNS-over-HTTPS as a fallback (dns.Lookup, dns.DoH, dns.ConfirmWith, dns.ErrUnreachable, Config.Resolvers)

  • Confirmation still asks the zone's nameservers directly. Only when a round reaches none of them does it switch to DNS-over-HTTPS: Cloudflare's and Google's by default, both of which must serve the change. Embedders can choose other resolvers with Config.Resolvers.
  • The fallback allows 5 extra minutes, for resolver negative caches and our 300 s TTL. Where port 53 is silently dropped, each confirmation spends up to about 15 s on direct queries before falling back.
  • In a browser it goes straight to DNS-over-HTTPS (platform_js.go).
  • Caveat: a resolver serving the change shows that at least one nameserver does, not that all of them do. That's weaker than the direct check for the CAA-before-issuance ordering.

Pluggable client usage (ingress.Config.Usage, ingress.NoUsage)

  • Usage has two methods: Listener(ln, provider, hostname) and Day(t, hostname). Nil means the existing disk-backed counter.
  • NoUsage leaves the listener unwrapped. Each day's check reads not-tracked, as do status and jetbridge-client usage. Listen refuses OnDisagreement other than Notify with it.
  • usage.Open("")'s in-memory mode is gone. The provider's usage is untouched.

The demo (examples/browser, hack/browser-demo.sh)

  • js/wasm: an acmez ACME issuer and a dial-free transport, so requests go through fetch.
  • localStorage for keys and certificates, handles resolved without DNS, NoUsage, DNS-over-HTTPS confirmation.
  • Loaded in Chrome: cross-origin fetch and both DNS-over-HTTPS resolvers answered. A full route bring-up needs real credentials and hasn't been run.

For review (prose): README section "Serve from a browser tab" and a not-tracked line in the results list; docs/plan.md; docs/spikes.md §10; .changeset/dns-over-https-fallback.md (patch), .changeset/pluggable-usage.md (minor), .changeset/browser-demo.md (minor). The demo page keeps four lines of explanatory copy from the old branch, not redesigned.

The last commit fixes the usage commit (Listen now refuses a Store with no UsageDir before writing anything). Squash it if you prefer.

Commits 7

Refuse a Store with no UsageDir before Listen writes anything
Describe the browser demo in the README, the plan and the next release
Serve a site from a browser tab
Let embedders turn the client's usage counting off
Order certificates and reach providers through fetch in a browser
Plan pluggable usage counting for the client, with a stub that counts nothing
Confirm DNS changes over DNS-over-HTTPS when the nameservers can't be reached