Skip to content

feat(iroh-relay): connect over a host datagram pipe on wasm32-wasip2 - #2

Open
lann wants to merge 1 commit into
mainfrom
wasi-relay-datagram-pipe
Open

feat(iroh-relay): connect over a host datagram pipe on wasm32-wasip2#2
lann wants to merge 1 commit into
mainfrom
wasi-relay-datagram-pipe

Conversation

@lann

@lann lann commented Aug 7, 2026

Copy link
Copy Markdown
Owner

Adds a wasm_wasi arm to ClientBuilder::connect. On wasi components the websocket lives host-side behind a datagram bridge; the guest reaches it through a synthetic UDP socket at a well-known address (127.0.0.1:1). The new DatagramPipe carries one websocket message per datagram (0x00 open/ack with subprotocol negotiation, 0x01 message, 0x02 closed) and implements the BytesStreamSink surface, so it replaces WsBytesFramed wholesale — the in-band challenge-response handshake and the relay protocol codec run over it unchanged. Like the browser branch it exports no TLS keying material, which routes the handshake down the challenge-response path.

This is the relay-dialer seam from polymorph-components/polymorph-iroh#25: the piece that lets the unmodified iroh endpoint run relay-only on wasip2 under jco/JSPI (Node and browsers), validated end to end there (connect-through-relay, live migration, stock iroh-blobs transfers, public demo). The bridge protocol is the part most likely to want upstream design discussion — it assumes a host that terminates the websocket and speaks the tagged-datagram framing.

Siblings: the iroh-dns resolver-config fallback and the net_report probe gate. Merged together into the long-lived polymorph-iroh branch that the component experiments consume.

Add a `wasm_wasi` arm to `ClientBuilder::connect`: on wasi components
the websocket lives host-side behind a datagram bridge, and the guest
reaches it through a synthetic UDP socket at a well-known address. The
new `DatagramPipe` carries one websocket message per datagram and
implements the `BytesStreamSink` surface, so it replaces
`WsBytesFramed` wholesale; subprotocol negotiation happens at the
bridge and the in-band challenge-response handshake runs over the pipe,
exactly like the browser branch (no TLS keying material export).

Part of running iroh on wasm32-wasip2 components
(polymorph-components/polymorph-iroh#25).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant