diff --git a/.aegir.js b/.aegir.js deleted file mode 100644 index 53573e0b..00000000 --- a/.aegir.js +++ /dev/null @@ -1,34 +0,0 @@ -'use strict' - -const sigServer = require('./src/sig-server') -let firstRun = true -let sigS - -function boot (done) { - const options = { - port: 15555, - host: '127.0.0.1', - metrics: firstRun - } - - if (firstRun) { firstRun = false } - - sigServer.start(options, (err, server) => { - if (err) { throw err } - - sigS = server - console.log('signalling on:', server.info.uri) - done() - }) -} - -function stop (done) { - sigS.stop(done) -} - -module.exports = { - hooks: { - pre: boot, - post: stop - } -} diff --git a/DEPLOYMENT.md b/DEPLOYMENT.md deleted file mode 100644 index 86328b68..00000000 --- a/DEPLOYMENT.md +++ /dev/null @@ -1,11 +0,0 @@ -# Deployment - -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 dokku@cloud.ipfs.team:star-signal -> git push dokku master -``` - -More info: https://github.com/libp2p/js-libp2p-webrtc-star/pull/48 diff --git a/Procfile b/Procfile deleted file mode 100644 index 26e9df8b..00000000 --- a/Procfile +++ /dev/null @@ -1 +0,0 @@ -web: npm run star-signal diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 046bf910..00000000 --- a/appveyor.yml +++ /dev/null @@ -1,29 +0,0 @@ -# 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. -version: "{build}" - -environment: - matrix: - - nodejs_version: "6" - - nodejs_version: "8" - -matrix: - fast_finish: true - -install: - # Install Node.js - - ps: Install-Product node $env:nodejs_version - - # Upgrade npm - - npm install -g npm - - # Output our current versions for debugging - - node --version - - npm --version - - # Install our package dependencies - - npm install - -test_script: - - npm run test:node - -build: off diff --git a/circle.yml b/circle.yml deleted file mode 100644 index 00096937..00000000 --- a/circle.yml +++ /dev/null @@ -1,15 +0,0 @@ -# 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. -machine: - node: - version: stable - -dependencies: - pre: - - google-chrome --version - - curl -L -o google-chrome.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb - - sudo dpkg -i google-chrome.deb || true - - sudo apt-get update - - sudo apt-get install -f - - sudo apt-get install --only-upgrade lsb-base - - sudo dpkg -i google-chrome.deb - - google-chrome --version diff --git a/package.json b/package.json index 9683a183..4f9df259 100644 --- a/package.json +++ b/package.json @@ -3,13 +3,7 @@ "version": "0.15.1", "description": "libp2p WebRTC transport that includes a discovery mechanism provided by the signalling-star", "main": "src/index.js", - "bin": { - "webrtc-star": "src/sig-server/bin.js", - "star-sig": "src/sig-server/bin.js", - "star-signal": "src/sig-server/bin.js" - }, "scripts": { - "star-signal": "node src/sig-server/bin.js", "lint": "aegir lint", "build": "aegir build", "test": "aegir test -t node -t browser", @@ -60,21 +54,14 @@ "class-is": "^1.1.0", "debug": "^3.1.0", "detect-node": "^2.0.3", - "epimetheus": "^1.0.55", - "hapi": "^16.6.2", - "inert": "^4.2.1", "interface-connection": "~0.3.2", "mafmt": "^6.0.0", "minimist": "^1.2.0", "multiaddr": "^5.0.0", "once": "^1.4.0", "peer-id": "~0.10.7", - "peer-info": "~0.14.1", "pull-stream": "^3.6.8", "simple-peer": "^9.1.2", - "socket.io": "^2.1.1", - "socket.io-client": "^2.1.1", - "stream-to-pull-stream": "^1.7.2", "webrtcsupport": "github:ipfs/webrtcsupport" }, "contributors": [ diff --git a/src/index.js b/src/index.js index edb6aff8..025be3ce 100644 --- a/src/index.js +++ b/src/index.js @@ -21,6 +21,25 @@ const setImmediate = require('async/setImmediate') const once = require('once') const noop = once(() => {}) +function cleanMultiaddr (maStr) { + const legacy = '/libp2p-webrtc-star' + + if (maStr.indexOf(legacy) !== -1) { + maStr = maStr.substring(legacy.length, maStr.length) + let ma = multiaddr(maStr) + const tuppleIPFS = ma.stringTuples().filter((tupple) => { + return tupple[0] === 421 // ipfs code + })[0] + + ma = ma.decapsulate('ipfs') + ma = ma.encapsulate('/p2p-webrtc-star') + ma = ma.encapsulate(`/ipfs/${tuppleIPFS[1]}`) + maStr = ma.toString() + } + + return maStr +} + class WebRTCStar { constructor (options) { options = options || {} @@ -39,9 +58,11 @@ class WebRTCStar { options = {} } + ma = cleanMultiaddr(String(ma)) + callback = callback ? once(callback) : noop - let b58 = ma.toString().split('ipfs/').pop() + let b58 = ma.split('ipfs/').pop() log('dialing %s %s', ma, b58)