mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-07-09 13:51:34 +00:00
Compare commits
17 Commits
Author | SHA1 | Date | |
---|---|---|---|
4f095a0543 | |||
aba09a4f30 | |||
90e88742b0 | |||
fc492c6739 | |||
21d74401ed | |||
d5374f0167 | |||
f73fe2502b | |||
2d6c0ed3f7 | |||
ae0cd81ed9 | |||
4ac25c9f32 | |||
52fdf7b40c | |||
8ca5f60f42 | |||
b8f77ea5ed | |||
7e6f3f2e22 | |||
f9a35dd8a4 | |||
a2d2c953bc | |||
e836bb7ff0 |
42
.gitignore
vendored
42
.gitignore
vendored
@ -1,33 +1,13 @@
|
|||||||
|
package-lock.json
|
||||||
|
yarn.lock
|
||||||
|
docs
|
||||||
|
|
||||||
# Logs
|
**/node_modules
|
||||||
logs
|
**/*.log
|
||||||
*.log
|
test/setup/tmp-disposable-nodes-addrs.json
|
||||||
|
|
||||||
# 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
|
|
||||||
|
|
||||||
dist
|
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
|
sudo: false
|
||||||
language: node_js
|
language: node_js
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- node_js: 4
|
|
||||||
env: CXX=g++-4.8
|
|
||||||
- node_js: 6
|
- node_js: 6
|
||||||
env:
|
|
||||||
- SAUCE=true
|
|
||||||
- CXX=g++-4.8
|
|
||||||
- node_js: stable
|
|
||||||
env: CXX=g++-4.8
|
env: CXX=g++-4.8
|
||||||
|
- node_js: 8
|
||||||
# Make sure we have new NPM.
|
env: CXX=g++-4.8
|
||||||
before_install:
|
# - node_js: stable
|
||||||
- npm install -g npm
|
# env: CXX=g++-4.8
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- npm run lint
|
- npm run lint
|
||||||
- npm test
|
- npm run test
|
||||||
- npm run coverage
|
- npm run coverage
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
@ -33,4 +29,4 @@ addons:
|
|||||||
sources:
|
sources:
|
||||||
- ubuntu-toolchain-r-test
|
- ubuntu-toolchain-r-test
|
||||||
packages:
|
packages:
|
||||||
- g++-4.8
|
- g++-4.8
|
||||||
|
111
CHANGELOG.md
Normal file
111
CHANGELOG.md
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
<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://coveralls.io/github/libp2p/js-libp2p-identify?branch=master)
|
||||||
[](https://travis-ci.org/libp2p/js-libp2p-identify)
|
[](https://travis-ci.org/libp2p/js-libp2p-identify)
|
||||||
[](https://circleci.com/gh/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
|
> 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:
|
machine:
|
||||||
node:
|
node:
|
||||||
version: stable
|
version: stable
|
||||||
@ -6,8 +6,10 @@ machine:
|
|||||||
dependencies:
|
dependencies:
|
||||||
pre:
|
pre:
|
||||||
- google-chrome --version
|
- google-chrome --version
|
||||||
- wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
|
- curl -L -o google-chrome.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
|
||||||
- sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
|
- sudo dpkg -i google-chrome.deb || true
|
||||||
- sudo apt-get update
|
- sudo apt-get update
|
||||||
- sudo apt-get --only-upgrade install google-chrome-stable
|
- sudo apt-get install -f
|
||||||
- google-chrome --version
|
- sudo apt-get install --only-upgrade lsb-base
|
||||||
|
- sudo dpkg -i google-chrome.deb
|
||||||
|
- google-chrome --version
|
||||||
|
45
package.json
45
package.json
@ -1,26 +1,26 @@
|
|||||||
{
|
{
|
||||||
"name": "libp2p-identify",
|
"name": "libp2p-identify",
|
||||||
"version": "0.4.2",
|
"version": "0.6.3",
|
||||||
"description": "libp2p Identify Protocol",
|
"description": "libp2p Identify Protocol",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lint": "aegir-lint",
|
"lint": "aegir lint",
|
||||||
"build": "aegir-build",
|
"build": "aegir build",
|
||||||
"test": "aegir-test",
|
"test": "aegir test",
|
||||||
"test:node": "aegir-test --env node",
|
"test:node": "aegir test -t node",
|
||||||
"test:browser": "aegir-test --env browser",
|
"test:browser": "aegir test -t browser",
|
||||||
"release": "aegir-release",
|
"release": "aegir release",
|
||||||
"release-minor": "aegir-release --type minor",
|
"release-minor": "aegir release --type minor",
|
||||||
"release-major": "aegir-release --type major",
|
"release-major": "aegir release --type major",
|
||||||
"coverage": "aegir-coverage",
|
"coverage": "aegir coverage"
|
||||||
"coverage-publish": "aegir-coverage publish"
|
|
||||||
},
|
},
|
||||||
"pre-commit": [
|
"pre-commit": [
|
||||||
"lint",
|
"lint",
|
||||||
"test"
|
"test"
|
||||||
],
|
],
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=4.0.0"
|
"node": ">=6.0.0",
|
||||||
|
"npm": ">=3.0.0"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@ -37,24 +37,25 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/libp2p/js-libp2p-identify#readme",
|
"homepage": "https://github.com/libp2p/js-libp2p-identify#readme",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"aegir": "^11.0.2",
|
"aegir": "^12.4.0",
|
||||||
"chai": "^4.0.2",
|
"chai": "^4.1.2",
|
||||||
"dirty-chai": "^2.0.0",
|
"dirty-chai": "^2.0.1",
|
||||||
"pre-commit": "^1.2.2",
|
"pre-commit": "^1.2.2",
|
||||||
"pull-pair": "^1.1.0"
|
"pull-pair": "^1.1.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"multiaddr": "^2.3.0",
|
"multiaddr": "^3.0.2",
|
||||||
"peer-id": "~0.8.7",
|
"peer-id": "~0.10.5",
|
||||||
"peer-info": "~0.9.2",
|
"peer-info": "~0.11.6",
|
||||||
"protocol-buffers": "^3.2.1",
|
"protons": "^1.0.1",
|
||||||
"pull-length-prefixed": "^1.3.0",
|
"pull-length-prefixed": "^1.3.0",
|
||||||
"pull-stream": "^3.6.0"
|
"pull-stream": "^3.6.1"
|
||||||
},
|
},
|
||||||
"contributors": [
|
"contributors": [
|
||||||
"David Dias <daviddias.p@gmail.com>",
|
"David Dias <daviddias.p@gmail.com>",
|
||||||
"Friedel Ziegelmayer <dignifiedquire@gmail.com>",
|
"Friedel Ziegelmayer <dignifiedquire@gmail.com>",
|
||||||
"Greenkeeper <support@greenkeeper.io>",
|
"Greenkeeper <support@greenkeeper.io>",
|
||||||
"Richard Littauer <richard.littauer@gmail.com>"
|
"Richard Littauer <richard.littauer@gmail.com>",
|
||||||
|
"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ <victorbjelkholm@gmail.com>"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ module.exports = (conn, pInfoSelf) => {
|
|||||||
if (err) { return }
|
if (err) { return }
|
||||||
observedAddrs = observedAddrs[0]
|
observedAddrs = observedAddrs[0]
|
||||||
|
|
||||||
let publicKey = new Buffer(0)
|
let publicKey = Buffer.alloc(0)
|
||||||
if (pInfoSelf.id.pubKey) {
|
if (pInfoSelf.id.pubKey) {
|
||||||
publicKey = pInfoSelf.id.pubKey.bytes
|
publicKey = pInfoSelf.id.pubKey.bytes
|
||||||
}
|
}
|
||||||
@ -21,7 +21,7 @@ module.exports = (conn, pInfoSelf) => {
|
|||||||
agentVersion: 'na',
|
agentVersion: 'na',
|
||||||
publicKey: publicKey,
|
publicKey: publicKey,
|
||||||
listenAddrs: pInfoSelf.multiaddrs.toArray().map((ma) => ma.buffer),
|
listenAddrs: pInfoSelf.multiaddrs.toArray().map((ma) => ma.buffer),
|
||||||
observedAddr: observedAddrs ? observedAddrs.buffer : new Buffer('')
|
observedAddr: observedAddrs ? observedAddrs.buffer : Buffer.from('')
|
||||||
})
|
})
|
||||||
|
|
||||||
pull(
|
pull(
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
const protobuf = require('protocol-buffers')
|
const protons = require('protons')
|
||||||
const schema = new Buffer(`
|
const schema = `
|
||||||
message Identify {
|
message Identify {
|
||||||
// protocolVersion determines compatibility between peers
|
// protocolVersion determines compatibility between peers
|
||||||
optional string protocolVersion = 5; // e.g. ipfs/1.0.0
|
optional string protocolVersion = 5; // e.g. ipfs/1.0.0
|
||||||
@ -25,6 +25,6 @@ message Identify {
|
|||||||
|
|
||||||
repeated string protocols = 3;
|
repeated string protocols = 3;
|
||||||
}
|
}
|
||||||
`)
|
`
|
||||||
|
|
||||||
module.exports = protobuf(schema).Identify
|
module.exports = protons(schema).Identify
|
||||||
|
@ -8,7 +8,7 @@ chai.use(dirtyChai)
|
|||||||
|
|
||||||
const identify = require('../src')
|
const identify = require('../src')
|
||||||
|
|
||||||
describe('identify', () => {
|
describe('basic', () => {
|
||||||
it('multicodec', () => {
|
it('multicodec', () => {
|
||||||
expect(identify.multicodec).to.eql('/ipfs/id/1.0.0')
|
expect(identify.multicodec).to.eql('/ipfs/id/1.0.0')
|
||||||
})
|
})
|
@ -16,7 +16,9 @@ const identify = require('../src')
|
|||||||
|
|
||||||
describe('identify.dialer', () => {
|
describe('identify.dialer', () => {
|
||||||
let original
|
let original
|
||||||
beforeEach((done) => {
|
beforeEach(function (done) {
|
||||||
|
this.timeout(20 * 1000)
|
||||||
|
|
||||||
PeerInfo.create((err, info) => {
|
PeerInfo.create((err, info) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
return done(err)
|
return done(err)
|
||||||
|
@ -17,7 +17,9 @@ const identify = require('../src')
|
|||||||
describe('identify.listener', () => {
|
describe('identify.listener', () => {
|
||||||
let info
|
let info
|
||||||
|
|
||||||
beforeEach((done) => {
|
beforeEach(function (done) {
|
||||||
|
this.timeout(20 * 1000)
|
||||||
|
|
||||||
PeerInfo.create((err, _info) => {
|
PeerInfo.create((err, _info) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
return done(err)
|
return done(err)
|
||||||
@ -30,7 +32,9 @@ describe('identify.listener', () => {
|
|||||||
|
|
||||||
it('works', (done) => {
|
it('works', (done) => {
|
||||||
const p = pair()
|
const p = pair()
|
||||||
|
|
||||||
info.multiaddrs.add(multiaddr('/ip4/127.0.0.1/tcp/5002'))
|
info.multiaddrs.add(multiaddr('/ip4/127.0.0.1/tcp/5002'))
|
||||||
|
|
||||||
pull(
|
pull(
|
||||||
p[1],
|
p[1],
|
||||||
lp.decode(),
|
lp.decode(),
|
||||||
|
Reference in New Issue
Block a user