From e29bd973f1f0d4c2278789bf484d8ce031004263 Mon Sep 17 00:00:00 2001 From: Vasco Santos Date: Mon, 8 Jun 2020 16:31:23 +0200 Subject: [PATCH 1/2] feat: libp2p noise as fallback for secio --- packages/ipfs/README.md | 1 + packages/ipfs/package-list.json | 1 + packages/ipfs/package.json | 1 + packages/ipfs/src/core/runtime/libp2p-browser.js | 4 +++- packages/ipfs/src/core/runtime/libp2p-nodejs.js | 4 +++- 5 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/ipfs/README.md b/packages/ipfs/README.md index a9dd8fbe79..85f2af33fc 100644 --- a/packages/ipfs/README.md +++ b/packages/ipfs/README.md @@ -188,6 +188,7 @@ List of the main packages that make up the IPFS ecosystem. | [`libp2p-mdns`](//github.com/libp2p/js-libp2p-mdns) | [![npm](https://img.shields.io/npm/v/libp2p-mdns.svg?maxAge=86400&style=flat-square)](//github.com/libp2p/js-libp2p-mdns/releases) | [![Deps](https://david-dm.org/libp2p/js-libp2p-mdns.svg?style=flat-square)](https://david-dm.org/libp2p/js-libp2p-mdns) | [![Travis CI](https://flat.badgen.net/travis/libp2p/js-libp2p-mdns/master)](https://travis-ci.com/libp2p/js-libp2p-mdns) | [![codecov](https://codecov.io/gh/libp2p/js-libp2p-mdns/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-mdns) | [Jacob Heun](mailto:jacobheun@gmail.com) | | [`libp2p-bootstrap`](//github.com/libp2p/js-libp2p-bootstrap) | [![npm](https://img.shields.io/npm/v/libp2p-bootstrap.svg?maxAge=86400&style=flat-square)](//github.com/libp2p/js-libp2p-bootstrap/releases) | [![Deps](https://david-dm.org/libp2p/js-libp2p-bootstrap.svg?style=flat-square)](https://david-dm.org/libp2p/js-libp2p-bootstrap) | [![Travis CI](https://flat.badgen.net/travis/libp2p/js-libp2p-bootstrap/master)](https://travis-ci.com/libp2p/js-libp2p-bootstrap) | [![codecov](https://codecov.io/gh/libp2p/js-libp2p-bootstrap/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-bootstrap) | [Vasco Santos](mailto:vasco.santos@moxy.studio) | | [`libp2p-secio`](//github.com/libp2p/js-libp2p-secio) | [![npm](https://img.shields.io/npm/v/libp2p-secio.svg?maxAge=86400&style=flat-square)](//github.com/libp2p/js-libp2p-secio/releases) | [![Deps](https://david-dm.org/libp2p/js-libp2p-secio.svg?style=flat-square)](https://david-dm.org/libp2p/js-libp2p-secio) | [![Travis CI](https://flat.badgen.net/travis/libp2p/js-libp2p-secio/master)](https://travis-ci.com/libp2p/js-libp2p-secio) | [![codecov](https://codecov.io/gh/libp2p/js-libp2p-secio/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-secio) | [Friedel Ziegelmayer](mailto:dignifiedquire@gmail.com) | +| [`libp2p-noise`](//github.com/NodeFactoryIo/js-libp2p-noise) | [![npm](https://img.shields.io/npm/v/libp2p-noise.svg?maxAge=86400&style=flat-square)](//github.com/NodeFactoryIo/js-libp2p-noise/releases) | [![Deps](https://david-dm.org/NodeFactoryIo/js-libp2p-noise.svg?style=flat-square)](https://david-dm.org/NodeFactoryIo/js-libp2p-noise) | [![Travis CI](https://flat.badgen.net/travis/NodeFactoryIo/js-libp2p-noise/master)](https://travis-ci.com/NodeFactoryIo/js-libp2p-noise) | [![codecov](https://codecov.io/gh/NodeFactoryIo/js-libp2p-noise/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/NodeFactoryIo/js-libp2p-noise) | N/A | | [`libp2p-tcp`](//github.com/libp2p/js-libp2p-tcp) | [![npm](https://img.shields.io/npm/v/libp2p-tcp.svg?maxAge=86400&style=flat-square)](//github.com/libp2p/js-libp2p-tcp/releases) | [![Deps](https://david-dm.org/libp2p/js-libp2p-tcp.svg?style=flat-square)](https://david-dm.org/libp2p/js-libp2p-tcp) | [![Travis CI](https://flat.badgen.net/travis/libp2p/js-libp2p-tcp/master)](https://travis-ci.com/libp2p/js-libp2p-tcp) | [![codecov](https://codecov.io/gh/libp2p/js-libp2p-tcp/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-tcp) | [Jacob Heun](mailto:jacobheun@gmail.com) | | [`libp2p-webrtc-star`](//github.com/libp2p/js-libp2p-webrtc-star) | [![npm](https://img.shields.io/npm/v/libp2p-webrtc-star.svg?maxAge=86400&style=flat-square)](//github.com/libp2p/js-libp2p-webrtc-star/releases) | [![Deps](https://david-dm.org/libp2p/js-libp2p-webrtc-star.svg?style=flat-square)](https://david-dm.org/libp2p/js-libp2p-webrtc-star) | [![Travis CI](https://flat.badgen.net/travis/libp2p/js-libp2p-webrtc-star/master)](https://travis-ci.com/libp2p/js-libp2p-webrtc-star) | [![codecov](https://codecov.io/gh/libp2p/js-libp2p-webrtc-star/branch/master/graph/badge.svg?style=flat-square)](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) | [![npm](https://img.shields.io/npm/v/libp2p-websocket-star.svg?maxAge=86400&style=flat-square)](//github.com/libp2p/js-libp2p-websocket-star/releases) | [![Deps](https://david-dm.org/libp2p/js-libp2p-websocket-star.svg?style=flat-square)](https://david-dm.org/libp2p/js-libp2p-websocket-star) | [![Travis CI](https://flat.badgen.net/travis/libp2p/js-libp2p-websocket-star/master)](https://travis-ci.com/libp2p/js-libp2p-websocket-star) | [![codecov](https://codecov.io/gh/libp2p/js-libp2p-websocket-star/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-websocket-star) | [Jacob Heun](mailto:jacobheun@gmail.com) | diff --git a/packages/ipfs/package-list.json b/packages/ipfs/package-list.json index e21c128e8f..34c75cee71 100644 --- a/packages/ipfs/package-list.json +++ b/packages/ipfs/package-list.json @@ -46,6 +46,7 @@ ["libp2p/js-libp2p-mdns", "libp2p-mdns"], ["libp2p/js-libp2p-bootstrap", "libp2p-bootstrap"], ["libp2p/js-libp2p-secio", "libp2p-secio"], + ["NodeFactoryIo/js-libp2p-noise", "libp2p-noise"], ["libp2p/js-libp2p-tcp", "libp2p-tcp"], ["libp2p/js-libp2p-webrtc-star", "libp2p-webrtc-star"], ["libp2p/js-libp2p-websocket-star", "libp2p-websocket-star"], diff --git a/packages/ipfs/package.json b/packages/ipfs/package.json index 8e25a7ca97..0ff693e550 100644 --- a/packages/ipfs/package.json +++ b/packages/ipfs/package.json @@ -138,6 +138,7 @@ "libp2p-kad-dht": "^0.19.5", "libp2p-mdns": "^0.14.1", "libp2p-mplex": "^0.9.3", + "libp2p-noise": "^1.1.1", "libp2p-record": "^0.7.3", "libp2p-secio": "^0.12.2", "libp2p-tcp": "^0.14.5", diff --git a/packages/ipfs/src/core/runtime/libp2p-browser.js b/packages/ipfs/src/core/runtime/libp2p-browser.js index d963803287..8260328c9d 100644 --- a/packages/ipfs/src/core/runtime/libp2p-browser.js +++ b/packages/ipfs/src/core/runtime/libp2p-browser.js @@ -3,6 +3,7 @@ const WS = require('libp2p-websockets') const WebRTCStar = require('libp2p-webrtc-star') const Multiplex = require('libp2p-mplex') +const { NOISE } = require('libp2p-noise') const SECIO = require('libp2p-secio') const KadDHT = require('libp2p-kad-dht') const GossipSub = require('libp2p-gossipsub') @@ -24,7 +25,8 @@ module.exports = () => { Multiplex ], connEncryption: [ - SECIO + SECIO, + NOISE ], peerDiscovery: [], dht: KadDHT, diff --git a/packages/ipfs/src/core/runtime/libp2p-nodejs.js b/packages/ipfs/src/core/runtime/libp2p-nodejs.js index 5629401a82..32dc0f571e 100644 --- a/packages/ipfs/src/core/runtime/libp2p-nodejs.js +++ b/packages/ipfs/src/core/runtime/libp2p-nodejs.js @@ -7,6 +7,7 @@ const KadDHT = require('libp2p-kad-dht') const GossipSub = require('libp2p-gossipsub') const Multiplex = require('libp2p-mplex') const SECIO = require('libp2p-secio') +const { NOISE } = require('libp2p-noise') const ipnsUtils = require('../ipns/routing/utils') module.exports = () => { @@ -25,7 +26,8 @@ module.exports = () => { Multiplex ], connEncryption: [ - SECIO + SECIO, + NOISE ], peerDiscovery: [ MulticastDNS From c70259f224651e3c40dbabee2e51dbd5d2531742 Mon Sep 17 00:00:00 2001 From: Vasco Santos Date: Mon, 8 Jun 2020 17:29:45 +0200 Subject: [PATCH 2/2] chore: increase bundle size --- packages/ipfs/.aegir.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ipfs/.aegir.js b/packages/ipfs/.aegir.js index 8eff05dae3..eb30044fae 100644 --- a/packages/ipfs/.aegir.js +++ b/packages/ipfs/.aegir.js @@ -15,7 +15,7 @@ let sigServerB let ipfsdServer module.exports = { - bundlesize: { maxSize: '446kB' }, + bundlesize: { maxSize: '530kB' }, karma: { files: [{ pattern: 'node_modules/interface-ipfs-core/test/fixtures/**/*',