Skip to content

feat(transport,dmsg): browser-native WT dial for the std-Go wasm visor (build-tag fix)#3305

Merged
0pcom merged 1 commit into
skycoin:developfrom
0pcom:feat/wasm-wt-dial-path
Jun 26, 2026
Merged

feat(transport,dmsg): browser-native WT dial for the std-Go wasm visor (build-tag fix)#3305
0pcom merged 1 commit into
skycoin:developfrom
0pcom:feat/wasm-wt-dial-path

Conversation

@0pcom

@0pcom 0pcom commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

Part of the WebTransport carrier build — the wasm dial side.

DialWebTransportJS (the syscall/js WebTransport adapter) and the transport-layer wt_browser.go that calls it were gated tinygo && js && wasm, so the std-Go js/wasm visor compiled wt_native.go instead — webtransport-go/quic-go, which can't open UDP in a browser. So a std-Go wasm visor could never dial WT. (WS avoided this because coder/websocket has a real js implementation; quic-go does not.)

Retag by browser-vs-native (the real distinction)

transport/network:

  • wt_native.go !tinygo!tinygo && !(js && wasm) (native only)
  • wt_browser.go tinygo && js && wasmjs && wasm (any browser) + now provides the Start + resolveWTViaAR stubs a browser needs (can't serve, no AR)
  • wt_tinygo.go tinygotinygo && !(js && wasm) (embedded only) so it doesn't collide with wt_browser on tinygo-wasm

dmsg:

  • wt.go !tinygo!tinygo && !(js && wasm); wt_js_tinygo.go tinygo && js && wasmjs && wasm
  • shared wsAddr/wsTimeoutError move to a new jsaddr_js.go (js && wasm) so both the WS (tinygo-only) and WT (all-js) browser adapters get them
  • the dmsg WS session dial is untouched (coder/websocket, ws.go) — the wasm visor's lifeline is unaffected

Verified

Native + std-Go js/wasm (cmd/wasm-visor) build clean. Symbol-consistent for tinygo-wasm + tinygo-embedded (helpers moved to a file both include; no new redeclarations; the tinygo net/http roundtrip_js error is pre-existing, unrelated).

Enabling change — the wasm autoconnect dialing WT (multi-type) is the next PR.

🤖 Generated with Claude Code

…r (build-tag fix)

The browser WebTransport dial (DialWebTransportJS, a syscall/js adapter) and the
transport-layer wt_browser.go that calls it were gated `tinygo && js && wasm`, so
the STD-Go js/wasm visor compiled the native wt_native.go path instead —
webtransport-go/quic-go, which can't open UDP in a browser. So a std-Go wasm
visor could never dial WT. (WS got away with the analogous gate because
coder/websocket has a real js implementation; quic-go does not.)

Retag by browser-vs-native, not tinygo-vs-native — the real distinction:
- transport/network: wt_native.go !tinygo → `!tinygo && !(js && wasm)` (native
  only); wt_browser.go `tinygo && js && wasm` → `js && wasm` (any browser) and it
  now also provides the Start + resolveWTViaAR stubs a browser needs (can't serve,
  no AR); wt_tinygo.go `tinygo` → `tinygo && !(js && wasm)` (embedded only) so it
  doesn't collide with wt_browser on tinygo-wasm.
- dmsg: wt.go !tinygo → `!tinygo && !(js && wasm)`; wt_js_tinygo.go
  `tinygo && js && wasm` → `js && wasm`. The shared wsAddr/wsTimeoutError helpers
  move to a new jsaddr_js.go (`js && wasm`) so both the WS (tinygo-only) and WT
  (all-js) browser adapters get them. The dmsg WS session dial is untouched
  (coder/websocket, ws.go) — the wasm visor's lifeline is unaffected.

Builds verified: native, std-Go js/wasm (cmd/wasm-visor). Symbol-consistent for
tinygo-wasm + tinygo-embedded (helpers moved to a file both include; no new
redeclarations). Enabling change — the wasm autoconnect dialing WT is the next PR.
@0pcom
0pcom merged commit 146e900 into skycoin:develop Jun 26, 2026
0pcom added a commit that referenced this pull request Jun 26, 2026
…lic visor (#3306)

A native visor makes BOTH stcpr and sudph to the same public visors (autoconnect.go)
for redundancy + path diversity. The browser analog is WS (TCP) + WT (QUIC); until
now the wasm autoconnect dialed only WS.

The autoconnect now dials both carriers to each public visor:
- WS rides the stcpr cmux port (resolve stcpr IP, ws://ip:port/) — unchanged.
- WT: new arDmsg.resolveWT fetches the peer's AR WT record (/resolve/wt) — the
  https://host:port/skywire endpoint + the pinned self-signed cert hash (stored by
  BindWT) — sets the wtTable entry and SaveTransport(WT). Needs the browser-native
  WT dial (#3305) and the AR WT records (#3302/#3303 deployed).

Counts DISTINCT visors now (a peer may hold both a WS and a WT transport), and a
peer with no WT record (404) just gets WS — graceful until the fleet registers WT.
Refreshes the committed wasm blob.
0pcom added a commit that referenced this pull request Jul 7, 2026
…r (build-tag fix) (#3305)

The browser WebTransport dial (DialWebTransportJS, a syscall/js adapter) and the
transport-layer wt_browser.go that calls it were gated `tinygo && js && wasm`, so
the STD-Go js/wasm visor compiled the native wt_native.go path instead —
webtransport-go/quic-go, which can't open UDP in a browser. So a std-Go wasm
visor could never dial WT. (WS got away with the analogous gate because
coder/websocket has a real js implementation; quic-go does not.)

Retag by browser-vs-native, not tinygo-vs-native — the real distinction:
- transport/network: wt_native.go !tinygo → `!tinygo && !(js && wasm)` (native
  only); wt_browser.go `tinygo && js && wasm` → `js && wasm` (any browser) and it
  now also provides the Start + resolveWTViaAR stubs a browser needs (can't serve,
  no AR); wt_tinygo.go `tinygo` → `tinygo && !(js && wasm)` (embedded only) so it
  doesn't collide with wt_browser on tinygo-wasm.
- dmsg: wt.go !tinygo → `!tinygo && !(js && wasm)`; wt_js_tinygo.go
  `tinygo && js && wasm` → `js && wasm`. The shared wsAddr/wsTimeoutError helpers
  move to a new jsaddr_js.go (`js && wasm`) so both the WS (tinygo-only) and WT
  (all-js) browser adapters get them. The dmsg WS session dial is untouched
  (coder/websocket, ws.go) — the wasm visor's lifeline is unaffected.

Builds verified: native, std-Go js/wasm (cmd/wasm-visor). Symbol-consistent for
tinygo-wasm + tinygo-embedded (helpers moved to a file both include; no new
redeclarations). Enabling change — the wasm autoconnect dialing WT is the next PR.
0pcom added a commit that referenced this pull request Jul 7, 2026
…lic visor (#3306)

A native visor makes BOTH stcpr and sudph to the same public visors (autoconnect.go)
for redundancy + path diversity. The browser analog is WS (TCP) + WT (QUIC); until
now the wasm autoconnect dialed only WS.

The autoconnect now dials both carriers to each public visor:
- WS rides the stcpr cmux port (resolve stcpr IP, ws://ip:port/) — unchanged.
- WT: new arDmsg.resolveWT fetches the peer's AR WT record (/resolve/wt) — the
  https://host:port/skywire endpoint + the pinned self-signed cert hash (stored by
  BindWT) — sets the wtTable entry and SaveTransport(WT). Needs the browser-native
  WT dial (#3305) and the AR WT records (#3302/#3303 deployed).

Counts DISTINCT visors now (a peer may hold both a WS and a WT transport), and a
peer with no WT record (404) just gets WS — graceful until the fleet registers WT.
Refreshes the committed wasm blob.
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