mirror of
https://github.com/fluencelabs/js-libp2p-interfaces
synced 2025-03-16 21:10:54 +00:00
docs: Initial spec
This commit is contained in:
parent
ddd5c1908a
commit
bc27eb99b7
38
.travis.yml
Normal file
38
.travis.yml
Normal file
@ -0,0 +1,38 @@
|
||||
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
|
||||
|
||||
script:
|
||||
- npm run lint
|
||||
- npm test
|
||||
- npm run coverage
|
||||
- make test
|
||||
|
||||
before_script:
|
||||
- export DISPLAY=:99.0
|
||||
- sh -e /etc/init.d/xvfb start
|
||||
|
||||
after_success:
|
||||
- npm run coverage-publish
|
||||
|
||||
addons:
|
||||
firefox: 'latest'
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- g++-4.8
|
77
README.md
77
README.md
@ -1,2 +1,75 @@
|
||||
# interface-peer-discovery
|
||||
A test suite and interface you can use to implement a peer-discovery.
|
||||
interface-peer-discovery
|
||||
========================
|
||||
|
||||
[](http://ipn.io)
|
||||
[](http://ipfs.io/)
|
||||
[](http://webchat.freenode.net/?channels=%23ipfs)
|
||||
[](https://travis-ci.org/ipfs/interface-peer-discovery)
|
||||
[](https://david-dm.org/ipfs/interface-peer-discovery)
|
||||
[](https://github.com/feross/standard)
|
||||
|
||||
> A test suite and interface you can use to implement a peer discovery mechanism.
|
||||
|
||||
The primary goal of this module is to enable developers to pick and swap their stream muxing module as they see fit for their application, without having to go through shims or compatibility issues. This module and test suite was heavily inspired by [abstract-blob-store](https://github.com/maxogden/abstract-blob-store).
|
||||
|
||||
Publishing a test suite as a module lets multiple modules all ensure compatibility since they use the same test suite.
|
||||
|
||||
The API is presented with both Node.js and Go primitives, however, there is not actual limitations for it to be extended for any other language, pushing forward the cross compatibility and interop through diferent stacks.
|
||||
|
||||
## Modules that implement the interface
|
||||
|
||||
- [JavaScript libp2p-mdns](https://github.com/libp2p/js-libp2p-mdns)
|
||||
- [JavaScript libp2p-railing](https://github.com/libp2p/js-libp2p-railing)
|
||||
|
||||
Send a PR to add a new one if you happen to find or write one.
|
||||
|
||||
## Badge
|
||||
|
||||
Include this badge in your readme if you make a new module that uses interface-peer-discovery API.
|
||||
|
||||

|
||||
|
||||
## Usage
|
||||
|
||||
### Node.js
|
||||
|
||||
Install `interface-peer-discovery` as one of the dependencies of your project and as a test file. Then, using `mocha` (for JavaScript) or a test runner with compatible API, do:
|
||||
|
||||
```js
|
||||
const test = require('interface-peer-discovery')
|
||||
|
||||
const common = {
|
||||
setup (cb) {
|
||||
cb(null, yourMuxer)
|
||||
},
|
||||
teardown (cb) {
|
||||
cb()
|
||||
}
|
||||
}
|
||||
|
||||
// use all of the test suits
|
||||
test(common)
|
||||
```
|
||||
|
||||
### Go
|
||||
|
||||
> WIP
|
||||
|
||||
## API
|
||||
|
||||
A valid (read: that follows this abstraction) stream muxer, must implement the following API.
|
||||
|
||||
### `start` the service
|
||||
|
||||
- `JavaScript` discovery.start(callback)
|
||||
- `Go` NA
|
||||
|
||||
### `stop` the service
|
||||
|
||||
- `JavaScript` discovery.stop(callback)
|
||||
- `Go` NA
|
||||
|
||||
### discoverying peers
|
||||
|
||||
- `JavaScript` discovery.on('peer', function (peerInfo) {})
|
||||
- `Go` NA
|
||||
|
12
circle.yml
Normal file
12
circle.yml
Normal file
@ -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
|
BIN
img/badge.png
Normal file
BIN
img/badge.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.0 KiB |
BIN
img/badge.sketch
Normal file
BIN
img/badge.sketch
Normal file
Binary file not shown.
39
img/badge.svg
Normal file
39
img/badge.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 88 KiB |
42
package.json
Normal file
42
package.json
Normal file
@ -0,0 +1,42 @@
|
||||
{
|
||||
"name": "interface-discovery",
|
||||
"version": "0.0.0",
|
||||
"description": "A test suite and interface you can use to implement a discovery interface.",
|
||||
"main": "src/index.js",
|
||||
"scripts": {
|
||||
"lint": "aegir-lint",
|
||||
"build": "aegir-build",
|
||||
"test": "exit 0",
|
||||
"release": "aegir-release",
|
||||
"release-minor": "aegir-release --type minor",
|
||||
"release-major": "aegir-release --type major"
|
||||
},
|
||||
"pre-commit": [
|
||||
"lint",
|
||||
"test"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/libp2p/interface-peer-discovery.git"
|
||||
},
|
||||
"keywords": [
|
||||
"IPFS"
|
||||
],
|
||||
"author": "David Dias <daviddias@ipfs.io>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/libp2p/interface-peer-discovery/issues"
|
||||
},
|
||||
"homepage": "https://github.com/libp2p/interface-peer-discovery",
|
||||
"dependencies": {
|
||||
},
|
||||
"devDependencies": {
|
||||
"aegir": "^9.4.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4.0.0",
|
||||
"npm": ">=3.0.0"
|
||||
},
|
||||
"contributors": [
|
||||
]
|
||||
}
|
1
test/index.js
Normal file
1
test/index.js
Normal file
@ -0,0 +1 @@
|
||||
'use strict'
|
Loading…
x
Reference in New Issue
Block a user