Architectural follow-up surfaced by the spec-compliance audit. Two related gaps blocking new transports + new application protocols.
1. No generic Transport interface
src/transport/quic_runtime.zig:80 hardcodes the 13 supported protocol ids and bakes the QUIC drive loop into the runtime. To add WebTransport, /wss, or WebRTC the embedder has to either:
- write a parallel transport that re-implements the lifecycle hook contract by hand, OR
- edit
quic_runtime.zig itself.
CommandDispatchHook (swarm.zig:107) gives a per-command interception path but not a transport interface.
2. No Host.openStream(peer, protocol_id) → Stream API
host.zig exposes publish / subscribe / sendRequest only. Custom protocols outside gossipsub + req/resp + identify/ping can't be opened through the public API — application has to intercept via CommandDispatchHook and reach into transport internals.
Acceptance
This unblocks #94 (/wss/WebTransport/WebRTC follow-up), #207 (mDNS) integration shape, and #209 (rendezvous).
Severity: S2 — large refactor, but it's the bottleneck for almost every "add a transport / protocol" item.
Architectural follow-up surfaced by the spec-compliance audit. Two related gaps blocking new transports + new application protocols.
1. No generic
Transportinterfacesrc/transport/quic_runtime.zig:80 hardcodes the 13 supported protocol ids and bakes the QUIC drive loop into the runtime. To add WebTransport,
/wss, or WebRTC the embedder has to either:quic_runtime.zigitself.CommandDispatchHook(swarm.zig:107) gives a per-command interception path but not a transport interface.2. No
Host.openStream(peer, protocol_id) → StreamAPIhost.zig exposes
publish/subscribe/sendRequestonly. Custom protocols outside gossipsub + req/resp + identify/ping can't be opened through the public API — application has to intercept viaCommandDispatchHookand reach into transport internals.Acceptance
pub const Transport = struct { dial: fn ... , listen: fn ..., lifecycle: Lifecycle }insrc/transport.zigQuicRuntimeto consumeTransportinstead of being one/quic-v1,/ws,/wss, ...)Host.openStream(peer, protocol_id) → !*Streampublic API delegating to the multistream-select layerProtocolRegistrymapping multistream id → inbound handler; built-in protocols register through it instead of being hardcodedThis unblocks #94 (
/wss/WebTransport/WebRTC follow-up), #207 (mDNS) integration shape, and #209 (rendezvous).Severity: S2 — large refactor, but it's the bottleneck for almost every "add a transport / protocol" item.