This repository has been archived by the owner on Oct 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fe9fadb
commit 6d2e669
Showing
12 changed files
with
179 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# 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 | ||
|
||
test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
sudo: false | ||
language: node_js | ||
node_js: | ||
- 4 | ||
- 5 | ||
|
||
# Make sure we have new NPM. | ||
before_install: | ||
- npm install -g npm | ||
|
||
script: | ||
- npm run lint | ||
- npm test | ||
- npm run coverage | ||
|
||
addons: | ||
firefox: 'latest' | ||
|
||
before_script: | ||
- export DISPLAY=:99.0 | ||
- sh -e /etc/init.d/xvfb start | ||
|
||
after_success: | ||
- npm run coverage-publish |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
machine: | ||
node: | ||
version: stable | ||
|
||
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' | ||
- sudo apt-get update | ||
- sudo apt-get --only-upgrade install google-chrome-stable | ||
- google-chrome --version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
'use strict' | ||
|
||
var Bootstrap = require('./../src') | ||
var b = new Bootstrap(Bootstrap.default) | ||
|
||
console.log(b) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
'use strict' | ||
|
||
var Id = require('peer-id') | ||
var Peer = require('peer-info') | ||
var multiaddr = require('multiaddr') | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* eslint-env mocha */ | ||
'use strict' | ||
|
||
var Bootstrap = require('./../src') | ||
|
||
describe('Without verify on', function () { | ||
before(function (done) { | ||
done() | ||
}) | ||
|
||
it('Find the other peer', function (done) { | ||
this.timeout(1e3 * 10) | ||
|
||
var bA = new Bootstrap(Bootstrap.default, { | ||
verify: false | ||
}) | ||
|
||
bA.once('peer', function (peer) { | ||
done() | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* eslint-env mocha */ | ||
'use strict' | ||
|
||
var multiaddr = require('multiaddr') | ||
var Id = require('peer-id') | ||
var Peer = require('peer-info') | ||
var Swarm = require('libp2p-swarm') | ||
var tcp = require('libp2p-tcp') | ||
|
||
var Broadcast = require('./../src') | ||
|
||
var pA | ||
var pB | ||
var swA | ||
var swB | ||
|
||
describe('With verify on', function () { | ||
before(function (done) { | ||
var mh1 = multiaddr('/ip4/127.0.0.1/tcp/8010') | ||
pA = new Peer(Id.create(), []) | ||
swA = new Swarm(pA) | ||
swA.addTransport('tcp', tcp, { multiaddr: mh1 }, {}, {port: 8010}, ready) | ||
|
||
var mh2 = multiaddr('/ip4/127.0.0.1/tcp/8020') | ||
pB = new Peer(Id.create(), []) | ||
swB = new Swarm(pB) | ||
swB.addTransport('tcp', tcp, { multiaddr: mh2 }, {}, {port: 8020}, ready) | ||
|
||
var readyCounter = 0 | ||
|
||
function ready () { | ||
readyCounter++ | ||
if (readyCounter < 2) { | ||
return | ||
} | ||
done() | ||
} | ||
}) | ||
|
||
after(function (done) { | ||
swA.close() | ||
swB.close() | ||
done() | ||
}) | ||
|
||
it('Find the other peer', function (done) { | ||
this.timeout(1e3 * 10) | ||
var peerList = [ | ||
pB.multiaddrs[0].toString() + '/ipfs/' + pB.id.toB58String() | ||
] | ||
var bA = new Broadcast(peerList, { | ||
verify: true | ||
}, swA) | ||
|
||
bA.once('peer', function (peer) { | ||
done() | ||
}) | ||
}) | ||
}) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.