Skip to main content

Module addr

Module addr 

Source
Expand description

Address normalization — libp2p multiaddr → WebSocket URL.

The compiled path dials peers with libp2p multiaddrs (/ip4/127.0.0.1/tcp/9944); the interpreter rides the thin WS relay, which speaks ws://. To keep one surface across both runtimes a program can write Connect to "/ip4/127.0.0.1/tcp/9944" and have the interpreter accept it — this maps the multiaddr to the relay’s ws://host:port. Raw ws:///wss:// URLs pass through unchanged, so either form works.

Pure string logic, no libp2p, no target gating — it compiles into the native binary and the wasm bundle alike, so the interpreter normalizes addresses the same way on both.

Functions§

canonical_topic
The canonical relay topic for a peer address — its stable identity on the relay, computed identically by both endpoints.
multiaddr_to_ws_url
Normalize a peer address to a WebSocket URL the relay can dial.