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

Commit

Permalink
misc: Remove signal-server leftovers
Browse files Browse the repository at this point in the history
  • Loading branch information
mkg20001 committed Jun 15, 2018
1 parent 2745279 commit 775c2a3
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 104 deletions.
34 changes: 0 additions & 34 deletions .aegir.js

This file was deleted.

11 changes: 0 additions & 11 deletions DEPLOYMENT.md

This file was deleted.

1 change: 0 additions & 1 deletion Procfile

This file was deleted.

29 changes: 0 additions & 29 deletions appveyor.yml

This file was deleted.

15 changes: 0 additions & 15 deletions circle.yml

This file was deleted.

13 changes: 0 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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": [
Expand Down
23 changes: 22 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 || {}
Expand All @@ -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)

Expand Down

0 comments on commit 775c2a3

Please sign in to comment.