Skip to content
This repository was archived by the owner on Apr 24, 2023. It is now read-only.
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: libp2p/js-libp2p-webrtc-star
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 2d0847c62c927579360643d42adf5ff4eb9c1631
Choose a base ref
...
head repository: libp2p/js-libp2p-webrtc-star
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 90e69aebf6dcebfabc509f063ae3c8023e5876c0
Choose a head ref
  • 11 commits
  • 27 files changed
  • 3 contributors

Commits on Mar 15, 2019

  1. Copy the full SHA
    bedea1b View commit details

Commits on Apr 12, 2019

  1. Copy the full SHA
    0fd71ad View commit details

Commits on May 8, 2019

  1. fix: update hapi (#173)

    BREAKING CHANGE: signaling server api with async await instead of callbacks
    vasco-santos authored May 8, 2019
    Copy the full SHA
    f7dc83a View commit details
  2. Copy the full SHA
    40041f8 View commit details
  3. Copy the full SHA
    6187da5 View commit details

Commits on May 12, 2019

  1. Copy the full SHA
    f4dc087 View commit details
  2. Copy the full SHA
    b8b67a9 View commit details
  3. Copy the full SHA
    983f464 View commit details

Commits on Oct 2, 2019

  1. refactor: switch to async iterators (#183)

    BREAKING CHANGE: Switch to using async/await and async iterators. The transport and connection interfaces have changed.
    vasco-santos authored Oct 2, 2019
    Copy the full SHA
    db5c97e View commit details
  2. Copy the full SHA
    922bdc8 View commit details
  3. Copy the full SHA
    90e69ae View commit details
20 changes: 10 additions & 10 deletions .aegir.js
Original file line number Diff line number Diff line change
@@ -4,26 +4,26 @@ const sigServer = require('./src/sig-server')
let firstRun = true
let sigS

function boot (done) {
async function boot (done) {
const options = {
port: 15555,
host: '127.0.0.1',
metrics: firstRun
metrics: false // firsrun TODO: needs https://github.com/libp2p/js-libp2p-webrtc-star/issues/174
}

if (firstRun) { firstRun = false }

sigServer.start(options, (err, server) => {
if (err) { throw err }
sigS = await sigServer.start(options)

sigS = server
console.log('signalling on:', server.info.uri)
done()
})
console.log('signalling on:', sigS.info.uri)

done()
}

function stop (done) {
sigS.stop(done)
async function stop (done) {
await sigS.stop()

done()
}

module.exports = {
41 changes: 41 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
language: node_js
cache: npm
stages:
- check
- test
- cov

node_js:
- '10'
- '12'

os:
- linux
- osx

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 dep-check -- -i wrtc -i electron-webrtc
- npm run lint

- stage: test
name: chrome
addons:
chrome: stable
script:
- npx aegir test -t browser

- stage: test
name: firefox
addons:
firefox: latest
script:
- npx aegir test -t browser -- --browsers FirefoxHeadless

notifications:
email: false
40 changes: 40 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,43 @@
<a name="0.17.0"></a>
# [0.17.0](https://github.com/libp2p/js-libp2p-webrtc-star/compare/v0.16.1...v0.17.0) (2019-10-02)


### Code Refactoring

* switch to async iterators ([#183](https://github.com/libp2p/js-libp2p-webrtc-star/issues/183)) ([db5c97e](https://github.com/libp2p/js-libp2p-webrtc-star/commit/db5c97e))


### BREAKING CHANGES

* Switch to using async/await and async iterators. The transport and connection interfaces have changed.



<a name="0.16.1"></a>
## [0.16.1](https://github.com/libp2p/js-libp2p-webrtc-star/compare/v0.16.0...v0.16.1) (2019-05-12)


### Features

* start/stop discovery events when start/stop called ([#176](https://github.com/libp2p/js-libp2p-webrtc-star/issues/176)) ([f4dc087](https://github.com/libp2p/js-libp2p-webrtc-star/commit/f4dc087))



<a name="0.16.0"></a>
# [0.16.0](https://github.com/libp2p/js-libp2p-webrtc-star/compare/v0.15.8...v0.16.0) (2019-05-08)


### Bug Fixes

* update hapi ([#173](https://github.com/libp2p/js-libp2p-webrtc-star/issues/173)) ([f7dc83a](https://github.com/libp2p/js-libp2p-webrtc-star/commit/f7dc83a))


### BREAKING CHANGES

* signaling server api with async await instead of callbacks



<a name="0.15.8"></a>
## [0.15.8](https://github.com/libp2p/js-libp2p-webrtc-star/compare/v0.15.7...v0.15.8) (2019-01-10)

45 changes: 35 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
# js-libp2p-webrtc-star

[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)
[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)
[![Travis](https://travis-ci.org/libp2p/js-libp2p-webrtc-star.svg?style=flat-square)](https://travis-ci.org/libp2p/js-libp2p-webrtc-star)
[![Circle](https://circleci.com/gh/libp2p/js-libp2p-webrtc-star.svg?style=svg)](https://circleci.com/gh/libp2p/js-libp2p-webrtc-star)
[![Coverage](https://coveralls.io/repos/github/libp2p/js-libp2p-webrtc-star/badge.svg?branch=master)](https://coveralls.io/github/libp2p/js-libp2p-webrtc-star?branch=master)
[![david-dm](https://david-dm.org/libp2p/js-libp2p-webrtc-star.svg?style=flat-square)](https://david-dm.org/libp2p/js-libp2p-webrtc-star)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)
![](https://img.shields.io/badge/npm-%3E%3D3.0.0-orange.svg?style=flat-square)
![](https://img.shields.io/badge/Node.js-%3E%3D6.0.0-orange.svg?style=flat-square)
[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)
[![](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-webrtc-star.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-webrtc-star)
[![](https://img.shields.io/travis/libp2p/js-libp2p-webrtc-star.svg?style=flat-square)](https://travis-ci.com/libp2p/js-libp2p-webrtc-star)
[![Dependency Status](https://david-dm.org/libp2p/js-libp2p-webrtc-star.svg?style=flat-square)](https://david-dm.org/libp2p/js-libp2p-webrtc-star) [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)

[![](https://raw.githubusercontent.com/libp2p/interface-transport/master/img/badge.png)](https://github.com/libp2p/interface-transport)
[![](https://raw.githubusercontent.com/libp2p/interface-connection/master/img/badge.png)](https://github.com/libp2p/interface-connection)
@@ -56,8 +54,35 @@ const ws2 = new WStar({ wrtc: electronWebRTC() })

```JavaScript
const WStar = require('libp2p-webrtc-star')
const multiaddr = require('multiaddr')
const pipe = require('it-pipe')
const { collect } = require('streaming-iterables')

const ws = new WStar()
const addr = multiaddr('/ip4/188.166.203.82/tcp/20000/wss/p2p-webrtc-star/ipfs/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSooo2a')

const ws = new WStar({ upgrader })

const listener = ws.createListener((socket) => {
console.log('new connection opened')
pipe(
['hello'],
socket
)
})

await listener.listen(addr)
console.log('listening')

const socket = await ws.dial(addr)
const values = await pipe(
socket,
collect
)

console.log(`Value: ${values.toString()}`)

// Close connection after reading
await listener.close()
```

## API
2 changes: 0 additions & 2 deletions ci/Jenkinsfile

This file was deleted.

50 changes: 27 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "libp2p-webrtc-star",
"version": "0.15.8",
"version": "0.17.0",
"description": "libp2p WebRTC transport that includes a discovery mechanism provided by the signalling-star",
"leadMaintainer": "Vasco Santos <vasco.santos@moxy.studio>",
"main": "src/index.js",
@@ -25,12 +25,11 @@
"coverage-publish": "aegir coverage --provider coveralls"
},
"pre-push": [
"lint",
"test"
"lint"
],
"engines": {
"node": ">=6.0.0",
"npm": ">=3.0.0"
"node": ">=10.0.0",
"npm": ">=6.0.0"
},
"repository": {
"type": "git",
@@ -46,32 +45,36 @@
},
"homepage": "https://github.com/libp2p/js-libp2p-webrtc-star#readme",
"devDependencies": {
"aegir": "^18.0.3",
"aegir": "^20.3.1",
"chai": "^4.2.0",
"dirty-chai": "^2.0.1",
"electron-webrtc": "~0.3.0",
"prom-client": "^11.2.0",
"wrtc": "~0.1.6"
"interface-discovery": "~0.1.1",
"interface-transport": "libp2p/interface-transport#chore/skip-abort-while-reading-for-webrtc",
"prom-client": "^11.5.3",
"wrtc": "~0.4.2"
},
"dependencies": {
"async": "^2.6.1",
"@hapi/hapi": "^18.4.0",
"@hapi/inert": "^5.2.2",
"abortable-iterator": "^2.1.0",
"class-is": "^1.1.0",
"debug": "^4.1.0",
"debug": "^4.1.1",
"epimetheus": "^1.0.92",
"hapi": "^16.6.2",
"inert": "^4.2.1",
"interface-connection": "~0.3.2",
"mafmt": "^6.0.4",
"err-code": "^2.0.0",
"it-pipe": "^1.0.1",
"libp2p-utils": "^0.1.0",
"mafmt": "^7.0.0",
"minimist": "^1.2.0",
"multiaddr": "^6.0.3",
"once": "^1.4.0",
"peer-id": "~0.12.2",
"peer-info": "~0.15.1",
"pull-stream": "^3.6.9",
"simple-peer": "^9.1.2",
"socket.io": "^2.1.1",
"socket.io-client": "^2.1.1",
"stream-to-pull-stream": "^1.7.2",
"multiaddr": "^7.1.0",
"p-defer": "^3.0.0",
"peer-id": "~0.13.2",
"peer-info": "~0.17.0",
"simple-peer": "^9.6.0",
"socket.io": "^2.3.0",
"socket.io-client": "^2.3.0",
"stream-to-it": "^0.1.1",
"streaming-iterables": "^4.1.0",
"webrtcsupport": "github:ipfs/webrtcsupport"
},
"contributors": [
@@ -96,6 +99,7 @@
"greenkeeper[bot] <greenkeeper[bot]@users.noreply.github.com>",
"greenkeeperio-bot <support@greenkeeper.io>",
"interfect <interfect@gmail.com>",
"kumavis <kumavis@users.noreply.github.com>",
"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ <victorbjelkholm@gmail.com>"
]
}
8 changes: 8 additions & 0 deletions src/constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
'use strict'

// p2p multi-address code
exports.CODE_P2P = 421
exports.CODE_CIRCUIT = 290

// Time to wait for a connection to close gracefully before destroying it manually
exports.CLOSE_TIMEOUT = 2000
Loading