Skip to content

Commit a68dc87

Browse files
committed
feat: initial implementation
1 parent e5502e9 commit a68dc87

14 files changed

+1038
-1
lines changed

.gitignore

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
docs
2+
**/node_modules/
3+
**/*.log
4+
test/repo-tests*
5+
6+
# Logs
7+
logs
8+
*.log
9+
10+
coverage
11+
12+
# Runtime data
13+
pids
14+
*.pid
15+
*.seed
16+
17+
# Directory for instrumented libs generated by jscoverage/JSCover
18+
lib-cov
19+
20+
# Coverage directory used by tools like istanbul
21+
coverage
22+
23+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
24+
.grunt
25+
26+
# node-waf configuration
27+
.lock-wscript
28+
29+
build
30+
31+
# Dependency directory
32+
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
33+
node_modules
34+
35+
dist
36+
37+
docs
38+
39+
package-lock.json
40+
yarn.lock

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2019 Protocol Labs, Inc.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,73 @@
1-
# js-libp2p-pubsub
1+
js-libp2p-pubsub
2+
==================
3+
4+
[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)
5+
[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://libp2p.io/)
6+
[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)
7+
[![Coverage Status](https://coveralls.io/repos/github/libp2p/js-libp2p-pubsub/badge.svg?branch=master)](https://coveralls.io/github/libp2p/js-libp2p-pubsub?branch=master)
8+
[![Travis CI](https://travis-ci.org/libp2p/js-libp2p-pubsub.svg?branch=master)](https://travis-ci.org/libp2p/js-libp2p-pubsub)
9+
[![Circle CI](https://circleci.com/gh/libp2p/js-libp2p-pubsub.svg?style=svg)](https://circleci.com/gh/libp2p/js-libp2p-pubsub)
10+
[![Dependency Status](https://david-dm.org/libp2p/js-libp2p-pubsub.svg?style=flat-square)](https://david-dm.org/libp2p/js-libp2p-pubsub) [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)
11+
[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)
12+
[![](https://img.shields.io/badge/pm-waffle-yellow.svg?style=flat-square)](https://waffle.io/libp2p/js-libp2p-pubsub)
13+
14+
> libp2p-pubsub consits on the base protocol for libp2p pubsub implementation. This module is responsible for all the logic regarding peer connections.
15+
16+
## Lead Maintainer
17+
18+
[Vasco Santos](https://github.com/vasco-santos).
19+
20+
## Table of Contents
21+
22+
- [Install](#install)
23+
- [Usage](#usage)
24+
- [Contribute](#contribute)
25+
- [License](#license)
26+
27+
## Install
28+
29+
```sh
30+
> npm install libp2p-pubsub
31+
```
32+
33+
## Usage
34+
35+
Create your pubsub implementation extending the base protocol.
36+
37+
```JavaScript
38+
const Pubsub = require('libp2p-pubsub')
39+
40+
class PubsubImplementation extends Pubsub {
41+
constructor(libp2p) {
42+
super('libp2p:pubsub', '/pubsub-implementation/1.0.0', libp2p)
43+
}
44+
45+
_processConnection(idB58Str, conn, peer) {
46+
// Process each message accordingly
47+
}
48+
49+
publish() {
50+
51+
}
52+
53+
subscribe() {
54+
55+
}
56+
57+
unsubscribe() {
58+
59+
}
60+
}
61+
```
62+
63+
## Contribute
64+
65+
Feel free to join in. All welcome. Open an [issue](https://github.com/libp2p/js-libp2p-pubsub/issues)!
66+
67+
This repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).
68+
69+
[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md)
70+
71+
## License
72+
73+
Copyright (c) Protocol Labs, Inc. under the **MIT License**. See [LICENSE file](./LICENSE) for details.

ci/Jenkinsfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// 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.
2+
javascript()

package.json

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{
2+
"name": "libp2p-pubsub",
3+
"version": "0.0.0",
4+
"description": "Pubsub base protocol for libp2p pubsub routers",
5+
"leadMaintainer": "Vasco Santos <[email protected]>",
6+
"main": "src/index.js",
7+
"scripts": {
8+
"lint": "aegir lint",
9+
"test": "aegir test -t node",
10+
"test:node": "aegir test -t node",
11+
"build": "aegir build",
12+
"docs": "aegir-docs",
13+
"release": "aegir release --docs",
14+
"release-minor": "aegir release --type minor --docs",
15+
"release-major": "aegir release --type major --docs",
16+
"coverage": "aegir coverage",
17+
"coverage-publish": "aegir coverage --provider coveralls"
18+
},
19+
"files": [
20+
"src",
21+
"dist"
22+
],
23+
"pre-push": [
24+
"lint"
25+
],
26+
"repository": {
27+
"type": "git",
28+
"url": "git+https://github.com/libp2p/js-libp2p-pubsub.git"
29+
},
30+
"keywords": [
31+
"IPFS",
32+
"libp2p",
33+
"pubsub",
34+
"gossip",
35+
"flood",
36+
"flooding"
37+
],
38+
"license": "MIT",
39+
"bugs": {
40+
"url": "https://github.com/libp2p/js-libp2p-pubsub/issues"
41+
},
42+
"homepage": "https://github.com/libp2p/js-libp2p-pubsub#readme",
43+
"devDependencies": {
44+
"aegir": "^18.0.3",
45+
"benchmark": "^2.1.4",
46+
"chai": "^4.2.0",
47+
"chai-spies": "^1.0.0",
48+
"dirty-chai": "^2.0.1",
49+
"libp2p": "~0.24.4",
50+
"libp2p-secio": "~0.11.0",
51+
"libp2p-spdy": "~0.13.1",
52+
"libp2p-tcp": "~0.13.0",
53+
"lodash": "^4.17.11",
54+
"peer-id": "~0.12.2",
55+
"peer-info": "~0.15.1"
56+
},
57+
"dependencies": {
58+
"async": "^2.6.1",
59+
"debug": "^4.1.1",
60+
"length-prefixed-stream": "^1.6.0",
61+
"protons": "^1.0.1",
62+
"pull-pushable": "^2.2.0"
63+
},
64+
"contributors": []
65+
}

0 commit comments

Comments
 (0)