Skip to content

Commit

Permalink
transport/wasm-ext: Support dialing Multiaddr with /p2p protocol (#…
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
appaquet committed Apr 27, 2021
1 parent 6257a8d commit d931f36
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,13 @@

- Update individual crates.
- `libp2p-core`
- `libp2p-gossipsub`
- `libp2p-wasm-ext`

## Version 0.37.1 [2021-04-14]

- Update individual crates.
- `libp2p-swarm-derive`
- `libp2p-gossipsub`

## Version 0.37.0 [2021-04-13]

Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ libp2p-request-response = { version = "0.11.0", path = "protocols/request-respon
libp2p-swarm = { version = "0.29.0", path = "swarm" }
libp2p-swarm-derive = { version = "0.23.0", path = "swarm-derive" }
libp2p-uds = { version = "0.28.0", path = "transports/uds", optional = true }
libp2p-wasm-ext = { version = "0.28.1", path = "transports/wasm-ext", default-features = false, optional = true }
libp2p-wasm-ext = { version = "0.28.2", path = "transports/wasm-ext", default-features = false, optional = true }
libp2p-yamux = { version = "0.32.0", path = "muxers/yamux", optional = true }
multiaddr = { package = "parity-multiaddr", version = "0.11.2", path = "misc/multiaddr" }
parking_lot = "0.11.0"
Expand Down
6 changes: 5 additions & 1 deletion transports/wasm-ext/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 0.28.2 [2021-04-27]

- Support dialing `Multiaddr` with `/p2p` protocol [PR
2058](https://github.com/libp2p/rust-libp2p/pull/2058).

# 0.28.1 [2021-04-01]

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

2 changes: 1 addition & 1 deletion transports/wasm-ext/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "libp2p-wasm-ext"
version = "0.28.1"
version = "0.28.2"
authors = ["Pierre Krieger <pierre.krieger1708@gmail.com>"]
edition = "2018"
description = "Allows passing in an external transport in a WASM environment"
Expand Down
2 changes: 1 addition & 1 deletion transports/wasm-ext/src/websockets.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const websocket_transport = () => {

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

0 comments on commit d931f36

Please sign in to comment.