mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-07-10 22:31:34 +00:00
Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
b11c6fc7e9 | |||
ebedd3510b | |||
ae6af20e8e | |||
2a80618740 | |||
5b1bd389f8 | |||
3e31c2d0df |
10
CHANGELOG.md
10
CHANGELOG.md
@ -1,3 +1,13 @@
|
||||
<a name="0.26.2"></a>
|
||||
## [0.26.2](https://github.com/libp2p/js-libp2p/compare/v0.26.1...v0.26.2) (2019-09-24)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* pubsub promisify ([#456](https://github.com/libp2p/js-libp2p/issues/456)) ([ae6af20](https://github.com/libp2p/js-libp2p/commit/ae6af20))
|
||||
|
||||
|
||||
|
||||
<a name="0.26.1"></a>
|
||||
## [0.26.1](https://github.com/libp2p/js-libp2p/compare/v0.26.0...v0.26.1) (2019-08-21)
|
||||
|
||||
|
34
README.md
34
README.md
@ -8,8 +8,9 @@
|
||||
<a href="http://ipn.io"><img src="https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square" /></a>
|
||||
<a href="http://libp2p.io/"><img src="https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square" /></a>
|
||||
<a href="http://webchat.freenode.net/?channels=%23libp2p"><img src="https://img.shields.io/badge/freenode-%23libp2p-yellow.svg?style=flat-square" /></a>
|
||||
<a href="https://riot.permaweb.io/#/room/#libp2p:permaweb.io"><img src="https://img.shields.io/badge/matrix-%23libp2p%3Apermaweb.io-blue.svg?style=flat-square" /> </a>
|
||||
<a href="https://discord.gg/66KBrm2"><img src="https://img.shields.io/discord/475789330380488707?color=blueviolet&label=discord&style=flat-square" /></a>
|
||||
<a href="https://discuss.libp2p.io"><img src="https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg" /></a>
|
||||
<a href="https://waffle.io/libp2p/libp2p"><img src="https://img.shields.io/badge/pm-waffle-yellow.svg?style=flat-square" /></a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
@ -29,9 +30,7 @@
|
||||
|
||||
We've come a long way, but this project is still in Alpha, lots of development is happening, API might change, beware of the Dragons 🐉..
|
||||
|
||||
**Want to get started?** Check our [examples folder](/examples). You can check the development status at the [Waffle Board](https://waffle.io/libp2p/js-libp2p).
|
||||
|
||||
[](https://waffle.io/libp2p/js-libp2p/metrics/throughput)
|
||||
**Want to get started?** Check our [examples folder](/examples).
|
||||
|
||||
[**`Weekly Core Dev Calls`**](https://github.com/ipfs/pm/issues/650)
|
||||
|
||||
@ -571,14 +570,11 @@ List of packages currently in existence for libp2p
|
||||
| **Transport** |
|
||||
| [`interface-transport`](//github.com/libp2p/interface-transport) | [](//github.com/libp2p/interface-transport/releases) | [](https://david-dm.org/libp2p/interface-transport) | [](https://travis-ci.com/libp2p/interface-transport) | [](https://codecov.io/gh/libp2p/interface-transport) | [Jacob Heun](mailto:jacobheun@gmail.com) |
|
||||
| [`libp2p-tcp`](//github.com/libp2p/js-libp2p-tcp) | [](//github.com/libp2p/js-libp2p-tcp/releases) | [](https://david-dm.org/libp2p/js-libp2p-tcp) | [](https://travis-ci.com/libp2p/js-libp2p-tcp) | [](https://codecov.io/gh/libp2p/js-libp2p-tcp) | [Jacob Heun](mailto:jacobheun@gmail.com) |
|
||||
| [`libp2p-udp`](//github.com/libp2p/js-libp2p-udp) | [](//github.com/libp2p/js-libp2p-udp/releases) | [](https://david-dm.org/libp2p/js-libp2p-udp) | [](https://travis-ci.com/libp2p/js-libp2p-udp) | [](https://codecov.io/gh/libp2p/js-libp2p-udp) | N/A |
|
||||
| [`libp2p-udt`](//github.com/libp2p/js-libp2p-udt) | [](//github.com/libp2p/js-libp2p-udt/releases) | [](https://david-dm.org/libp2p/js-libp2p-udt) | [](https://travis-ci.com/libp2p/js-libp2p-udt) | [](https://codecov.io/gh/libp2p/js-libp2p-udt) | N/A |
|
||||
| [`libp2p-utp`](//github.com/libp2p/js-libp2p-utp) | [](//github.com/libp2p/js-libp2p-utp/releases) | [](https://david-dm.org/libp2p/js-libp2p-utp) | [](https://travis-ci.com/libp2p/js-libp2p-utp) | [](https://codecov.io/gh/libp2p/js-libp2p-utp) | N/A |
|
||||
| [`libp2p-webrtc-direct`](//github.com/libp2p/js-libp2p-webrtc-direct) | [](//github.com/libp2p/js-libp2p-webrtc-direct/releases) | [](https://david-dm.org/libp2p/js-libp2p-webrtc-direct) | [](https://travis-ci.com/libp2p/js-libp2p-webrtc-direct) | [](https://codecov.io/gh/libp2p/js-libp2p-webrtc-direct) | [Vasco Santos](mailto:vasco.santos@moxy.studio) |
|
||||
| [`libp2p-webrtc-star`](//github.com/libp2p/js-libp2p-webrtc-star) | [](//github.com/libp2p/js-libp2p-webrtc-star/releases) | [](https://david-dm.org/libp2p/js-libp2p-webrtc-star) | [](https://travis-ci.com/libp2p/js-libp2p-webrtc-star) | [](https://codecov.io/gh/libp2p/js-libp2p-webrtc-star) | [Vasco Santos](mailto:vasco.santos@moxy.studio) |
|
||||
| [`libp2p-websockets`](//github.com/libp2p/js-libp2p-websockets) | [](//github.com/libp2p/js-libp2p-websockets/releases) | [](https://david-dm.org/libp2p/js-libp2p-websockets) | [](https://travis-ci.com/libp2p/js-libp2p-websockets) | [](https://codecov.io/gh/libp2p/js-libp2p-websockets) | [Jacob Heun](mailto:jacobheun@gmail.com) |
|
||||
| [`libp2p-websocket-star`](//github.com/libp2p/js-libp2p-websocket-star) | [](//github.com/libp2p/js-libp2p-websocket-star/releases) | [](https://david-dm.org/libp2p/js-libp2p-websocket-star) | [](https://travis-ci.com/libp2p/js-libp2p-websocket-star) | [](https://codecov.io/gh/libp2p/js-libp2p-websocket-star) | [Jacob Heun](mailto:jacobheun@gmail.com) |
|
||||
| [`libp2p-websocket-star-rendezvous`](//github.com/libp2p/js-libp2p-websocket-star-rendezvous) | [](//github.com/libp2p/js-libp2p-websocket-star-rendezvous/releases) | [](https://david-dm.org/libp2p/js-libp2p-websocket-star-rendezvous) | [](https://travis-ci.com/libp2p/js-libp2p-websocket-star-rendezvous) | [](https://codecov.io/gh/libp2p/js-libp2p-websocket-star-rendezvous) | [Jacob Heun](mailto:jacobheun@gmail.com) |
|
||||
| **Crypto Channels** |
|
||||
| [`libp2p-secio`](//github.com/libp2p/js-libp2p-secio) | [](//github.com/libp2p/js-libp2p-secio/releases) | [](https://david-dm.org/libp2p/js-libp2p-secio) | [](https://travis-ci.com/libp2p/js-libp2p-secio) | [](https://codecov.io/gh/libp2p/js-libp2p-secio) | [Friedel Ziegelmayer](mailto:dignifiedquire@gmail.com) |
|
||||
| **Stream Muxers** |
|
||||
@ -593,13 +589,6 @@ List of packages currently in existence for libp2p
|
||||
| [`libp2p-rendezvous`](//github.com/libp2p/js-libp2p-rendezvous) | [](//github.com/libp2p/js-libp2p-rendezvous/releases) | [](https://david-dm.org/libp2p/js-libp2p-rendezvous) | [](https://travis-ci.com/libp2p/js-libp2p-rendezvous) | [](https://codecov.io/gh/libp2p/js-libp2p-rendezvous) | N/A |
|
||||
| [`libp2p-webrtc-star`](//github.com/libp2p/js-libp2p-webrtc-star) | [](//github.com/libp2p/js-libp2p-webrtc-star/releases) | [](https://david-dm.org/libp2p/js-libp2p-webrtc-star) | [](https://travis-ci.com/libp2p/js-libp2p-webrtc-star) | [](https://codecov.io/gh/libp2p/js-libp2p-webrtc-star) | [Vasco Santos](mailto:vasco.santos@moxy.studio) |
|
||||
| [`libp2p-websocket-star`](//github.com/libp2p/js-libp2p-websocket-star) | [](//github.com/libp2p/js-libp2p-websocket-star/releases) | [](https://david-dm.org/libp2p/js-libp2p-websocket-star) | [](https://travis-ci.com/libp2p/js-libp2p-websocket-star) | [](https://codecov.io/gh/libp2p/js-libp2p-websocket-star) | [Jacob Heun](mailto:jacobheun@gmail.com) |
|
||||
| **NAT Traversal** |
|
||||
| [`libp2p-circuit`](//github.com/libp2p/js-libp2p-circuit) | [](//github.com/libp2p/js-libp2p-circuit/releases) | [](https://david-dm.org/libp2p/js-libp2p-circuit) | [](https://travis-ci.com/libp2p/js-libp2p-circuit) | [](https://codecov.io/gh/libp2p/js-libp2p-circuit) | [Jacob Heun](mailto:jacobheun@gmail.com) |
|
||||
| [`libp2p-nat-mngr`](//github.com/libp2p/js-libp2p-nat-mngr) | [](//github.com/libp2p/js-libp2p-nat-mngr/releases) | [](https://david-dm.org/libp2p/js-libp2p-nat-mngr) | [](https://travis-ci.com/libp2p/js-libp2p-nat-mngr) | [](https://codecov.io/gh/libp2p/js-libp2p-nat-mngr) | N/A |
|
||||
| **Data Types** |
|
||||
| [`peer-book`](//github.com/libp2p/js-peer-book) | [](//github.com/libp2p/js-peer-book/releases) | [](https://david-dm.org/libp2p/js-peer-book) | [](https://travis-ci.com/libp2p/js-peer-book) | [](https://codecov.io/gh/libp2p/js-peer-book) | [Pedro Teixeira](mailto:i@pgte.me) |
|
||||
| [`peer-id`](//github.com/libp2p/js-peer-id) | [](//github.com/libp2p/js-peer-id/releases) | [](https://david-dm.org/libp2p/js-peer-id) | [](https://travis-ci.com/libp2p/js-peer-id) | [](https://codecov.io/gh/libp2p/js-peer-id) | [Pedro Teixeira](mailto:i@pgte.me) |
|
||||
| [`peer-info`](//github.com/libp2p/js-peer-info) | [](//github.com/libp2p/js-peer-info/releases) | [](https://david-dm.org/libp2p/js-peer-info) | [](https://travis-ci.com/libp2p/js-peer-info) | [](https://codecov.io/gh/libp2p/js-peer-info) | [Pedro Teixeira](mailto:i@pgte.me) |
|
||||
| **Content Routing** |
|
||||
| [`interface-content-routing`](//github.com/libp2p/interface-content-routing) | [](//github.com/libp2p/interface-content-routing/releases) | [](https://david-dm.org/libp2p/interface-content-routing) | [](https://travis-ci.com/libp2p/interface-content-routing) | [](https://codecov.io/gh/libp2p/interface-content-routing) | N/A |
|
||||
| [`libp2p-delegated-content-routing`](//github.com/libp2p/js-libp2p-delegated-content-routing) | [](//github.com/libp2p/js-libp2p-delegated-content-routing/releases) | [](https://david-dm.org/libp2p/js-libp2p-delegated-content-routing) | [](https://travis-ci.com/libp2p/js-libp2p-delegated-content-routing) | [](https://codecov.io/gh/libp2p/js-libp2p-delegated-content-routing) | [Jacob Heun](mailto:jacobheun@gmail.com) |
|
||||
@ -608,22 +597,15 @@ List of packages currently in existence for libp2p
|
||||
| [`interface-peer-routing`](//github.com/libp2p/interface-peer-routing) | [](//github.com/libp2p/interface-peer-routing/releases) | [](https://david-dm.org/libp2p/interface-peer-routing) | [](https://travis-ci.com/libp2p/interface-peer-routing) | [](https://codecov.io/gh/libp2p/interface-peer-routing) | N/A |
|
||||
| [`libp2p-delegated-peer-routing`](//github.com/libp2p/js-libp2p-delegated-peer-routing) | [](//github.com/libp2p/js-libp2p-delegated-peer-routing/releases) | [](https://david-dm.org/libp2p/js-libp2p-delegated-peer-routing) | [](https://travis-ci.com/libp2p/js-libp2p-delegated-peer-routing) | [](https://codecov.io/gh/libp2p/js-libp2p-delegated-peer-routing) | [Jacob Heun](mailto:jacobheun@gmail.com) |
|
||||
| [`libp2p-kad-dht`](//github.com/libp2p/js-libp2p-kad-dht) | [](//github.com/libp2p/js-libp2p-kad-dht/releases) | [](https://david-dm.org/libp2p/js-libp2p-kad-dht) | [](https://travis-ci.com/libp2p/js-libp2p-kad-dht) | [](https://codecov.io/gh/libp2p/js-libp2p-kad-dht) | [Vasco Santos](mailto:vasco.santos@moxy.studio) |
|
||||
| **Record Store** |
|
||||
| [`interface-record-store`](//github.com/libp2p/interface-record-store) | [](//github.com/libp2p/interface-record-store/releases) | [](https://david-dm.org/libp2p/interface-record-store) | [](https://travis-ci.com/libp2p/interface-record-store) | [](https://codecov.io/gh/libp2p/interface-record-store) | N/A |
|
||||
| [`libp2p-record`](//github.com/libp2p/js-libp2p-record) | [](//github.com/libp2p/js-libp2p-record/releases) | [](https://david-dm.org/libp2p/js-libp2p-record) | [](https://travis-ci.com/libp2p/js-libp2p-record) | [](https://codecov.io/gh/libp2p/js-libp2p-record) | [Vasco Santos](mailto:vasco.santos@moxy.studio) |
|
||||
| **Generics** |
|
||||
| [`libp2p-connection-manager`](//github.com/libp2p/js-libp2p-connection-manager) | [](//github.com/libp2p/js-libp2p-connection-manager/releases) | [](https://david-dm.org/libp2p/js-libp2p-connection-manager) | [](https://travis-ci.com/libp2p/js-libp2p-connection-manager) | [](https://codecov.io/gh/libp2p/js-libp2p-connection-manager) | N/A |
|
||||
| **Utilities** |
|
||||
| [`libp2p-crypto`](//github.com/libp2p/js-libp2p-crypto) | [](//github.com/libp2p/js-libp2p-crypto/releases) | [](https://david-dm.org/libp2p/js-libp2p-crypto) | [](https://travis-ci.com/libp2p/js-libp2p-crypto) | [](https://codecov.io/gh/libp2p/js-libp2p-crypto) | [Friedel Ziegelmayer](mailto:dignifiedquire@gmail.com) |
|
||||
| [`libp2p-crypto-secp256k1`](//github.com/libp2p/js-libp2p-crypto-secp256k1) | [](//github.com/libp2p/js-libp2p-crypto-secp256k1/releases) | [](https://david-dm.org/libp2p/js-libp2p-crypto-secp256k1) | [](https://travis-ci.com/libp2p/js-libp2p-crypto-secp256k1) | [](https://codecov.io/gh/libp2p/js-libp2p-crypto-secp256k1) | [Friedel Ziegelmayer](mailto:dignifiedquire@gmail.com) |
|
||||
| [`libp2p-switch`](//github.com/libp2p/js-libp2p-switch) | [](//github.com/libp2p/js-libp2p-switch/releases) | [](https://david-dm.org/libp2p/js-libp2p-switch) | [](https://travis-ci.com/libp2p/js-libp2p-switch) | [](https://codecov.io/gh/libp2p/js-libp2p-switch) | [Jacob Heun](mailto:jacobheun@gmail.com) |
|
||||
| **Data Types** |
|
||||
| [`peer-book`](//github.com/libp2p/js-peer-book) | [](//github.com/libp2p/js-peer-book/releases) | [](https://david-dm.org/libp2p/js-peer-book) | [](https://travis-ci.com/libp2p/js-peer-book) | [](https://codecov.io/gh/libp2p/js-peer-book) | [Pedro Teixeira](mailto:i@pgte.me) |
|
||||
| [`peer-id`](//github.com/libp2p/js-peer-id) | [](//github.com/libp2p/js-peer-id/releases) | [](https://david-dm.org/libp2p/js-peer-id) | [](https://travis-ci.com/libp2p/js-peer-id) | [](https://codecov.io/gh/libp2p/js-peer-id) | [Pedro Teixeira](mailto:i@pgte.me) |
|
||||
| [`peer-info`](//github.com/libp2p/js-peer-info) | [](//github.com/libp2p/js-peer-info/releases) | [](https://david-dm.org/libp2p/js-peer-info) | [](https://travis-ci.com/libp2p/js-peer-info) | [](https://codecov.io/gh/libp2p/js-peer-info) | [Pedro Teixeira](mailto:i@pgte.me) |
|
||||
| **Extensions** |
|
||||
| [`libp2p-floodsub`](//github.com/libp2p/js-libp2p-floodsub) | [](//github.com/libp2p/js-libp2p-floodsub/releases) | [](https://david-dm.org/libp2p/js-libp2p-floodsub) | [](https://travis-ci.com/libp2p/js-libp2p-floodsub) | [](https://codecov.io/gh/libp2p/js-libp2p-floodsub) | [Vasco Santos](mailto:vasco.santos@moxy.studio) |
|
||||
| [`libp2p-identify`](//github.com/libp2p/js-libp2p-identify) | [](//github.com/libp2p/js-libp2p-identify/releases) | [](https://david-dm.org/libp2p/js-libp2p-identify) | [](https://travis-ci.com/libp2p/js-libp2p-identify) | [](https://codecov.io/gh/libp2p/js-libp2p-identify) | [Jacob Heun](mailto:jacobheun@gmail.com) |
|
||||
| [`libp2p-keychain`](//github.com/libp2p/js-libp2p-keychain) | [](//github.com/libp2p/js-libp2p-keychain/releases) | [](https://david-dm.org/libp2p/js-libp2p-keychain) | [](https://travis-ci.com/libp2p/js-libp2p-keychain) | [](https://codecov.io/gh/libp2p/js-libp2p-keychain) | [Vasco Santos](mailto:vasco.santos@moxy.studio) |
|
||||
| [`libp2p-ping`](//github.com/libp2p/js-libp2p-ping) | [](//github.com/libp2p/js-libp2p-ping/releases) | [](https://david-dm.org/libp2p/js-libp2p-ping) | [](https://travis-ci.com/libp2p/js-libp2p-ping) | [](https://codecov.io/gh/libp2p/js-libp2p-ping) | [Jacob Heun](mailto:jacobheun@gmail.com) |
|
||||
| [`libp2p-pnet`](//github.com/libp2p/js-libp2p-pnet) | [](//github.com/libp2p/js-libp2p-pnet/releases) | [](https://david-dm.org/libp2p/js-libp2p-pnet) | [](https://travis-ci.com/libp2p/js-libp2p-pnet) | [](https://codecov.io/gh/libp2p/js-libp2p-pnet) | [Jacob Heun](mailto:jacobheun@gmail.com) |
|
||||
| **Utilities** |
|
||||
| [`p2pcat`](//github.com/libp2p/js-p2pcat) | [](//github.com/libp2p/js-p2pcat/releases) | [](https://david-dm.org/libp2p/js-p2pcat) | [](https://travis-ci.com/libp2p/js-p2pcat) | [](https://codecov.io/gh/libp2p/js-p2pcat) | N/A |
|
||||
|
||||
## Contribute
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
"Package",
|
||||
"Version",
|
||||
"Deps",
|
||||
"CI/Travis",
|
||||
"CI",
|
||||
"Coverage",
|
||||
"Lead Maintainer"
|
||||
],
|
||||
@ -18,14 +18,11 @@
|
||||
"Transport",
|
||||
["libp2p/interface-transport", "interface-transport"],
|
||||
["libp2p/js-libp2p-tcp", "libp2p-tcp"],
|
||||
["libp2p/js-libp2p-udp", "libp2p-udp"],
|
||||
["libp2p/js-libp2p-udt", "libp2p-udt"],
|
||||
["libp2p/js-libp2p-utp", "libp2p-utp"],
|
||||
["libp2p/js-libp2p-webrtc-direct", "libp2p-webrtc-direct"],
|
||||
["libp2p/js-libp2p-webrtc-star", "libp2p-webrtc-star"],
|
||||
["libp2p/js-libp2p-websockets", "libp2p-websockets"],
|
||||
["libp2p/js-libp2p-websocket-star", "libp2p-websocket-star"],
|
||||
["libp2p/js-libp2p-websocket-star-rendezvous", "libp2p-websocket-star-rendezvous"],
|
||||
|
||||
"Crypto Channels",
|
||||
["libp2p/js-libp2p-secio", "libp2p-secio"],
|
||||
@ -44,15 +41,6 @@
|
||||
["libp2p/js-libp2p-webrtc-star", "libp2p-webrtc-star"],
|
||||
["libp2p/js-libp2p-websocket-star", "libp2p-websocket-star"],
|
||||
|
||||
"NAT Traversal",
|
||||
["libp2p/js-libp2p-circuit", "libp2p-circuit"],
|
||||
["libp2p/js-libp2p-nat-mngr", "libp2p-nat-mngr"],
|
||||
|
||||
"Data Types",
|
||||
["libp2p/js-peer-book", "peer-book"],
|
||||
["libp2p/js-peer-id", "peer-id"],
|
||||
["libp2p/js-peer-info", "peer-info"],
|
||||
|
||||
"Content Routing",
|
||||
["libp2p/interface-content-routing", "interface-content-routing"],
|
||||
["libp2p/js-libp2p-delegated-content-routing", "libp2p-delegated-content-routing"],
|
||||
@ -63,24 +51,16 @@
|
||||
["libp2p/js-libp2p-delegated-peer-routing", "libp2p-delegated-peer-routing"],
|
||||
["libp2p/js-libp2p-kad-dht", "libp2p-kad-dht"],
|
||||
|
||||
"Record Store",
|
||||
["libp2p/interface-record-store", "interface-record-store"],
|
||||
["libp2p/js-libp2p-record", "libp2p-record"],
|
||||
|
||||
"Generics",
|
||||
["libp2p/js-libp2p-connection-manager", "libp2p-connection-manager"],
|
||||
"Utilities",
|
||||
["libp2p/js-libp2p-crypto", "libp2p-crypto"],
|
||||
["libp2p/js-libp2p-crypto-secp256k1", "libp2p-crypto-secp256k1"],
|
||||
["libp2p/js-libp2p-switch", "libp2p-switch"],
|
||||
|
||||
"Data Types",
|
||||
["libp2p/js-peer-book", "peer-book"],
|
||||
["libp2p/js-peer-id", "peer-id"],
|
||||
["libp2p/js-peer-info", "peer-info"],
|
||||
|
||||
"Extensions",
|
||||
["libp2p/js-libp2p-floodsub", "libp2p-floodsub"],
|
||||
["libp2p/js-libp2p-identify", "libp2p-identify"],
|
||||
["libp2p/js-libp2p-keychain", "libp2p-keychain"],
|
||||
["libp2p/js-libp2p-ping", "libp2p-ping"],
|
||||
["libp2p/js-libp2p-pnet", "libp2p-pnet"],
|
||||
|
||||
"Utilities",
|
||||
["libp2p/js-p2pcat", "p2pcat"]
|
||||
["libp2p/js-libp2p-floodsub", "libp2p-floodsub"]
|
||||
]
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "libp2p",
|
||||
"version": "0.26.1",
|
||||
"version": "0.26.2",
|
||||
"description": "JavaScript implementation of libp2p, a modular peer to peer network stack",
|
||||
"leadMaintainer": "Jacob Heun <jacobheun@gmail.com>",
|
||||
"main": "src/index.js",
|
||||
@ -81,6 +81,7 @@
|
||||
"chai": "^4.2.0",
|
||||
"chai-checkmark": "^1.0.1",
|
||||
"cids": "^0.7.1",
|
||||
"delay": "^4.3.0",
|
||||
"dirty-chai": "^2.0.1",
|
||||
"electron-webrtc": "^0.3.0",
|
||||
"interface-datastore": "^0.6.0",
|
||||
@ -124,6 +125,7 @@
|
||||
"Diogo Silva <fsdiogo@gmail.com>",
|
||||
"Dmitriy Ryajov <dryajov@gmail.com>",
|
||||
"Elven <mon.samuel@qq.com>",
|
||||
"Fei Liu <liu.feiwood@gmail.com>",
|
||||
"Florian-Merle <florian.david.merle@gmail.com>",
|
||||
"Friedel Ziegelmayer <dignifiedquire@gmail.com>",
|
||||
"Giovanni T. Parra <fiatjaf@gmail.com>",
|
||||
@ -160,6 +162,7 @@
|
||||
"greenkeeperio-bot <support@greenkeeper.io>",
|
||||
"isan_rivkin <isanrivkin@gmail.com>",
|
||||
"mayerwin <mayerwin@users.noreply.github.com>",
|
||||
"swedneck <40505480+swedneck@users.noreply.github.com>",
|
||||
"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ <victorbjelkholm@gmail.com>"
|
||||
]
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ class Dialer {
|
||||
const relays = Array.from(this.relayPeers.values())
|
||||
const next = (nextRelay) => {
|
||||
if (!nextRelay) {
|
||||
const err = `no relay peers were found or all relays failed to dial`
|
||||
const err = 'no relay peers were found or all relays failed to dial'
|
||||
log.err(err)
|
||||
return cb(err)
|
||||
}
|
||||
@ -235,7 +235,7 @@ class Dialer {
|
||||
}
|
||||
const message = proto.CircuitRelay.decode(msg)
|
||||
if (message.type !== proto.CircuitRelay.Type.STATUS) {
|
||||
return callback(new Error(`Got invalid message type - ` +
|
||||
return callback(new Error('Got invalid message type - ' +
|
||||
`expected ${proto.CircuitRelay.Type.STATUS} got ${message.type}`))
|
||||
}
|
||||
|
||||
|
@ -203,7 +203,7 @@ class Hop extends EE {
|
||||
|
||||
const message = proto.decode(msg)
|
||||
if (message.code !== proto.Status.SUCCESS) {
|
||||
return callback(new Error(`Unable to create circuit!`))
|
||||
return callback(new Error('Unable to create circuit!'))
|
||||
}
|
||||
|
||||
return callback(null, msg)
|
||||
|
@ -49,7 +49,7 @@ class StreamHandler {
|
||||
*/
|
||||
read (cb) {
|
||||
if (!this.isValid()) {
|
||||
return cb(new Error(`handler is not in a valid state`))
|
||||
return cb(new Error('handler is not in a valid state'))
|
||||
}
|
||||
|
||||
lp.decodeFromReader(
|
||||
@ -77,7 +77,7 @@ class StreamHandler {
|
||||
cb = cb || (() => {})
|
||||
|
||||
if (!this.isValid()) {
|
||||
return cb(new Error(`handler is not in a valid state`))
|
||||
return cb(new Error('handler is not in a valid state'))
|
||||
}
|
||||
|
||||
pull(
|
||||
|
@ -132,10 +132,10 @@ module.exports = (swarm, options, connHandler) => {
|
||||
if (!mafmt.Circuit.matches(addr)) {
|
||||
if (addr.getPeerId()) {
|
||||
// by default we're reachable over any relay
|
||||
listenAddrs.push(multiaddr(`/p2p-circuit`).encapsulate(addr))
|
||||
listenAddrs.push(multiaddr('/p2p-circuit').encapsulate(addr))
|
||||
} else {
|
||||
const ma = `${addr}/ipfs/${swarm._peerInfo.id.toB58String()}`
|
||||
listenAddrs.push(multiaddr(`/p2p-circuit`).encapsulate(ma))
|
||||
listenAddrs.push(multiaddr('/p2p-circuit').encapsulate(ma))
|
||||
}
|
||||
} else {
|
||||
listenAddrs.push(addr.encapsulate(`/ipfs/${swarm._peerInfo.id.toB58String()}`))
|
||||
|
@ -32,27 +32,35 @@ module.exports = (node, Pubsub, config) => {
|
||||
* const handler = (message) => { }
|
||||
* libp2p.subscribe(topic, handler, callback)
|
||||
*/
|
||||
subscribe: promisify((topic, handler, options, callback) => {
|
||||
subscribe: (topic, handler, options, callback) => {
|
||||
// can't use promisify because it thinks the handler is a callback
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
|
||||
if (!node.isStarted() && !pubsub.started) {
|
||||
return nextTick(callback, errCode(new Error(messages.NOT_STARTED_YET), codes.PUBSUB_NOT_STARTED))
|
||||
}
|
||||
const err = errCode(new Error(messages.NOT_STARTED_YET), codes.PUBSUB_NOT_STARTED)
|
||||
|
||||
function subscribe (cb) {
|
||||
if (pubsub.listenerCount(topic) === 0) {
|
||||
pubsub.subscribe(topic)
|
||||
if (callback) {
|
||||
return nextTick(() => callback(err))
|
||||
}
|
||||
|
||||
pubsub.on(topic, handler)
|
||||
nextTick(cb)
|
||||
return Promise.reject(err)
|
||||
}
|
||||
|
||||
subscribe(callback)
|
||||
}),
|
||||
if (pubsub.listenerCount(topic) === 0) {
|
||||
pubsub.subscribe(topic)
|
||||
}
|
||||
|
||||
pubsub.on(topic, handler)
|
||||
|
||||
if (callback) {
|
||||
return nextTick(() => callback())
|
||||
}
|
||||
|
||||
return Promise.resolve()
|
||||
},
|
||||
|
||||
/**
|
||||
* Unsubscribes from a pubsub topic
|
||||
@ -76,9 +84,16 @@ module.exports = (node, Pubsub, config) => {
|
||||
*
|
||||
* libp2p.unsubscribe(topic, handler, callback)
|
||||
*/
|
||||
unsubscribe: promisify((topic, handler, callback) => {
|
||||
unsubscribe: (topic, handler, callback) => {
|
||||
// can't use promisify because it thinks the handler is a callback
|
||||
if (!node.isStarted() && !pubsub.started) {
|
||||
return nextTick(callback, errCode(new Error(messages.NOT_STARTED_YET), codes.PUBSUB_NOT_STARTED))
|
||||
const err = errCode(new Error(messages.NOT_STARTED_YET), codes.PUBSUB_NOT_STARTED)
|
||||
|
||||
if (callback) {
|
||||
return nextTick(() => callback(err))
|
||||
}
|
||||
|
||||
return Promise.reject(err)
|
||||
}
|
||||
|
||||
if (!handler) {
|
||||
@ -91,12 +106,12 @@ module.exports = (node, Pubsub, config) => {
|
||||
pubsub.unsubscribe(topic)
|
||||
}
|
||||
|
||||
if (typeof callback === 'function') {
|
||||
if (callback) {
|
||||
return nextTick(() => callback())
|
||||
}
|
||||
|
||||
return Promise.resolve()
|
||||
}),
|
||||
},
|
||||
|
||||
publish: promisify((topic, data, callback) => {
|
||||
if (!node.isStarted() && !pubsub.started) {
|
||||
|
@ -5,7 +5,7 @@ const IncomingConnection = require('./incoming')
|
||||
const observeConn = require('../observe-connection')
|
||||
|
||||
function listener (_switch) {
|
||||
const log = debug(`libp2p:switch:listener`)
|
||||
const log = debug('libp2p:switch:listener')
|
||||
|
||||
/**
|
||||
* Takes a transport key and returns a connection handler function
|
||||
|
@ -41,7 +41,7 @@ module.exports = function protocolMuxer (protocols, observer) {
|
||||
|
||||
ms.handle(parentConn, (err) => {
|
||||
if (err) {
|
||||
log.error(`multistream handshake failed`, err)
|
||||
log.error('multistream handshake failed', err)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ const dirtyChai = require('dirty-chai')
|
||||
const expect = chai.expect
|
||||
chai.use(dirtyChai)
|
||||
|
||||
describe(`dialer tests`, function () {
|
||||
describe('dialer tests', function () {
|
||||
let dialer
|
||||
|
||||
beforeEach(() => {
|
||||
@ -35,7 +35,7 @@ describe(`dialer tests`, function () {
|
||||
sinon.restore()
|
||||
})
|
||||
|
||||
describe(`.dial`, function () {
|
||||
describe('.dial', function () {
|
||||
beforeEach(function () {
|
||||
dialer.relayPeers = new Map()
|
||||
dialer.relayPeers.set(nodes.node2.id, new Connection())
|
||||
@ -43,14 +43,14 @@ describe(`dialer tests`, function () {
|
||||
dialer.dial.callThrough()
|
||||
})
|
||||
|
||||
it(`fail on non circuit addr`, function () {
|
||||
it('fail on non circuit addr', function () {
|
||||
const dstMa = multiaddr(`/ipfs/${nodes.node4.id}`)
|
||||
expect(() => dialer.dial(dstMa, (err) => {
|
||||
err.to.match(/invalid circuit address/)
|
||||
}))
|
||||
})
|
||||
|
||||
it(`dial a peer`, function (done) {
|
||||
it('dial a peer', function (done) {
|
||||
const dstMa = multiaddr(`/p2p-circuit/ipfs/${nodes.node3.id}`)
|
||||
dialer._dialPeer.callsFake(function (dstMa, relay, callback) {
|
||||
return callback(null, dialer.relayPeers.get(nodes.node3.id))
|
||||
@ -63,7 +63,7 @@ describe(`dialer tests`, function () {
|
||||
})
|
||||
})
|
||||
|
||||
it(`dial a peer over the specified relay`, function (done) {
|
||||
it('dial a peer over the specified relay', function (done) {
|
||||
const dstMa = multiaddr(`/ipfs/${nodes.node3.id}/p2p-circuit/ipfs/${nodes.node4.id}`)
|
||||
dialer._dialPeer.callsFake(function (dstMa, relay, callback) {
|
||||
expect(relay.toString()).to.equal(`/ipfs/${nodes.node3.id}`)
|
||||
@ -78,7 +78,7 @@ describe(`dialer tests`, function () {
|
||||
})
|
||||
})
|
||||
|
||||
describe(`.canHop`, function () {
|
||||
describe('.canHop', function () {
|
||||
let fromConn = null
|
||||
const peer = new PeerInfo(PeerId.createFromB58String('QmQWqGdndSpAkxfk8iyiJyz3XXGkrDNujvc8vEst3baubA'))
|
||||
|
||||
@ -94,7 +94,7 @@ describe(`dialer tests`, function () {
|
||||
dialer._dialRelayHelper.callThrough()
|
||||
})
|
||||
|
||||
it(`should handle successful CAN_HOP`, (done) => {
|
||||
it('should handle successful CAN_HOP', (done) => {
|
||||
dialer._dialRelay.callsFake((_, cb) => {
|
||||
pull(
|
||||
values([{
|
||||
@ -114,7 +114,7 @@ describe(`dialer tests`, function () {
|
||||
})
|
||||
})
|
||||
|
||||
it(`should handle failed CAN_HOP`, function (done) {
|
||||
it('should handle failed CAN_HOP', function (done) {
|
||||
dialer._dialRelay.callsFake((_, cb) => {
|
||||
pull(
|
||||
values([{
|
||||
@ -135,7 +135,7 @@ describe(`dialer tests`, function () {
|
||||
})
|
||||
})
|
||||
|
||||
describe(`._dialPeer`, function () {
|
||||
describe('._dialPeer', function () {
|
||||
beforeEach(function () {
|
||||
dialer.relayPeers = new Map()
|
||||
dialer.relayPeers.set(nodes.node1.id, new Connection())
|
||||
@ -144,14 +144,14 @@ describe(`dialer tests`, function () {
|
||||
dialer._dialPeer.callThrough()
|
||||
})
|
||||
|
||||
it(`should dial a peer over any relay`, function (done) {
|
||||
it('should dial a peer over any relay', function (done) {
|
||||
const dstMa = multiaddr(`/ipfs/${nodes.node4.id}`)
|
||||
dialer._negotiateRelay.callsFake(function (conn, dstMa, callback) {
|
||||
if (conn === dialer.relayPeers.get(nodes.node3.id)) {
|
||||
return callback(null, dialer.relayPeers.get(nodes.node3.id))
|
||||
}
|
||||
|
||||
callback(new Error(`error`))
|
||||
callback(new Error('error'))
|
||||
})
|
||||
|
||||
dialer._dialPeer(dstMa, (err, conn) => {
|
||||
@ -162,22 +162,22 @@ describe(`dialer tests`, function () {
|
||||
})
|
||||
})
|
||||
|
||||
it(`should fail dialing a peer over any relay`, function (done) {
|
||||
it('should fail dialing a peer over any relay', function (done) {
|
||||
const dstMa = multiaddr(`/ipfs/${nodes.node4.id}`)
|
||||
dialer._negotiateRelay.callsFake(function (conn, dstMa, callback) {
|
||||
callback(new Error(`error`))
|
||||
callback(new Error('error'))
|
||||
})
|
||||
|
||||
dialer._dialPeer(dstMa, (err, conn) => {
|
||||
expect(conn).to.be.undefined()
|
||||
expect(err).to.not.be.null()
|
||||
expect(err).to.equal(`no relay peers were found or all relays failed to dial`)
|
||||
expect(err).to.equal('no relay peers were found or all relays failed to dial')
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe(`._negotiateRelay`, function () {
|
||||
describe('._negotiateRelay', function () {
|
||||
const dstMa = multiaddr(`/ipfs/${nodes.node4.id}`)
|
||||
|
||||
let conn = null
|
||||
@ -188,7 +188,7 @@ describe(`dialer tests`, function () {
|
||||
PeerId.createFromJSON(nodes.node4, (_, peerId) => {
|
||||
PeerInfo.create(peerId, (err, peerInfo) => {
|
||||
peer = peerInfo
|
||||
peer.multiaddrs.add(`/p2p-circuit/ipfs/QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE`)
|
||||
peer.multiaddrs.add('/p2p-circuit/ipfs/QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE')
|
||||
done(err)
|
||||
})
|
||||
})
|
||||
@ -202,12 +202,12 @@ describe(`dialer tests`, function () {
|
||||
dialer.relayConns = new Map()
|
||||
dialer._negotiateRelay.callThrough()
|
||||
dialer._dialRelayHelper.callThrough()
|
||||
peer = new PeerInfo(PeerId.createFromB58String(`QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE`))
|
||||
peer = new PeerInfo(PeerId.createFromB58String('QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE'))
|
||||
p = pair()
|
||||
conn = new Connection(p[1])
|
||||
})
|
||||
|
||||
it(`should write the correct dst addr`, function (done) {
|
||||
it('should write the correct dst addr', function (done) {
|
||||
dialer._dialRelay.callsFake((_, cb) => {
|
||||
pull(
|
||||
p[0],
|
||||
@ -228,7 +228,7 @@ describe(`dialer tests`, function () {
|
||||
dialer._negotiateRelay(peer, dstMa, done)
|
||||
})
|
||||
|
||||
it(`should negotiate relay`, function (done) {
|
||||
it('should negotiate relay', function (done) {
|
||||
dialer._dialRelay.callsFake((_, cb) => {
|
||||
pull(
|
||||
p[0],
|
||||
@ -253,7 +253,7 @@ describe(`dialer tests`, function () {
|
||||
})
|
||||
})
|
||||
|
||||
it(`should fail with an invalid peer id`, function (done) {
|
||||
it('should fail with an invalid peer id', function (done) {
|
||||
const dstMa = multiaddr('/ip4/127.0.0.1/tcp/4001')
|
||||
dialer._dialRelay.callsFake((_, cb) => {
|
||||
pull(
|
||||
@ -279,7 +279,7 @@ describe(`dialer tests`, function () {
|
||||
})
|
||||
})
|
||||
|
||||
it(`should handle failed relay negotiation`, function (done) {
|
||||
it('should handle failed relay negotiation', function (done) {
|
||||
dialer._dialRelay.callsFake((_, cb) => {
|
||||
cb(null, conn)
|
||||
pull(
|
||||
@ -295,7 +295,7 @@ describe(`dialer tests`, function () {
|
||||
dialer._negotiateRelay(peer, dstMa, (err, conn) => {
|
||||
expect(err).to.not.be.null()
|
||||
expect(err).to.be.an.instanceOf(Error)
|
||||
expect(err.message).to.be.equal(`Got 400 error code trying to dial over relay`)
|
||||
expect(err.message).to.be.equal('Got 400 error code trying to dial over relay')
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
@ -24,7 +24,7 @@ const expect = chai.expect
|
||||
chai.use(dirtyChai)
|
||||
|
||||
describe('relay', () => {
|
||||
describe(`.handle`, () => {
|
||||
describe('.handle', () => {
|
||||
let relay
|
||||
let swarm
|
||||
let fromConn
|
||||
@ -40,11 +40,11 @@ describe('relay', () => {
|
||||
|
||||
const peers = {
|
||||
QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE:
|
||||
new PeerInfo(PeerId.createFromB58String(`QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE`)),
|
||||
new PeerInfo(PeerId.createFromB58String('QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE')),
|
||||
QmQWqGdndSpAkxfk8iyiJyz3XXGkrDNujvc8vEst3baubA:
|
||||
new PeerInfo(PeerId.createFromB58String(`QmQWqGdndSpAkxfk8iyiJyz3XXGkrDNujvc8vEst3baubA`)),
|
||||
new PeerInfo(PeerId.createFromB58String('QmQWqGdndSpAkxfk8iyiJyz3XXGkrDNujvc8vEst3baubA')),
|
||||
QmQvM2mpqkjyXWbTHSUidUAWN26GgdMphTh9iGDdjgVXCy:
|
||||
new PeerInfo(PeerId.createFromB58String(`QmQvM2mpqkjyXWbTHSUidUAWN26GgdMphTh9iGDdjgVXCy`))
|
||||
new PeerInfo(PeerId.createFromB58String('QmQvM2mpqkjyXWbTHSUidUAWN26GgdMphTh9iGDdjgVXCy'))
|
||||
}
|
||||
|
||||
Object.keys(peers).forEach((key) => { peers[key]._connectedMultiaddr = true }) // make it truthy
|
||||
@ -86,16 +86,16 @@ describe('relay', () => {
|
||||
relay._circuit.reset()
|
||||
})
|
||||
|
||||
it(`should handle a valid circuit request`, (done) => {
|
||||
it('should handle a valid circuit request', (done) => {
|
||||
const relayMsg = {
|
||||
type: proto.CircuitRelay.Type.HOP,
|
||||
srcPeer: {
|
||||
id: PeerId.createFromB58String(`QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE`).id,
|
||||
addrs: [multiaddr(`/ipfs/QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE`).buffer]
|
||||
id: PeerId.createFromB58String('QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE').id,
|
||||
addrs: [multiaddr('/ipfs/QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE').buffer]
|
||||
},
|
||||
dstPeer: {
|
||||
id: PeerId.createFromB58String(`QmQWqGdndSpAkxfk8iyiJyz3XXGkrDNujvc8vEst3baubA`).id,
|
||||
addrs: [multiaddr(`/ipfs/QmQWqGdndSpAkxfk8iyiJyz3XXGkrDNujvc8vEst3baubA`).buffer]
|
||||
id: PeerId.createFromB58String('QmQWqGdndSpAkxfk8iyiJyz3XXGkrDNujvc8vEst3baubA').id,
|
||||
addrs: [multiaddr('/ipfs/QmQWqGdndSpAkxfk8iyiJyz3XXGkrDNujvc8vEst3baubA').buffer]
|
||||
}
|
||||
}
|
||||
|
||||
@ -107,16 +107,16 @@ describe('relay', () => {
|
||||
relay.handle(relayMsg, new StreamHandler(fromConn))
|
||||
})
|
||||
|
||||
it(`should handle a request to passive circuit`, (done) => {
|
||||
it('should handle a request to passive circuit', (done) => {
|
||||
const relayMsg = {
|
||||
type: proto.CircuitRelay.Type.HOP,
|
||||
srcPeer: {
|
||||
id: PeerId.createFromB58String(`QmQWqGdndSpAkxfk8iyiJyz3XXGkrDNujvc8vEst3baubA`).id,
|
||||
addrs: [multiaddr(`/ipfs/QmQWqGdndSpAkxfk8iyiJyz3XXGkrDNujvc8vEst3baubA`).buffer]
|
||||
id: PeerId.createFromB58String('QmQWqGdndSpAkxfk8iyiJyz3XXGkrDNujvc8vEst3baubA').id,
|
||||
addrs: [multiaddr('/ipfs/QmQWqGdndSpAkxfk8iyiJyz3XXGkrDNujvc8vEst3baubA').buffer]
|
||||
},
|
||||
dstPeer: {
|
||||
id: PeerId.createFromB58String(`QmYJjAri5soV8RbeQcHaYYcTAYTET17QTvcoFMyKvRDTXe`).id,
|
||||
addrs: [multiaddr(`/ipfs/QmYJjAri5soV8RbeQcHaYYcTAYTET17QTvcoFMyKvRDTXe`).buffer]
|
||||
id: PeerId.createFromB58String('QmYJjAri5soV8RbeQcHaYYcTAYTET17QTvcoFMyKvRDTXe').id,
|
||||
addrs: [multiaddr('/ipfs/QmYJjAri5soV8RbeQcHaYYcTAYTET17QTvcoFMyKvRDTXe').buffer]
|
||||
}
|
||||
}
|
||||
|
||||
@ -135,16 +135,16 @@ describe('relay', () => {
|
||||
relay.handle(relayMsg, new StreamHandler(fromConn))
|
||||
})
|
||||
|
||||
it(`should handle a request to active circuit`, (done) => {
|
||||
it('should handle a request to active circuit', (done) => {
|
||||
const relayMsg = {
|
||||
type: proto.CircuitRelay.Type.HOP,
|
||||
srcPeer: {
|
||||
id: PeerId.createFromB58String(`QmQWqGdndSpAkxfk8iyiJyz3XXGkrDNujvc8vEst3baubA`).id,
|
||||
addrs: [multiaddr(`/ipfs/QmQWqGdndSpAkxfk8iyiJyz3XXGkrDNujvc8vEst3baubA`).buffer]
|
||||
id: PeerId.createFromB58String('QmQWqGdndSpAkxfk8iyiJyz3XXGkrDNujvc8vEst3baubA').id,
|
||||
addrs: [multiaddr('/ipfs/QmQWqGdndSpAkxfk8iyiJyz3XXGkrDNujvc8vEst3baubA').buffer]
|
||||
},
|
||||
dstPeer: {
|
||||
id: PeerId.createFromB58String(`QmYJjAri5soV8RbeQcHaYYcTAYTET17QTvcoFMyKvRDTXe`).id,
|
||||
addrs: [multiaddr(`/ipfs/QmYJjAri5soV8RbeQcHaYYcTAYTET17QTvcoFMyKvRDTXe`).buffer]
|
||||
id: PeerId.createFromB58String('QmYJjAri5soV8RbeQcHaYYcTAYTET17QTvcoFMyKvRDTXe').id,
|
||||
addrs: [multiaddr('/ipfs/QmYJjAri5soV8RbeQcHaYYcTAYTET17QTvcoFMyKvRDTXe').buffer]
|
||||
}
|
||||
}
|
||||
|
||||
@ -161,16 +161,16 @@ describe('relay', () => {
|
||||
relay.handle(relayMsg, new StreamHandler(fromConn))
|
||||
})
|
||||
|
||||
it(`not dial to self`, (done) => {
|
||||
it('not dial to self', (done) => {
|
||||
const relayMsg = {
|
||||
type: proto.CircuitRelay.Type.HOP,
|
||||
srcPeer: {
|
||||
id: PeerId.createFromB58String(`QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE`).id,
|
||||
addrs: [multiaddr(`/ipfs/QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE`).buffer]
|
||||
id: PeerId.createFromB58String('QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE').id,
|
||||
addrs: [multiaddr('/ipfs/QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE').buffer]
|
||||
},
|
||||
dstPeer: {
|
||||
id: PeerId.createFromB58String(`QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE`).id,
|
||||
addrs: [multiaddr(`/ipfs/QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE`).buffer]
|
||||
id: PeerId.createFromB58String('QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE').id,
|
||||
addrs: [multiaddr('/ipfs/QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE').buffer]
|
||||
}
|
||||
}
|
||||
|
||||
@ -188,16 +188,16 @@ describe('relay', () => {
|
||||
relay.handle(relayMsg, new StreamHandler(fromConn))
|
||||
})
|
||||
|
||||
it(`fail on invalid src address`, (done) => {
|
||||
it('fail on invalid src address', (done) => {
|
||||
const relayMsg = {
|
||||
type: proto.CircuitRelay.Type.HOP,
|
||||
srcPeer: {
|
||||
id: `sdfkjsdnfkjdsb`,
|
||||
addrs: [`sdfkjsdnfkjdsb`]
|
||||
id: 'sdfkjsdnfkjdsb',
|
||||
addrs: ['sdfkjsdnfkjdsb']
|
||||
},
|
||||
dstPeer: {
|
||||
id: PeerId.createFromB58String(`QmQWqGdndSpAkxfk8iyiJyz3XXGkrDNujvc8vEst3baubA`).id,
|
||||
addrs: [multiaddr(`/ipfs/QmQWqGdndSpAkxfk8iyiJyz3XXGkrDNujvc8vEst3baubA`).buffer]
|
||||
id: PeerId.createFromB58String('QmQWqGdndSpAkxfk8iyiJyz3XXGkrDNujvc8vEst3baubA').id,
|
||||
addrs: [multiaddr('/ipfs/QmQWqGdndSpAkxfk8iyiJyz3XXGkrDNujvc8vEst3baubA').buffer]
|
||||
}
|
||||
}
|
||||
|
||||
@ -215,16 +215,16 @@ describe('relay', () => {
|
||||
relay.handle(relayMsg, new StreamHandler(fromConn))
|
||||
})
|
||||
|
||||
it(`fail on invalid dst address`, (done) => {
|
||||
it('fail on invalid dst address', (done) => {
|
||||
const relayMsg = {
|
||||
type: proto.CircuitRelay.Type.HOP,
|
||||
srcPeer: {
|
||||
id: PeerId.createFromB58String(`QmQWqGdndSpAkxfk8iyiJyz3XXGkrDNujvc8vEst3baubA`).id,
|
||||
addrs: [multiaddr(`/ipfs/QmQWqGdndSpAkxfk8iyiJyz3XXGkrDNujvc8vEst3baubA`).buffer]
|
||||
id: PeerId.createFromB58String('QmQWqGdndSpAkxfk8iyiJyz3XXGkrDNujvc8vEst3baubA').id,
|
||||
addrs: [multiaddr('/ipfs/QmQWqGdndSpAkxfk8iyiJyz3XXGkrDNujvc8vEst3baubA').buffer]
|
||||
},
|
||||
dstPeer: {
|
||||
id: PeerId.createFromB58String(`QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE`).id,
|
||||
addrs: [`sdfkjsdnfkjdsb`]
|
||||
id: PeerId.createFromB58String('QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE').id,
|
||||
addrs: ['sdfkjsdnfkjdsb']
|
||||
}
|
||||
}
|
||||
|
||||
@ -243,7 +243,7 @@ describe('relay', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe(`._circuit`, () => {
|
||||
describe('._circuit', () => {
|
||||
let relay
|
||||
let swarm
|
||||
let srcConn
|
||||
@ -265,11 +265,11 @@ describe('relay', () => {
|
||||
|
||||
const peers = {
|
||||
QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE:
|
||||
new PeerInfo(PeerId.createFromB58String(`QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE`)),
|
||||
new PeerInfo(PeerId.createFromB58String('QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE')),
|
||||
QmQWqGdndSpAkxfk8iyiJyz3XXGkrDNujvc8vEst3baubA:
|
||||
new PeerInfo(PeerId.createFromB58String(`QmQWqGdndSpAkxfk8iyiJyz3XXGkrDNujvc8vEst3baubA`)),
|
||||
new PeerInfo(PeerId.createFromB58String('QmQWqGdndSpAkxfk8iyiJyz3XXGkrDNujvc8vEst3baubA')),
|
||||
QmQvM2mpqkjyXWbTHSUidUAWN26GgdMphTh9iGDdjgVXCy:
|
||||
new PeerInfo(PeerId.createFromB58String(`QmQvM2mpqkjyXWbTHSUidUAWN26GgdMphTh9iGDdjgVXCy`))
|
||||
new PeerInfo(PeerId.createFromB58String('QmQvM2mpqkjyXWbTHSUidUAWN26GgdMphTh9iGDdjgVXCy'))
|
||||
}
|
||||
|
||||
Object.keys(peers).forEach((key) => { peers[key]._connectedMultiaddr = true }) // make it truthy
|
||||
@ -314,12 +314,12 @@ describe('relay', () => {
|
||||
const msg = {
|
||||
type: proto.CircuitRelay.Type.STOP,
|
||||
srcPeer: {
|
||||
id: Buffer.from(`QmQWqGdndSpAkxfk8iyiJyz3XXGkrDNujvc8vEst3baubA`),
|
||||
addrs: [Buffer.from(`dsfsdfsdf`)]
|
||||
id: Buffer.from('QmQWqGdndSpAkxfk8iyiJyz3XXGkrDNujvc8vEst3baubA'),
|
||||
addrs: [Buffer.from('dsfsdfsdf')]
|
||||
},
|
||||
dstPeer: {
|
||||
id: Buffer.from(`QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE`),
|
||||
addrs: [Buffer.from(`sdflksdfndsklfnlkdf`)]
|
||||
id: Buffer.from('QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE'),
|
||||
addrs: [Buffer.from('sdflksdfndsklfnlkdf')]
|
||||
}
|
||||
}
|
||||
|
||||
@ -396,12 +396,12 @@ describe('relay', () => {
|
||||
const msg = {
|
||||
type: proto.CircuitRelay.Type.STOP,
|
||||
srcPeer: {
|
||||
id: Buffer.from(`QmQWqGdndSpAkxfk8iyiJyz3XXGkrDNujvc8vEst3baubA`),
|
||||
addrs: [Buffer.from(`dsfsdfsdf`)]
|
||||
id: Buffer.from('QmQWqGdndSpAkxfk8iyiJyz3XXGkrDNujvc8vEst3baubA'),
|
||||
addrs: [Buffer.from('dsfsdfsdf')]
|
||||
},
|
||||
dstPeer: {
|
||||
id: Buffer.from(`QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE`),
|
||||
addrs: [Buffer.from(`sdflksdfndsklfnlkdf`)]
|
||||
id: Buffer.from('QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE'),
|
||||
addrs: [Buffer.from('sdflksdfndsklfnlkdf')]
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ chai.use(dirtyChai)
|
||||
const sinon = require('sinon')
|
||||
|
||||
describe('listener', function () {
|
||||
describe(`listen`, function () {
|
||||
describe('listen', function () {
|
||||
let swarm = null
|
||||
let handlerSpy = null
|
||||
let listener = null
|
||||
@ -63,18 +63,18 @@ describe('listener', function () {
|
||||
listener = null
|
||||
})
|
||||
|
||||
it(`should handle HOP`, function (done) {
|
||||
it('should handle HOP', function (done) {
|
||||
handlerSpy(multicodec.relay, conn)
|
||||
|
||||
const relayMsg = {
|
||||
type: proto.CircuitRelay.Type.HOP,
|
||||
srcPeer: {
|
||||
id: `QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE`,
|
||||
addrs: [`/ipfs/QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE`]
|
||||
id: 'QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE',
|
||||
addrs: ['/ipfs/QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE']
|
||||
},
|
||||
dstPeer: {
|
||||
id: `QmQvM2mpqkjyXWbTHSUidUAWN26GgdMphTh9iGDdjgVXCy`,
|
||||
addrs: [`/ipfs/QmQvM2mpqkjyXWbTHSUidUAWN26GgdMphTh9iGDdjgVXCy`]
|
||||
id: 'QmQvM2mpqkjyXWbTHSUidUAWN26GgdMphTh9iGDdjgVXCy',
|
||||
addrs: ['/ipfs/QmQvM2mpqkjyXWbTHSUidUAWN26GgdMphTh9iGDdjgVXCy']
|
||||
}
|
||||
}
|
||||
|
||||
@ -100,18 +100,18 @@ describe('listener', function () {
|
||||
)
|
||||
})
|
||||
|
||||
it(`should handle STOP`, function (done) {
|
||||
it('should handle STOP', function (done) {
|
||||
handlerSpy(multicodec.relay, conn)
|
||||
|
||||
const relayMsg = {
|
||||
type: proto.CircuitRelay.Type.STOP,
|
||||
srcPeer: {
|
||||
id: `QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE`,
|
||||
addrs: [`/ipfs/QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE`]
|
||||
id: 'QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE',
|
||||
addrs: ['/ipfs/QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE']
|
||||
},
|
||||
dstPeer: {
|
||||
id: `QmQvM2mpqkjyXWbTHSUidUAWN26GgdMphTh9iGDdjgVXCy`,
|
||||
addrs: [`/ipfs/QmQvM2mpqkjyXWbTHSUidUAWN26GgdMphTh9iGDdjgVXCy`]
|
||||
id: 'QmQvM2mpqkjyXWbTHSUidUAWN26GgdMphTh9iGDdjgVXCy',
|
||||
addrs: ['/ipfs/QmQvM2mpqkjyXWbTHSUidUAWN26GgdMphTh9iGDdjgVXCy']
|
||||
}
|
||||
}
|
||||
|
||||
@ -137,18 +137,18 @@ describe('listener', function () {
|
||||
)
|
||||
})
|
||||
|
||||
it(`should emit 'connection'`, function (done) {
|
||||
it('should emit \'connection\'', function (done) {
|
||||
handlerSpy(multicodec.relay, conn)
|
||||
|
||||
const relayMsg = {
|
||||
type: proto.CircuitRelay.Type.STOP,
|
||||
srcPeer: {
|
||||
id: `QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE`,
|
||||
addrs: [`/ipfs/QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE`]
|
||||
id: 'QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE',
|
||||
addrs: ['/ipfs/QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE']
|
||||
},
|
||||
dstPeer: {
|
||||
id: `QmQvM2mpqkjyXWbTHSUidUAWN26GgdMphTh9iGDdjgVXCy`,
|
||||
addrs: [`/ipfs/QmQvM2mpqkjyXWbTHSUidUAWN26GgdMphTh9iGDdjgVXCy`]
|
||||
id: 'QmQvM2mpqkjyXWbTHSUidUAWN26GgdMphTh9iGDdjgVXCy',
|
||||
addrs: ['/ipfs/QmQvM2mpqkjyXWbTHSUidUAWN26GgdMphTh9iGDdjgVXCy']
|
||||
}
|
||||
}
|
||||
|
||||
@ -172,18 +172,18 @@ describe('listener', function () {
|
||||
)
|
||||
})
|
||||
|
||||
it(`should handle CAN_HOP`, function (done) {
|
||||
it('should handle CAN_HOP', function (done) {
|
||||
handlerSpy(multicodec.relay, conn)
|
||||
|
||||
const relayMsg = {
|
||||
type: proto.CircuitRelay.Type.CAN_HOP,
|
||||
srcPeer: {
|
||||
id: `QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE`,
|
||||
addrs: [`/ipfs/QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE`]
|
||||
id: 'QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE',
|
||||
addrs: ['/ipfs/QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE']
|
||||
},
|
||||
dstPeer: {
|
||||
id: `QmQvM2mpqkjyXWbTHSUidUAWN26GgdMphTh9iGDdjgVXCy`,
|
||||
addrs: [`/ipfs/QmQvM2mpqkjyXWbTHSUidUAWN26GgdMphTh9iGDdjgVXCy`]
|
||||
id: 'QmQvM2mpqkjyXWbTHSUidUAWN26GgdMphTh9iGDdjgVXCy',
|
||||
addrs: ['/ipfs/QmQvM2mpqkjyXWbTHSUidUAWN26GgdMphTh9iGDdjgVXCy']
|
||||
}
|
||||
}
|
||||
|
||||
@ -209,18 +209,18 @@ describe('listener', function () {
|
||||
)
|
||||
})
|
||||
|
||||
it(`should handle invalid message correctly`, function (done) {
|
||||
it('should handle invalid message correctly', function (done) {
|
||||
handlerSpy(multicodec.relay, conn)
|
||||
|
||||
const relayMsg = {
|
||||
type: 100000,
|
||||
srcPeer: {
|
||||
id: Buffer.from(`QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE`),
|
||||
addrs: [multiaddr(`/ipfs/QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE`).buffer]
|
||||
id: Buffer.from('QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE'),
|
||||
addrs: [multiaddr('/ipfs/QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE').buffer]
|
||||
},
|
||||
dstPeer: {
|
||||
id: Buffer.from(`QmQvM2mpqkjyXWbTHSUidUAWN26GgdMphTh9iGDdjgVXCy`),
|
||||
addrs: [multiaddr(`/ipfs/QmQvM2mpqkjyXWbTHSUidUAWN26GgdMphTh9iGDdjgVXCy`).buffer]
|
||||
id: Buffer.from('QmQvM2mpqkjyXWbTHSUidUAWN26GgdMphTh9iGDdjgVXCy'),
|
||||
addrs: [multiaddr('/ipfs/QmQvM2mpqkjyXWbTHSUidUAWN26GgdMphTh9iGDdjgVXCy').buffer]
|
||||
}
|
||||
}
|
||||
|
||||
@ -241,7 +241,7 @@ describe('listener', function () {
|
||||
})
|
||||
})
|
||||
|
||||
describe(`getAddrs`, function () {
|
||||
describe('getAddrs', function () {
|
||||
let swarm = null
|
||||
let listener = null
|
||||
let peerInfo = null
|
||||
@ -266,26 +266,26 @@ describe('listener', function () {
|
||||
peerInfo = null
|
||||
})
|
||||
|
||||
it(`should return correct addrs`, function () {
|
||||
peerInfo.multiaddrs.add(`/ip4/0.0.0.0/tcp/4002`)
|
||||
peerInfo.multiaddrs.add(`/ip4/127.0.0.1/tcp/4003/ws`)
|
||||
it('should return correct addrs', function () {
|
||||
peerInfo.multiaddrs.add('/ip4/0.0.0.0/tcp/4002')
|
||||
peerInfo.multiaddrs.add('/ip4/127.0.0.1/tcp/4003/ws')
|
||||
|
||||
listener.getAddrs((err, addrs) => {
|
||||
expect(err).to.not.exist()
|
||||
expect(addrs).to.deep.equal([
|
||||
multiaddr(`/p2p-circuit/ip4/0.0.0.0/tcp/4002/ipfs/QmQvM2mpqkjyXWbTHSUidUAWN26GgdMphTh9iGDdjgVXCy`),
|
||||
multiaddr(`/p2p-circuit/ip4/127.0.0.1/tcp/4003/ws/ipfs/QmQvM2mpqkjyXWbTHSUidUAWN26GgdMphTh9iGDdjgVXCy`)])
|
||||
multiaddr('/p2p-circuit/ip4/0.0.0.0/tcp/4002/ipfs/QmQvM2mpqkjyXWbTHSUidUAWN26GgdMphTh9iGDdjgVXCy'),
|
||||
multiaddr('/p2p-circuit/ip4/127.0.0.1/tcp/4003/ws/ipfs/QmQvM2mpqkjyXWbTHSUidUAWN26GgdMphTh9iGDdjgVXCy')])
|
||||
})
|
||||
})
|
||||
|
||||
it(`don't return default addrs in an explicit p2p-circuit addres`, function () {
|
||||
peerInfo.multiaddrs.add(`/ip4/127.0.0.1/tcp/4003/ws`)
|
||||
peerInfo.multiaddrs.add(`/p2p-circuit/ip4/0.0.0.0/tcp/4002`)
|
||||
it('don\'t return default addrs in an explicit p2p-circuit addres', function () {
|
||||
peerInfo.multiaddrs.add('/ip4/127.0.0.1/tcp/4003/ws')
|
||||
peerInfo.multiaddrs.add('/p2p-circuit/ip4/0.0.0.0/tcp/4002')
|
||||
listener.getAddrs((err, addrs) => {
|
||||
expect(err).to.not.exist()
|
||||
expect(addrs[0]
|
||||
.toString())
|
||||
.to.equal(`/p2p-circuit/ip4/0.0.0.0/tcp/4002/ipfs/QmQvM2mpqkjyXWbTHSUidUAWN26GgdMphTh9iGDdjgVXCy`)
|
||||
.to.equal('/p2p-circuit/ip4/0.0.0.0/tcp/4002/ipfs/QmQvM2mpqkjyXWbTHSUidUAWN26GgdMphTh9iGDdjgVXCy')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
@ -39,12 +39,12 @@ describe('protocol', function () {
|
||||
message = proto.CircuitRelay.decode(buff)
|
||||
})
|
||||
|
||||
it(`should source and dest`, () => {
|
||||
it('should source and dest', () => {
|
||||
expect(message.srcPeer).to.deep.equal(msgObject.srcPeer)
|
||||
expect(message.dstPeer).to.deep.equal(msgObject.dstPeer)
|
||||
})
|
||||
|
||||
it(`should encode message`, () => {
|
||||
it('should encode message', () => {
|
||||
expect(message.message).to.deep.equal(msgObject.message)
|
||||
})
|
||||
})
|
||||
|
@ -17,7 +17,7 @@ const expect = chai.expect
|
||||
chai.use(dirtyChai)
|
||||
|
||||
describe('stop', function () {
|
||||
describe(`handle relayed connections`, function () {
|
||||
describe('handle relayed connections', function () {
|
||||
let stopHandler
|
||||
|
||||
let swarm
|
||||
@ -48,16 +48,16 @@ describe('stop', function () {
|
||||
], done)
|
||||
})
|
||||
|
||||
it(`handle request with a valid multiaddr`, function (done) {
|
||||
it('handle request with a valid multiaddr', function (done) {
|
||||
stopHandler.handle({
|
||||
type: proto.CircuitRelay.Type.STOP,
|
||||
srcPeer: {
|
||||
id: `QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE`,
|
||||
addrs: [`/ipfs/QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE`]
|
||||
id: 'QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE',
|
||||
addrs: ['/ipfs/QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE']
|
||||
},
|
||||
dstPeer: {
|
||||
id: `QmQvM2mpqkjyXWbTHSUidUAWN26GgdMphTh9iGDdjgVXCy`,
|
||||
addrs: [`/ipfs/QmQvM2mpqkjyXWbTHSUidUAWN26GgdMphTh9iGDdjgVXCy`]
|
||||
id: 'QmQvM2mpqkjyXWbTHSUidUAWN26GgdMphTh9iGDdjgVXCy',
|
||||
addrs: ['/ipfs/QmQvM2mpqkjyXWbTHSUidUAWN26GgdMphTh9iGDdjgVXCy']
|
||||
}
|
||||
}, new StreamHandler(conn), (conn) => { // multistream handler doesn't expect errors...
|
||||
expect(conn).to.be.instanceOf(Connection)
|
||||
@ -65,16 +65,16 @@ describe('stop', function () {
|
||||
})
|
||||
})
|
||||
|
||||
it(`handle request with invalid multiaddr`, function (done) {
|
||||
it('handle request with invalid multiaddr', function (done) {
|
||||
stopHandler.handle({
|
||||
type: proto.CircuitRelay.Type.STOP,
|
||||
srcPeer: {
|
||||
id: `QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE`,
|
||||
addrs: [`dsfsdfsdf`]
|
||||
id: 'QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE',
|
||||
addrs: ['dsfsdfsdf']
|
||||
},
|
||||
dstPeer: {
|
||||
id: `QmQvM2mpqkjyXWbTHSUidUAWN26GgdMphTh9iGDdjgVXCy`,
|
||||
addrs: [`sdflksdfndsklfnlkdf`]
|
||||
id: 'QmQvM2mpqkjyXWbTHSUidUAWN26GgdMphTh9iGDdjgVXCy',
|
||||
addrs: ['sdflksdfndsklfnlkdf']
|
||||
}
|
||||
}, new StreamHandler(conn), (conn) => {
|
||||
expect(conn).to.not.exist()
|
||||
|
@ -163,7 +163,7 @@ describe('.peerRouting', () => {
|
||||
timeout: '30000ms',
|
||||
'stream-channels': true
|
||||
})
|
||||
.reply(200, `{"Extra":"","ID":"some other id","Responses":null,"Type":6}\n{"Extra":"","ID":"yet another id","Responses":null,"Type":0}\n{"Extra":"routing:not found","ID":"","Responses":null,"Type":3}\n`, [
|
||||
.reply(200, '{"Extra":"","ID":"some other id","Responses":null,"Type":6}\n{"Extra":"","ID":"yet another id","Responses":null,"Type":0}\n{"Extra":"routing:not found","ID":"","Responses":null,"Type":3}\n', [
|
||||
'Content-Type', 'application/json',
|
||||
'X-Chunked-Output', '1'
|
||||
])
|
||||
|
@ -10,7 +10,8 @@ const expect = chai.expect
|
||||
const parallel = require('async/parallel')
|
||||
const series = require('async/series')
|
||||
const _times = require('lodash.times')
|
||||
|
||||
const promisify = require('promisify-es6')
|
||||
const delay = require('delay')
|
||||
const Floodsub = require('libp2p-floodsub')
|
||||
const mergeOptions = require('merge-options')
|
||||
|
||||
@ -204,6 +205,36 @@ describe('.pubsub', () => {
|
||||
expect(err).to.not.exist().mark()
|
||||
})
|
||||
})
|
||||
it('start two nodes and send one message, then unsubscribe (promises)', async () => {
|
||||
let messageRecieved
|
||||
const data = Buffer.from('test')
|
||||
const handler = (msg) => {
|
||||
expect(msg.data).to.eql(data)
|
||||
messageRecieved = true
|
||||
}
|
||||
|
||||
// Start the nodes
|
||||
const nodes = await promisify(startTwo)({
|
||||
modules: {
|
||||
pubsub: Floodsub
|
||||
}
|
||||
})
|
||||
|
||||
// subscribe on the first
|
||||
await nodes[0].pubsub.subscribe('pubsub', handler)
|
||||
// Wait a moment before publishing
|
||||
await delay(500)
|
||||
// publish on the second
|
||||
await nodes[1].pubsub.publish('pubsub', data)
|
||||
// Wait a moment before unsubscribing
|
||||
await delay(500)
|
||||
// unsubscribe on the first
|
||||
await nodes[0].pubsub.unsubscribe('pubsub', handler)
|
||||
// Stop both nodes
|
||||
await promisify(stopTwo)(nodes)
|
||||
|
||||
expect(messageRecieved).to.be.true()
|
||||
})
|
||||
it('start two nodes and send one message, then unsubscribe without handler', (done) => {
|
||||
// Check the final series error, and the publish handler
|
||||
expect(3).checks(done)
|
||||
|
@ -37,7 +37,7 @@ class MockTransport extends EventEmitter {
|
||||
}
|
||||
}
|
||||
|
||||
describe(`dial self`, () => {
|
||||
describe('dial self', () => {
|
||||
let swarmA
|
||||
let peerInfos
|
||||
|
||||
|
@ -93,7 +93,7 @@ describe('Transport Manager', () => {
|
||||
].map(a => Multiaddr(a))
|
||||
|
||||
const ourAddrs = [
|
||||
`/ip4/127.0.0.1/tcp/4002`,
|
||||
'/ip4/127.0.0.1/tcp/4002',
|
||||
`/ip4/192.168.0.3/tcp/4002/ipfs/${peerInfo.id.toB58String()}`
|
||||
]
|
||||
|
||||
@ -126,12 +126,12 @@ describe('Transport Manager', () => {
|
||||
const peerId = peerInfo.id.toB58String()
|
||||
const queryAddrs = [
|
||||
`/p2p-circuit/ipfs/${peerId}`,
|
||||
`/p2p-circuit/ip4/127.0.0.1/tcp/4002`,
|
||||
`/p2p-circuit/ip4/192.168.0.3/tcp/4002`,
|
||||
'/p2p-circuit/ip4/127.0.0.1/tcp/4002',
|
||||
'/p2p-circuit/ip4/192.168.0.3/tcp/4002',
|
||||
`/p2p-circuit/ip4/127.0.0.1/tcp/4002/ipfs/${peerId}`,
|
||||
`/p2p-circuit/ip4/192.168.0.3/tcp/4002/ipfs/${peerId}`,
|
||||
`/p2p-circuit/ip4/127.0.0.1/tcp/4002/ipfs/QmebzNV1kSzLfaYpSZdShuiABNUxoKT1vJmCdxM2iWsM2j`,
|
||||
`/p2p-circuit/ip4/192.168.0.3/tcp/4002/ipfs/QmebzNV1kSzLfaYpSZdShuiABNUxoKT1vJmCdxM2iWsM2j`,
|
||||
'/p2p-circuit/ip4/127.0.0.1/tcp/4002/ipfs/QmebzNV1kSzLfaYpSZdShuiABNUxoKT1vJmCdxM2iWsM2j',
|
||||
'/p2p-circuit/ip4/192.168.0.3/tcp/4002/ipfs/QmebzNV1kSzLfaYpSZdShuiABNUxoKT1vJmCdxM2iWsM2j',
|
||||
`/p2p-webrtc-star/ipfs/${peerId}`,
|
||||
`/p2p-websocket-star/ipfs/${peerId}`,
|
||||
`/p2p-stardust/ipfs/${peerId}`,
|
||||
@ -139,7 +139,7 @@ describe('Transport Manager', () => {
|
||||
].map(a => Multiaddr(a))
|
||||
|
||||
const ourAddrs = [
|
||||
`/ip4/127.0.0.1/tcp/4002`,
|
||||
'/ip4/127.0.0.1/tcp/4002',
|
||||
`/ip4/192.168.0.3/tcp/4002/ipfs/${peerInfo.id.toB58String()}`
|
||||
]
|
||||
|
||||
|
Reference in New Issue
Block a user