Skip to content

Commit d931f36

Browse files
authored
transport/wasm-ext: Support dialing Multiaddr with /p2p protocol (#2058)
Changes in 45f07bf now seem to append `/p2p/<peer>` to multiaddr passed to transports. The regex in transport/wasm-ext doesn't support this fully qualified format. This commit adjusts the regex accordingly.
1 parent 6257a8d commit d931f36

File tree

5 files changed

+10
-5
lines changed

5 files changed

+10
-5
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,13 @@
4545

4646
- Update individual crates.
4747
- `libp2p-core`
48+
- `libp2p-gossipsub`
49+
- `libp2p-wasm-ext`
4850

4951
## Version 0.37.1 [2021-04-14]
5052

5153
- Update individual crates.
5254
- `libp2p-swarm-derive`
53-
- `libp2p-gossipsub`
5455

5556
## Version 0.37.0 [2021-04-13]
5657

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ libp2p-request-response = { version = "0.11.0", path = "protocols/request-respon
7979
libp2p-swarm = { version = "0.29.0", path = "swarm" }
8080
libp2p-swarm-derive = { version = "0.23.0", path = "swarm-derive" }
8181
libp2p-uds = { version = "0.28.0", path = "transports/uds", optional = true }
82-
libp2p-wasm-ext = { version = "0.28.1", path = "transports/wasm-ext", default-features = false, optional = true }
82+
libp2p-wasm-ext = { version = "0.28.2", path = "transports/wasm-ext", default-features = false, optional = true }
8383
libp2p-yamux = { version = "0.32.0", path = "muxers/yamux", optional = true }
8484
multiaddr = { package = "parity-multiaddr", version = "0.11.2", path = "misc/multiaddr" }
8585
parking_lot = "0.11.0"

transports/wasm-ext/CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# 0.28.2 [2021-04-27]
2+
3+
- Support dialing `Multiaddr` with `/p2p` protocol [PR
4+
2058](https://github.com/libp2p/rust-libp2p/pull/2058).
5+
16
# 0.28.1 [2021-04-01]
27

38
- Require at least js-sys v0.3.50 [PR
@@ -45,4 +50,3 @@
4550
- Updated dependencies.
4651
- Support `/dns` in the websocket implementation
4752
([PR 1626](https://github.com/libp2p/rust-libp2p/pull/1626))
48-

transports/wasm-ext/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "libp2p-wasm-ext"
3-
version = "0.28.1"
3+
version = "0.28.2"
44
authors = ["Pierre Krieger <[email protected]>"]
55
edition = "2018"
66
description = "Allows passing in an external transport in a WASM environment"

transports/wasm-ext/src/websockets.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export const websocket_transport = () => {
3131

3232
/// Turns a string multiaddress into a WebSockets string URL.
3333
const multiaddr_to_ws = (addr) => {
34-
let parsed = addr.match(/^\/(ip4|ip6|dns4|dns6|dns)\/(.*?)\/tcp\/(.*?)\/(ws|wss|x-parity-ws\/(.*)|x-parity-wss\/(.*))$/);
34+
let parsed = addr.match(/^\/(ip4|ip6|dns4|dns6|dns)\/(.*?)\/tcp\/(.*?)\/(ws|wss|x-parity-ws\/(.*)|x-parity-wss\/(.*))(|\/p2p\/[a-zA-Z0-9]+)$/);
3535
if (parsed != null) {
3636
let proto = 'wss';
3737
if (parsed[4] == 'ws' || parsed[4].startsWith('x-parity-ws/')) {

0 commit comments

Comments
 (0)