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

Commit

Permalink
Merge 574ce3b into 4694f9d
Browse files Browse the repository at this point in the history
  • Loading branch information
dryajov committed Apr 2, 2017
2 parents 4694f9d + 574ce3b commit 623ee72
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
},
"dependencies": {
"interface-connection": "~0.3.2",
"interface-transport": "^0.3.4",
"ip-address": "^5.8.6",
"lodash.includes": "^4.3.0",
"lodash.isfunction": "^3.0.8",
Expand All @@ -61,4 +62,4 @@
"Richard Littauer <richard.littauer@gmail.com>",
"Stephen Whitmore <stephen.whitmore@gmail.com>"
]
}
}
12 changes: 11 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ const log = debug('libp2p:tcp:dial')
const createListener = require('./listener')

module.exports = class TCP {
get priority () {
return 1 // TODO: move to a constants file that all transports can share
}

set priority (val) {
throw new Error('Priority is read only!')
}

dial (ma, options, cb) {
if (isFunction(options)) {
cb = options
Expand Down Expand Up @@ -67,7 +75,9 @@ module.exports = class TCP {
multiaddrs = [multiaddrs]
}
return multiaddrs.filter((ma) => {
if (includes(ma.protoNames(), 'ipfs')) {
if (includes(ma.protoNames(), 'p2p-circuit')) {
return false
} else if (includes(ma.protoNames(), 'ipfs')) {
ma = ma.decapsulate('ipfs')
}
return mafmt.TCP.matches(ma)
Expand Down

0 comments on commit 623ee72

Please sign in to comment.