This repository has been archived by the owner on Feb 26, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
misc: merge js-libp2p-websocket-star-rendezvous into server/ (fix #73)
- Loading branch information
Showing
16 changed files
with
1,148 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package-lock.json | ||
yarn.lock | ||
|
||
**/node_modules | ||
**/*.log | ||
test/setup/tmp-disposable-nodes-addrs.json | ||
dist | ||
coverage | ||
.nyc_output | ||
**/*.swp | ||
**/*.bak | ||
examples/sub-module/**/bundle.js | ||
examples/sub-module/**/*-minified.js | ||
examples/sub-module/*-bundle.js | ||
docs |
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,28 @@ | ||
language: node_js | ||
cache: npm | ||
stages: | ||
- check | ||
- test | ||
- cov | ||
|
||
node_js: | ||
- '10' | ||
|
||
os: | ||
- linux | ||
- osx | ||
- windows | ||
|
||
script: npx nyc -s npm run test:node -- --bail | ||
after_success: npx nyc report --reporter=text-lcov > coverage.lcov && npx codecov | ||
|
||
jobs: | ||
include: | ||
- stage: check | ||
script: | ||
- npx aegir commitlint --travis | ||
- npx aegir dep-check -- -i wrtc -i electron-webrtc | ||
- npm run lint | ||
|
||
notifications: | ||
email: false |
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,119 @@ | ||
<a name="0.4.0"></a> | ||
# [0.4.0](https://github.com/libp2p/js-libp2p-websocket-star-rendezvous/compare/v0.3.0...v0.4.0) (2019-07-19) | ||
|
||
|
||
### Features | ||
|
||
* switches to async/await and upgrade hapi to v18 ([946e8a1](https://github.com/libp2p/js-libp2p-websocket-star-rendezvous/commit/946e8a1)) | ||
|
||
|
||
### BREAKING CHANGES | ||
|
||
* All functions that took callbacks now return promises | ||
|
||
|
||
|
||
<a name="0.3.0"></a> | ||
# [0.3.0](https://github.com/libp2p/js-libp2p-websocket-star-rendezvous/compare/v0.2.4...v0.3.0) (2018-11-29) | ||
|
||
|
||
### Bug Fixes | ||
|
||
* dont use 'this' in root anon function ([c6a833e](https://github.com/libp2p/js-libp2p-websocket-star-rendezvous/commit/c6a833e)) | ||
* logo was broken on main page ([#25](https://github.com/libp2p/js-libp2p-websocket-star-rendezvous/issues/25)) ([41eed04](https://github.com/libp2p/js-libp2p-websocket-star-rendezvous/commit/41eed04)) | ||
* regex bug for ipv4 test ([#24](https://github.com/libp2p/js-libp2p-websocket-star-rendezvous/issues/24)) ([696ed92](https://github.com/libp2p/js-libp2p-websocket-star-rendezvous/commit/696ed92)) | ||
* remove warning for too many listeners on socket.io sockets ([#28](https://github.com/libp2p/js-libp2p-websocket-star-rendezvous/issues/28)) ([3d9b96e](https://github.com/libp2p/js-libp2p-websocket-star-rendezvous/commit/3d9b96e)) | ||
|
||
|
||
### Features | ||
|
||
* include existing peers in response to ss-join ([f12aea3](https://github.com/libp2p/js-libp2p-websocket-star-rendezvous/commit/f12aea3)) | ||
* use node 10 in docker image ([#26](https://github.com/libp2p/js-libp2p-websocket-star-rendezvous/issues/26)) ([91db9cf](https://github.com/libp2p/js-libp2p-websocket-star-rendezvous/commit/91db9cf)) | ||
|
||
|
||
|
||
<a name="0.2.4"></a> | ||
## [0.2.4](https://github.com/libp2p/js-libp2p-websocket-star-rendezvous/compare/v0.2.3...v0.2.4) (2018-10-16) | ||
|
||
|
||
### Bug Fixes | ||
|
||
* give crypto.verify a buffer ([#23](https://github.com/libp2p/js-libp2p-websocket-star-rendezvous/issues/23)) ([0c8c290](https://github.com/libp2p/js-libp2p-websocket-star-rendezvous/commit/0c8c290)) | ||
* make it executable available through websocket-star ([d18087c](https://github.com/libp2p/js-libp2p-websocket-star-rendezvous/commit/d18087c)) | ||
|
||
|
||
|
||
<a name="0.2.3"></a> | ||
## [0.2.3](https://github.com/libp2p/js-libp2p-websocket-star-rendezvous/compare/v0.2.2...v0.2.3) (2018-02-12) | ||
|
||
|
||
|
||
<a name="0.2.2"></a> | ||
## [0.2.2](https://github.com/libp2p/js-libp2p-websocket-star-rendezvous/compare/v0.2.1...v0.2.2) (2017-12-07) | ||
|
||
|
||
### Features | ||
|
||
* Add libp2p logo to about page ([66be194](https://github.com/libp2p/js-libp2p-websocket-star-rendezvous/commit/66be194)) | ||
* cryptoChallenge can be enabled by default after all! https://github.com/ipfs/js-ipfs/pull/1090/files\#r153143252 ([143a0a4](https://github.com/libp2p/js-libp2p-websocket-star-rendezvous/commit/143a0a4)) | ||
|
||
|
||
|
||
<a name="0.2.1"></a> | ||
## [0.2.1](https://github.com/libp2p/js-libp2p-websocket-star-rendezvous/compare/v0.2.0...v0.2.1) (2017-11-19) | ||
|
||
|
||
### Bug Fixes | ||
|
||
* Docker cmd - feat: Disable metrics option ([21f95d2](https://github.com/libp2p/js-libp2p-websocket-star-rendezvous/commit/21f95d2)) | ||
* release command ([37e5b1f](https://github.com/libp2p/js-libp2p-websocket-star-rendezvous/commit/37e5b1f)) | ||
|
||
|
||
|
||
<a name="0.2.0"></a> | ||
# [0.2.0](https://github.com/libp2p/js-libp2p-websocket-star-rendezvous/compare/v0.1.2...v0.2.0) (2017-10-28) | ||
|
||
|
||
### Bug Fixes | ||
|
||
* {webrtc => websocket} ([df53c25](https://github.com/libp2p/js-libp2p-websocket-star-rendezvous/commit/df53c25)) | ||
* discovery fix - fix: debug log name ([1f163b8](https://github.com/libp2p/js-libp2p-websocket-star-rendezvous/commit/1f163b8)) | ||
* lint ([585525e](https://github.com/libp2p/js-libp2p-websocket-star-rendezvous/commit/585525e)) | ||
* package.json ([f5e91fe](https://github.com/libp2p/js-libp2p-websocket-star-rendezvous/commit/f5e91fe)) | ||
* small name fix ([de84807](https://github.com/libp2p/js-libp2p-websocket-star-rendezvous/commit/de84807)) | ||
|
||
|
||
### Features | ||
|
||
* Joins metric - fix: config ([81c8eb7](https://github.com/libp2p/js-libp2p-websocket-star-rendezvous/commit/81c8eb7)) | ||
* Link directly to readme in about page ([d7fba03](https://github.com/libp2p/js-libp2p-websocket-star-rendezvous/commit/d7fba03)) | ||
* metrics (WIP) - feat: Dockerfile - fix/feat: various other things ([fa518b1](https://github.com/libp2p/js-libp2p-websocket-star-rendezvous/commit/fa518b1)) | ||
* Update README - feat: Use dumb-init in docker-image ([4fbed33](https://github.com/libp2p/js-libp2p-websocket-star-rendezvous/commit/4fbed33)) | ||
|
||
|
||
|
||
<a name="0.1.2"></a> | ||
## [0.1.2](https://github.com/libp2p/js-libp2p-websocket-star-rendezvous/compare/v0.1.1...v0.1.2) (2017-09-08) | ||
|
||
|
||
### Bug Fixes | ||
|
||
* point to right location of bin ([3049ca8](https://github.com/libp2p/js-libp2p-websocket-star-rendezvous/commit/3049ca8)) | ||
|
||
|
||
|
||
<a name="0.1.1"></a> | ||
## [0.1.1](https://github.com/libp2p/js-libp2p-websocket-star-rendezvous/compare/v0.1.0...v0.1.1) (2017-09-08) | ||
|
||
|
||
### Bug Fixes | ||
|
||
* add main to package.json ([7ff704c](https://github.com/libp2p/js-libp2p-websocket-star-rendezvous/commit/7ff704c)) | ||
|
||
|
||
|
||
<a name="0.1.0"></a> | ||
# 0.1.0 (2017-09-08) | ||
|
||
|
||
|
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,20 @@ | ||
# Deployment | ||
|
||
## IPFS Infra | ||
|
||
We have a [dokku](https://github.com/ipfs/ops-requests/issues/31) setup ready for this to be deployed, to deploy simple do (you have to have permission first): | ||
|
||
```sh | ||
# if you already have added the remote, you don't need to do it again | ||
> git remote add dokku [email protected]:ws-star | ||
> git push dokku master | ||
``` | ||
|
||
More info: https://github.com/libp2p/js-libp2p-webrtc-star/pull/48 | ||
|
||
## Other | ||
|
||
# mkg20001 | ||
The nodes `ws-star-signal-{2,4,h}.servep2p.com` run on `host0.zion.host` | ||
|
||
Upgrades are done by running `bash /home/maciej/upgrade-rendezvous.sh` which runs docker pull and re-creates the containers |
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,7 @@ | ||
FROM node:10 | ||
RUN wget -O /usr/local/bin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64 && chmod +x /usr/local/bin/dumb-init | ||
WORKDIR /usr/src/app | ||
COPY package.json . | ||
RUN npm i --production | ||
COPY . . | ||
ENTRYPOINT ["/usr/local/bin/dumb-init", "node", "--max-old-space-size=8192", "src/bin.js"] |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2017 libp2p | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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 @@ | ||
web: npm run start |
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,108 @@ | ||
# libp2p-websocket-star-rendezvous | ||
|
||
[![](https://img.shields.io/badge/made%20by-mkg20001-blue.svg?style=flat-square)](http://ipn.io) | ||
[![](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/) | ||
[![](https://img.shields.io/badge/freenode-%23libp2p-yellow.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23libp2p) | ||
[![Discourse posts](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg)](https://discuss.libp2p.io) | ||
[![](https://img.shields.io/codecov/c/github/libp2p/js-libp2p-websocket-star-rendezvous.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-websocket-star-rendezvous) | ||
[![](https://img.shields.io/travis/libp2p/js-libp2p-websocket-star-rendezvous.svg?style=flat-square)](https://travis-ci.com/libp2p/js-libp2p-websocket-star-rendezvous) | ||
[![Dependency Status](https://david-dm.org/libp2p/js-libp2p-websocket-star-rendezvous.svg?style=flat-square)](https://david-dm.org/libp2p/js-libp2p-websocket-star-rendezvous) | ||
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard) | ||
|
||
> The rendezvous service for [libp2p-websocket-star](https://github.com/libp2p/js-libp2p-websocket-star). | ||
## Lead Maintainer | ||
|
||
[Jacob Heun](https://github.com/jacobheun) | ||
|
||
## Descriptions | ||
|
||
Nodes using `libp2p-websocket-star` will connect to a known point in the network, a rendezvous point where they can learn about other nodes (Discovery) and route their messages to other nodes (2 hop message routing, also known as relay). | ||
|
||
## Usage | ||
|
||
`libp2p-websocket-star-rendezvous` is the rendezvous server required for `libp2p-websocket-star` and can be used to start a rendezvous server for development. To do that, first install the module globally in your machine with: | ||
|
||
```bash | ||
> npm install --global libp2p-websocket-star-rendezvous | ||
``` | ||
|
||
This will install a `rendezvous` CLI tool. Now you can spawn the server with: | ||
|
||
```bash | ||
> rendezvous --port=9090 --host=127.0.0.1 | ||
``` | ||
|
||
Defaults: | ||
|
||
- `port` - 9090 | ||
- `host` - '0.0.0.0' | ||
|
||
## Docker | ||
|
||
A docker image is offered for running this service in production | ||
|
||
``` | ||
docker pull libp2p/websocket-star-rendezvous:release | ||
docker run -d -p 9090:9090 --name rendezvous libp2p/websocket-star-rendezvous:release | ||
``` | ||
|
||
To disable prometheus metrics run the server with `-e DISABLE_METRICS=1` | ||
|
||
``` | ||
docker run -d -p 9090:9090 --name rendezvous -e DISABLE_METRICS=1 libp2p/websocket-star-rendezvous:release | ||
``` | ||
|
||
## Hosted Rendezvous server | ||
|
||
We host a rendezvous server at `ws-star.discovery.libp2p.io` that can be used for practical demos and experimentation, it **should not be used for apps in production**. | ||
|
||
A libp2p-websocket-star address, using the signalling server we provide, looks like: | ||
|
||
`/dns4/ws-star.discovery.libp2p.io/wss/p2p-websocket-star/ipfs/<your-peer-id>` | ||
|
||
Note: The address above indicates WebSockets Secure, which can be accessed from both http and https. | ||
|
||
|
||
### Using WSS | ||
|
||
To be able to interact with a rendezvous server from an HTTPS site, you will need to use websocket secure. To host a secure websocket server, you must provide a keypair to the server. | ||
|
||
#### Using key and certificate | ||
|
||
```bash | ||
> rendezvous --key="path/to/key.key" --cert="path/to/cert.cert" | ||
``` | ||
|
||
#### Using PFX with passphrase | ||
|
||
```bash | ||
> rendezvous --pfx="path/to/pair.pfx" --passphrase="passphrase" | ||
``` | ||
|
||
|
||
### This module uses `pull-streams` | ||
|
||
We expose a streaming interface based on `pull-streams`, rather then on the Node.js core streams implementation (aka Node.js streams). `pull-streams` offers us a better mechanism for error handling and flow control guarantees. If you would like to know more about why we did this, see the discussion at this [issue](https://github.com/ipfs/js-ipfs/issues/362). | ||
|
||
You can learn more about pull-streams at: | ||
|
||
- [The history of Node.js streams, nodebp April 2014](https://www.youtube.com/watch?v=g5ewQEuXjsQ) | ||
- [The history of streams, 2016](http://dominictarr.com/post/145135293917/history-of-streams) | ||
- [pull-streams, the simple streaming primitive](http://dominictarr.com/post/149248845122/pull-streams-pull-streams-are-a-very-simple) | ||
- [pull-streams documentation](https://pull-stream.github.io/) | ||
|
||
#### Converting `pull-streams` to Node.js Streams | ||
|
||
If you are a Node.js streams user, you can convert a pull-stream to a Node.js stream using the module [`pull-stream-to-stream`](https://github.com/pull-stream/pull-stream-to-stream), giving you an instance of a Node.js stream that is linked to the pull-stream. For example: | ||
|
||
```js | ||
const pullToStream = require('pull-stream-to-stream') | ||
|
||
const nodeStreamInstance = pullToStream(pullStreamInstance) | ||
// nodeStreamInstance is an instance of a Node.js Stream | ||
``` | ||
|
||
To learn more about this utility, visit https://pull-stream.github.io/#pull-stream-to-stream. | ||
|
||
LICENSE MIT |
Oops, something went wrong.