Skip to content
This repository was archived by the owner on Apr 29, 2020. It is now read-only.

Commit e697223

Browse files
update to new swarm + secio api
1 parent fbba79b commit e697223

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,19 @@
3232
},
3333
"homepage": "https://github.com/ipfs/js-libp2p-ipfs#readme",
3434
"devDependencies": {
35-
"aegir": "^6.0.1",
35+
"aegir": "^8.0.0",
3636
"chai": "^3.5.0",
3737
"pre-commit": "^1.1.3",
3838
"pull-stream": "^3.4.5",
3939
"run-parallel": "^1.1.6"
4040
},
4141
"dependencies": {
42-
"libp2p-spdy": "^0.8.1",
43-
"libp2p-swarm": "^0.22.2",
44-
"libp2p-tcp": "^0.7.4",
45-
"libp2p-websockets": "^0.7.1",
46-
"mafmt": "^2.1.1",
42+
"libp2p-secio": "^0.4.2",
43+
"libp2p-spdy": "^0.9.0",
44+
"libp2p-swarm": "^0.22.3",
45+
"libp2p-tcp": "^0.8.1",
46+
"libp2p-websockets": "^0.8.1",
47+
"mafmt": "^2.1.2",
4748
"multiaddr": "^2.0.2",
4849
"peer-book": "^0.3.0",
4950
"peer-id": "^0.7.0",

src/index.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
'use strict'
22

33
const Swarm = require('libp2p-swarm')
4-
const PeerId = require('peer-id')
5-
const PeerInfo = require('peer-info')
6-
const PeerBook = require('peer-book')
74
const TCP = require('libp2p-tcp')
85
// const UTP = require('libp2p-utp')
96
const WS = require('libp2p-websockets')
107
const spdy = require('libp2p-spdy')
8+
const secio = require('libp2p-secio')
9+
const PeerId = require('peer-id')
10+
const PeerInfo = require('peer-info')
11+
const PeerBook = require('peer-book')
1112
const multiaddr = require('multiaddr')
1213
const mafmt = require('mafmt')
1314
const EE = require('events').EventEmitter
@@ -39,6 +40,8 @@ exports.Node = function Node (pInfo, pBook) {
3940
this.swarm.connection.addStreamMuxer(spdy)
4041
this.swarm.connection.reuse()
4142

43+
this.swarm.connection.crypto(secio.tag, secio.encrypt)
44+
4245
this.swarm.on('peer-mux-established', (peerInfo) => {
4346
this.peerBook.put(peerInfo)
4447
})

0 commit comments

Comments
 (0)