mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-07-07 21:01:36 +00:00
Compare commits
37 Commits
Author | SHA1 | Date | |
---|---|---|---|
b216471f44 | |||
10f4cb969d | |||
f3fd734a2a | |||
28d915ebb6 | |||
fb59bf2bf5 | |||
d0ae8b6267 | |||
4b01fbebf9 | |||
4f095a0543 | |||
aba09a4f30 | |||
90e88742b0 | |||
fc492c6739 | |||
21d74401ed | |||
d5374f0167 | |||
f73fe2502b | |||
2d6c0ed3f7 | |||
ae0cd81ed9 | |||
4ac25c9f32 | |||
52fdf7b40c | |||
8ca5f60f42 | |||
b8f77ea5ed | |||
7e6f3f2e22 | |||
f9a35dd8a4 | |||
a2d2c953bc | |||
e836bb7ff0 | |||
f686a3a010 | |||
92946a59c3 | |||
65e8fd5f24 | |||
f07b35f4d4 | |||
85f601f809 | |||
bb6d3dfc36 | |||
4312acf49a | |||
45c0e957c3 | |||
7d4294b279 | |||
228c2b09de | |||
faa5433f8d | |||
de53a00e4d | |||
cf45341754 |
42
.gitignore
vendored
42
.gitignore
vendored
@ -1,33 +1,13 @@
|
||||
package-lock.json
|
||||
yarn.lock
|
||||
docs
|
||||
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
|
||||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (http://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directory
|
||||
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
|
||||
node_modules
|
||||
|
||||
|
||||
coverage
|
||||
|
||||
**/node_modules
|
||||
**/*.log
|
||||
test/setup/tmp-disposable-nodes-addrs.json
|
||||
dist
|
||||
coverage
|
||||
**/*.swp
|
||||
examples/sub-module/**/bundle.js
|
||||
examples/sub-module/**/*-minified.js
|
||||
examples/sub-module/*-bundle.js
|
||||
|
20
.travis.yml
20
.travis.yml
@ -1,23 +1,19 @@
|
||||
# Warning: This file is automatically synced from https://github.com/ipfs/ci-sync so if you want to change it, please change it there and ask someone to sync all repositories.
|
||||
sudo: false
|
||||
language: node_js
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- node_js: 4
|
||||
env: CXX=g++-4.8
|
||||
- node_js: 6
|
||||
env:
|
||||
- SAUCE=true
|
||||
- CXX=g++-4.8
|
||||
- node_js: stable
|
||||
env: CXX=g++-4.8
|
||||
|
||||
# Make sure we have new NPM.
|
||||
before_install:
|
||||
- npm install -g npm
|
||||
- node_js: 8
|
||||
env: CXX=g++-4.8
|
||||
# - node_js: stable
|
||||
# env: CXX=g++-4.8
|
||||
|
||||
script:
|
||||
- npm run lint
|
||||
- npm test
|
||||
- npm run test
|
||||
- npm run coverage
|
||||
|
||||
before_script:
|
||||
@ -33,4 +29,4 @@ addons:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- g++-4.8
|
||||
- g++-4.8
|
||||
|
121
CHANGELOG.md
Normal file
121
CHANGELOG.md
Normal file
@ -0,0 +1,121 @@
|
||||
<a name="0.7.1"></a>
|
||||
## [0.7.1](https://github.com/libp2p/js-libp2p-identify/compare/v0.7.0...v0.7.1) (2018-04-30)
|
||||
|
||||
|
||||
|
||||
<a name="0.7.0"></a>
|
||||
# [0.7.0](https://github.com/libp2p/js-libp2p-identify/compare/v0.6.3...v0.7.0) (2018-04-05)
|
||||
|
||||
|
||||
|
||||
<a name="0.6.3"></a>
|
||||
## [0.6.3](https://github.com/libp2p/js-libp2p-identify/compare/v0.6.2...v0.6.3) (2018-01-28)
|
||||
|
||||
|
||||
|
||||
<a name="0.6.2"></a>
|
||||
## [0.6.2](https://github.com/libp2p/js-libp2p-identify/compare/v0.6.1...v0.6.2) (2018-01-07)
|
||||
|
||||
|
||||
|
||||
<a name="0.6.1"></a>
|
||||
## [0.6.1](https://github.com/libp2p/js-libp2p-identify/compare/v0.6.0...v0.6.1) (2017-09-07)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* replace protocol-buffers with protons ([#42](https://github.com/libp2p/js-libp2p-identify/issues/42)) ([4ac25c9](https://github.com/libp2p/js-libp2p-identify/commit/4ac25c9))
|
||||
|
||||
|
||||
|
||||
<a name="0.6.0"></a>
|
||||
# [0.6.0](https://github.com/libp2p/js-libp2p-identify/compare/v0.5.0...v0.6.0) (2017-09-03)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* p2p addrs situation ([#41](https://github.com/libp2p/js-libp2p-identify/issues/41)) ([b8f77ea](https://github.com/libp2p/js-libp2p-identify/commit/b8f77ea))
|
||||
|
||||
|
||||
|
||||
<a name="0.5.0"></a>
|
||||
# [0.5.0](https://github.com/libp2p/js-libp2p-identify/compare/v0.4.2...v0.5.0) (2017-07-22)
|
||||
|
||||
|
||||
|
||||
<a name="0.4.2"></a>
|
||||
## [0.4.2](https://github.com/libp2p/js-libp2p-identify/compare/v0.4.1...v0.4.2) (2017-07-08)
|
||||
|
||||
|
||||
|
||||
<a name="0.4.1"></a>
|
||||
## [0.4.1](https://github.com/libp2p/js-libp2p-identify/compare/v0.4.0...v0.4.1) (2017-04-06)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* if conn was closed, don't crash just because identify didn't get any data ([#40](https://github.com/libp2p/js-libp2p-identify/issues/40)) ([bb6d3df](https://github.com/libp2p/js-libp2p-identify/commit/bb6d3df))
|
||||
|
||||
|
||||
|
||||
<a name="0.4.0"></a>
|
||||
# [0.4.0](https://github.com/libp2p/js-libp2p-identify/compare/v0.3.3...v0.4.0) (2017-03-30)
|
||||
|
||||
|
||||
|
||||
<a name="0.3.3"></a>
|
||||
## [0.3.3](https://github.com/libp2p/js-libp2p-identify/compare/v0.3.2...v0.3.3) (2017-03-21)
|
||||
|
||||
|
||||
|
||||
<a name="0.3.2"></a>
|
||||
## [0.3.2](https://github.com/libp2p/js-libp2p-identify/compare/v0.3.1...v0.3.2) (2017-02-09)
|
||||
|
||||
|
||||
|
||||
<a name="0.3.1"></a>
|
||||
## [0.3.1](https://github.com/libp2p/js-libp2p-identify/compare/v0.3.0...v0.3.1) (2017-01-11)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* remove deprecation notice from identify protobuf ([38171cd](https://github.com/libp2p/js-libp2p-identify/commit/38171cd))
|
||||
|
||||
|
||||
|
||||
<a name="0.3.0"></a>
|
||||
# [0.3.0](https://github.com/libp2p/js-libp2p-identify/compare/v0.2.0...v0.3.0) (2016-11-03)
|
||||
|
||||
|
||||
|
||||
<a name="0.2.0"></a>
|
||||
# [0.2.0](https://github.com/libp2p/js-libp2p-identify/compare/v0.1.3...v0.2.0) (2016-09-06)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **api:** move to pull-streams ([3b751c2](https://github.com/libp2p/js-libp2p-identify/commit/3b751c2))
|
||||
* **readme:** documentationa and cleanup of code ([82bc0f2](https://github.com/libp2p/js-libp2p-identify/commit/82bc0f2))
|
||||
|
||||
|
||||
|
||||
<a name="0.1.3"></a>
|
||||
## [0.1.3](https://github.com/libp2p/js-libp2p-identify/compare/v0.1.2...v0.1.3) (2016-08-03)
|
||||
|
||||
|
||||
|
||||
<a name="0.1.2"></a>
|
||||
## [0.1.2](https://github.com/libp2p/js-libp2p-identify/compare/v0.1.1...v0.1.2) (2016-06-27)
|
||||
|
||||
|
||||
|
||||
<a name="0.1.1"></a>
|
||||
## [0.1.1](https://github.com/libp2p/js-libp2p-identify/compare/v0.1.0...v0.1.1) (2016-06-27)
|
||||
|
||||
|
||||
|
||||
<a name="0.1.0"></a>
|
||||
# 0.1.0 (2016-06-27)
|
||||
|
||||
|
||||
|
@ -6,11 +6,10 @@
|
||||
[](https://coveralls.io/github/libp2p/js-libp2p-identify?branch=master)
|
||||
[](https://travis-ci.org/libp2p/js-libp2p-identify)
|
||||
[](https://circleci.com/gh/libp2p/js-libp2p-identify)
|
||||
[](https://david-dm.org/libp2p/js-libp2p-identify) [](https://github.com/feross/standard)
|
||||
[](https://david-dm.org/libp2p/js-libp2p-identify)
|
||||
[](https://github.com/feross/standard)
|
||||

|
||||

|
||||
|
||||
[](https://saucelabs.com/u/libp2p-js-identify)
|
||||

|
||||
|
||||
> libp2p Identify Protocol
|
||||
|
||||
|
29
appveyor.yml
Normal file
29
appveyor.yml
Normal file
@ -0,0 +1,29 @@
|
||||
# Warning: This file is automatically synced from https://github.com/ipfs/ci-sync so if you want to change it, please change it there and ask someone to sync all repositories.
|
||||
version: "{build}"
|
||||
|
||||
environment:
|
||||
matrix:
|
||||
- nodejs_version: "6"
|
||||
- nodejs_version: "8"
|
||||
|
||||
matrix:
|
||||
fast_finish: true
|
||||
|
||||
install:
|
||||
# Install Node.js
|
||||
- ps: Install-Product node $env:nodejs_version
|
||||
|
||||
# Upgrade npm
|
||||
- npm install -g npm
|
||||
|
||||
# Output our current versions for debugging
|
||||
- node --version
|
||||
- npm --version
|
||||
|
||||
# Install our package dependencies
|
||||
- npm install
|
||||
|
||||
test_script:
|
||||
- npm run test:node
|
||||
|
||||
build: off
|
2
ci/Jenkinsfile
vendored
Normal file
2
ci/Jenkinsfile
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
// Warning: This file is automatically synced from https://github.com/ipfs/ci-sync so if you want to change it, please change it there and ask someone to sync all repositories.
|
||||
javascript()
|
12
circle.yml
12
circle.yml
@ -1,4 +1,4 @@
|
||||
|
||||
# Warning: This file is automatically synced from https://github.com/ipfs/ci-sync so if you want to change it, please change it there and ask someone to sync all repositories.
|
||||
machine:
|
||||
node:
|
||||
version: stable
|
||||
@ -6,8 +6,10 @@ machine:
|
||||
dependencies:
|
||||
pre:
|
||||
- google-chrome --version
|
||||
- wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
|
||||
- sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
|
||||
- curl -L -o google-chrome.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
|
||||
- sudo dpkg -i google-chrome.deb || true
|
||||
- sudo apt-get update
|
||||
- sudo apt-get --only-upgrade install google-chrome-stable
|
||||
- google-chrome --version
|
||||
- sudo apt-get install -f
|
||||
- sudo apt-get install --only-upgrade lsb-base
|
||||
- sudo dpkg -i google-chrome.deb
|
||||
- google-chrome --version
|
||||
|
47
package.json
47
package.json
@ -1,26 +1,26 @@
|
||||
{
|
||||
"name": "libp2p-identify",
|
||||
"version": "0.3.2",
|
||||
"version": "0.7.1",
|
||||
"description": "libp2p Identify Protocol",
|
||||
"main": "src/index.js",
|
||||
"scripts": {
|
||||
"lint": "aegir-lint",
|
||||
"build": "aegir-build",
|
||||
"test": "aegir-test",
|
||||
"test:node": "aegir-test --env node",
|
||||
"test:browser": "aegir-test --env browser",
|
||||
"release": "aegir-release",
|
||||
"release-minor": "aegir-release --type minor",
|
||||
"release-major": "aegir-release --type major",
|
||||
"coverage": "aegir-coverage",
|
||||
"coverage-publish": "aegir-coverage publish"
|
||||
"lint": "aegir lint",
|
||||
"build": "aegir build",
|
||||
"test": "aegir test",
|
||||
"test:node": "aegir test -t node",
|
||||
"test:browser": "aegir test -t browser",
|
||||
"release": "aegir release",
|
||||
"release-minor": "aegir release --type minor",
|
||||
"release-major": "aegir release --type major",
|
||||
"coverage": "aegir coverage"
|
||||
},
|
||||
"pre-commit": [
|
||||
"lint",
|
||||
"test"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=4.0.0"
|
||||
"node": ">=6.0.0",
|
||||
"npm": ">=3.0.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@ -37,23 +37,26 @@
|
||||
},
|
||||
"homepage": "https://github.com/libp2p/js-libp2p-identify#readme",
|
||||
"devDependencies": {
|
||||
"aegir": "^10.0.0",
|
||||
"chai": "^3.5.0",
|
||||
"aegir": "^13.1.0",
|
||||
"chai": "^4.1.2",
|
||||
"dirty-chai": "^2.0.1",
|
||||
"pre-commit": "^1.2.2",
|
||||
"pull-pair": "^1.1.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"multiaddr": "^2.2.1",
|
||||
"peer-id": "~0.8.2",
|
||||
"peer-info": "~0.8.3",
|
||||
"protocol-buffers": "^3.2.1",
|
||||
"pull-length-prefixed": "^1.2.0",
|
||||
"pull-stream": "^3.5.0"
|
||||
"multiaddr": "^5.0.0",
|
||||
"peer-id": "~0.10.7",
|
||||
"peer-info": "~0.14.1",
|
||||
"protons": "^1.0.1",
|
||||
"pull-length-prefixed": "^1.3.0",
|
||||
"pull-stream": "^3.6.7"
|
||||
},
|
||||
"contributors": [
|
||||
"David Dias <daviddias.p@gmail.com>",
|
||||
"Friedel Ziegelmayer <dignifiedquire@gmail.com>",
|
||||
"Greenkeeper <support@greenkeeper.io>",
|
||||
"Richard Littauer <richard.littauer@gmail.com>"
|
||||
"Maciej Krüger <mkg20001@gmail.com>",
|
||||
"Richard Littauer <richard.littauer@gmail.com>",
|
||||
"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ <victorbjelkholm@gmail.com>"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,11 @@ module.exports = (conn, callback) => {
|
||||
return callback(err)
|
||||
}
|
||||
|
||||
// connection got closed graciously
|
||||
if (data.length === 0) {
|
||||
return callback(new Error('conn was closed, did not receive data'))
|
||||
}
|
||||
|
||||
const input = msg.decode(data[0])
|
||||
|
||||
PeerId.createFromPubKey(input.publicKey, (err, id) => {
|
||||
@ -24,12 +29,24 @@ module.exports = (conn, callback) => {
|
||||
return callback(err)
|
||||
}
|
||||
|
||||
const info = new PeerInfo(id)
|
||||
input.listenAddrs
|
||||
.map(multiaddr)
|
||||
.forEach((ma) => info.multiaddr.add(ma))
|
||||
const peerInfo = new PeerInfo(id)
|
||||
try {
|
||||
input.listenAddrs
|
||||
.map(multiaddr)
|
||||
.forEach((ma) => peerInfo.multiaddrs.add(ma))
|
||||
} catch (err) {
|
||||
return callback(err)
|
||||
}
|
||||
|
||||
callback(null, info, getObservedAddrs(input))
|
||||
let observedAddr
|
||||
|
||||
try {
|
||||
observedAddr = getObservedAddrs(input)
|
||||
} catch (err) {
|
||||
return callback(err)
|
||||
}
|
||||
|
||||
callback(null, peerInfo, observedAddr)
|
||||
})
|
||||
})
|
||||
)
|
||||
|
@ -11,7 +11,7 @@ module.exports = (conn, pInfoSelf) => {
|
||||
if (err) { return }
|
||||
observedAddrs = observedAddrs[0]
|
||||
|
||||
let publicKey = new Buffer(0)
|
||||
let publicKey = Buffer.alloc(0)
|
||||
if (pInfoSelf.id.pubKey) {
|
||||
publicKey = pInfoSelf.id.pubKey.bytes
|
||||
}
|
||||
@ -20,8 +20,8 @@ module.exports = (conn, pInfoSelf) => {
|
||||
protocolVersion: 'ipfs/0.1.0',
|
||||
agentVersion: 'na',
|
||||
publicKey: publicKey,
|
||||
listenAddrs: pInfoSelf.multiaddrs.map((ma) => ma.buffer),
|
||||
observedAddr: observedAddrs ? observedAddrs.buffer : new Buffer('')
|
||||
listenAddrs: pInfoSelf.multiaddrs.toArray().map((ma) => ma.buffer),
|
||||
observedAddr: observedAddrs ? observedAddrs.buffer : Buffer.from('')
|
||||
})
|
||||
|
||||
pull(
|
||||
|
@ -1,7 +1,7 @@
|
||||
'use strict'
|
||||
|
||||
const protobuf = require('protocol-buffers')
|
||||
const schema = new Buffer(`
|
||||
const protons = require('protons')
|
||||
const schema = `
|
||||
message Identify {
|
||||
// protocolVersion determines compatibility between peers
|
||||
optional string protocolVersion = 5; // e.g. ipfs/1.0.0
|
||||
@ -25,6 +25,6 @@ message Identify {
|
||||
|
||||
repeated string protocols = 3;
|
||||
}
|
||||
`)
|
||||
`
|
||||
|
||||
module.exports = protobuf(schema).Identify
|
||||
module.exports = protons(schema).Identify
|
||||
|
15
test/basic.spec.js
Normal file
15
test/basic.spec.js
Normal file
@ -0,0 +1,15 @@
|
||||
/* eslint-env mocha */
|
||||
'use strict'
|
||||
|
||||
const chai = require('chai')
|
||||
const dirtyChai = require('dirty-chai')
|
||||
const expect = chai.expect
|
||||
chai.use(dirtyChai)
|
||||
|
||||
const identify = require('../src')
|
||||
|
||||
describe('basic', () => {
|
||||
it('multicodec', () => {
|
||||
expect(identify.multicodec).to.eql('/ipfs/id/1.0.0')
|
||||
})
|
||||
})
|
@ -2,7 +2,10 @@
|
||||
'use strict'
|
||||
|
||||
const pull = require('pull-stream')
|
||||
const expect = require('chai').expect
|
||||
const chai = require('chai')
|
||||
const dirtyChai = require('dirty-chai')
|
||||
const expect = chai.expect
|
||||
chai.use(dirtyChai)
|
||||
const pair = require('pull-pair/duplex')
|
||||
const PeerInfo = require('peer-info')
|
||||
const lp = require('pull-length-prefixed')
|
||||
@ -13,7 +16,9 @@ const identify = require('../src')
|
||||
|
||||
describe('identify.dialer', () => {
|
||||
let original
|
||||
beforeEach((done) => {
|
||||
beforeEach(function (done) {
|
||||
this.timeout(20 * 1000)
|
||||
|
||||
PeerInfo.create((err, info) => {
|
||||
if (err) {
|
||||
return done(err)
|
||||
@ -26,7 +31,7 @@ describe('identify.dialer', () => {
|
||||
|
||||
it('works', (done) => {
|
||||
const p = pair()
|
||||
original.multiaddr.add(multiaddr('/ip4/127.0.0.1/tcp/5002'))
|
||||
original.multiaddrs.add(multiaddr('/ip4/127.0.0.1/tcp/5002'))
|
||||
const input = msg.encode({
|
||||
protocolVersion: 'ipfs/0.1.0',
|
||||
agentVersion: 'na',
|
||||
@ -42,24 +47,63 @@ describe('identify.dialer', () => {
|
||||
)
|
||||
|
||||
identify.dialer(p[1], (err, info, observedAddrs) => {
|
||||
expect(err).to.not.exist
|
||||
expect(
|
||||
info.id.pubKey.bytes
|
||||
).to.be.eql(
|
||||
original.id.pubKey.bytes
|
||||
)
|
||||
expect(err).to.not.exist()
|
||||
expect(info.id.pubKey.bytes)
|
||||
.to.eql(original.id.pubKey.bytes)
|
||||
|
||||
expect(
|
||||
info.multiaddrs
|
||||
).to.be.eql(
|
||||
original.multiaddrs
|
||||
)
|
||||
expect(info.multiaddrs.toArray())
|
||||
.to.eql(original.multiaddrs.toArray())
|
||||
|
||||
expect(
|
||||
observedAddrs
|
||||
).to.be.eql(
|
||||
[multiaddr('/ip4/127.0.0.1/tcp/5001')]
|
||||
)
|
||||
expect(observedAddrs)
|
||||
.to.eql([multiaddr('/ip4/127.0.0.1/tcp/5001')])
|
||||
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
it('does not crash with invalid listen addresses', (done) => {
|
||||
const p = pair()
|
||||
original.multiaddrs.add(multiaddr('/ip4/127.0.0.1/tcp/5002'))
|
||||
const input = msg.encode({
|
||||
protocolVersion: 'ipfs/0.1.0',
|
||||
agentVersion: 'na',
|
||||
publicKey: original.id.pubKey.bytes,
|
||||
listenAddrs: [Buffer.from('ffac010203')],
|
||||
observedAddr: Buffer.from('ffac010203')
|
||||
})
|
||||
|
||||
pull(
|
||||
pull.values([input]),
|
||||
lp.encode(),
|
||||
p[0]
|
||||
)
|
||||
|
||||
identify.dialer(p[1], (err, info, observedAddrs) => {
|
||||
expect(err).to.exist()
|
||||
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
it('does not crash with invalid observed address', (done) => {
|
||||
const p = pair()
|
||||
original.multiaddrs.add(multiaddr('/ip4/127.0.0.1/tcp/5002'))
|
||||
const input = msg.encode({
|
||||
protocolVersion: 'ipfs/0.1.0',
|
||||
agentVersion: 'na',
|
||||
publicKey: original.id.pubKey.bytes,
|
||||
listenAddrs: [multiaddr('/ip4/127.0.0.1/tcp/5002').buffer],
|
||||
observedAddr: Buffer.from('ffac010203')
|
||||
})
|
||||
|
||||
pull(
|
||||
pull.values([input]),
|
||||
lp.encode(),
|
||||
p[0]
|
||||
)
|
||||
|
||||
identify.dialer(p[1], (err, info, observedAddrs) => {
|
||||
expect(err).to.exist()
|
||||
|
||||
done()
|
||||
})
|
||||
|
@ -1,16 +0,0 @@
|
||||
/* eslint-env mocha */
|
||||
'use strict'
|
||||
|
||||
const expect = require('chai').expect
|
||||
|
||||
const identify = require('../src')
|
||||
|
||||
describe('identify', () => {
|
||||
it('multicodec', () => {
|
||||
expect(
|
||||
identify.multicodec
|
||||
).to.be.eql(
|
||||
'/ipfs/id/1.0.0'
|
||||
)
|
||||
})
|
||||
})
|
@ -2,7 +2,10 @@
|
||||
'use strict'
|
||||
|
||||
const pull = require('pull-stream')
|
||||
const expect = require('chai').expect
|
||||
const chai = require('chai')
|
||||
const dirtyChai = require('dirty-chai')
|
||||
const expect = chai.expect
|
||||
chai.use(dirtyChai)
|
||||
const pair = require('pull-pair/duplex')
|
||||
const PeerInfo = require('peer-info')
|
||||
const lp = require('pull-length-prefixed')
|
||||
@ -13,7 +16,10 @@ const identify = require('../src')
|
||||
|
||||
describe('identify.listener', () => {
|
||||
let info
|
||||
beforeEach((done) => {
|
||||
|
||||
beforeEach(function (done) {
|
||||
this.timeout(20 * 1000)
|
||||
|
||||
PeerInfo.create((err, _info) => {
|
||||
if (err) {
|
||||
return done(err)
|
||||
@ -26,12 +32,14 @@ describe('identify.listener', () => {
|
||||
|
||||
it('works', (done) => {
|
||||
const p = pair()
|
||||
info.multiaddr.add(multiaddr('/ip4/127.0.0.1/tcp/5002'))
|
||||
|
||||
info.multiaddrs.add(multiaddr('/ip4/127.0.0.1/tcp/5002'))
|
||||
|
||||
pull(
|
||||
p[1],
|
||||
lp.decode(),
|
||||
pull.collect((err, result) => {
|
||||
expect(err).to.not.exist
|
||||
expect(err).to.not.exist()
|
||||
|
||||
const input = msg.decode(result[0])
|
||||
expect(
|
||||
|
Reference in New Issue
Block a user