mirror of
https://github.com/fluencelabs/js-libp2p-tcp
synced 2025-04-25 23:42:32 +00:00
chore: remove unneeded deps
License: MIT Signed-off-by: Jacob Heun <jacobheun@gmail.com>
This commit is contained in:
parent
eedc264a9a
commit
ea762d12ee
@ -4,6 +4,10 @@
|
|||||||
"description": "Node.js implementation of the TCP module that libp2p uses, which implements the interface-connection and interface-transport interfaces",
|
"description": "Node.js implementation of the TCP module that libp2p uses, which implements the interface-connection and interface-transport interfaces",
|
||||||
"leadMaintainer": "Jacob Heun <jacobheun@gmail.com>",
|
"leadMaintainer": "Jacob Heun <jacobheun@gmail.com>",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
|
"files": [
|
||||||
|
"dist",
|
||||||
|
"src"
|
||||||
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lint": "aegir lint",
|
"lint": "aegir lint",
|
||||||
"test": "aegir test -t node -f test/**/*.js",
|
"test": "aegir test -t node -f test/**/*.js",
|
||||||
@ -45,8 +49,6 @@
|
|||||||
"debug": "^4.1.1",
|
"debug": "^4.1.1",
|
||||||
"interface-connection": "~0.3.3",
|
"interface-connection": "~0.3.3",
|
||||||
"ip-address": "^5.8.9",
|
"ip-address": "^5.8.9",
|
||||||
"lodash.includes": "^4.3.0",
|
|
||||||
"lodash.isfunction": "^3.0.9",
|
|
||||||
"mafmt": "^6.0.6",
|
"mafmt": "^6.0.6",
|
||||||
"multiaddr": "^6.0.5",
|
"multiaddr": "^6.0.5",
|
||||||
"once": "^1.4.0",
|
"once": "^1.4.0",
|
||||||
|
10
src/index.js
10
src/index.js
@ -4,8 +4,6 @@ const net = require('net')
|
|||||||
const toPull = require('stream-to-pull-stream')
|
const toPull = require('stream-to-pull-stream')
|
||||||
const mafmt = require('mafmt')
|
const mafmt = require('mafmt')
|
||||||
const withIs = require('class-is')
|
const withIs = require('class-is')
|
||||||
const includes = require('lodash.includes')
|
|
||||||
const isFunction = require('lodash.isfunction')
|
|
||||||
const Connection = require('interface-connection').Connection
|
const Connection = require('interface-connection').Connection
|
||||||
const once = require('once')
|
const once = require('once')
|
||||||
const debug = require('debug')
|
const debug = require('debug')
|
||||||
@ -17,7 +15,7 @@ function noop () {}
|
|||||||
|
|
||||||
class TCP {
|
class TCP {
|
||||||
dial (ma, options, callback) {
|
dial (ma, options, callback) {
|
||||||
if (isFunction(options)) {
|
if (typeof options === 'function') {
|
||||||
callback = options
|
callback = options
|
||||||
options = {}
|
options = {}
|
||||||
}
|
}
|
||||||
@ -53,7 +51,7 @@ class TCP {
|
|||||||
}
|
}
|
||||||
|
|
||||||
createListener (options, handler) {
|
createListener (options, handler) {
|
||||||
if (isFunction(options)) {
|
if (typeof options === 'function') {
|
||||||
handler = options
|
handler = options
|
||||||
options = {}
|
options = {}
|
||||||
}
|
}
|
||||||
@ -69,11 +67,11 @@ class TCP {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return multiaddrs.filter((ma) => {
|
return multiaddrs.filter((ma) => {
|
||||||
if (includes(ma.protoNames(), 'p2p-circuit')) {
|
if (ma.protoNames().includes('p2p-circuit')) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (includes(ma.protoNames(), 'ipfs')) {
|
if (ma.protoNames().includes('ipfs')) {
|
||||||
ma = ma.decapsulate('ipfs')
|
ma = ma.decapsulate('ipfs')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
const multiaddr = require('multiaddr')
|
const multiaddr = require('multiaddr')
|
||||||
const Connection = require('interface-connection').Connection
|
const Connection = require('interface-connection').Connection
|
||||||
const os = require('os')
|
const os = require('os')
|
||||||
const includes = require('lodash.includes')
|
|
||||||
const net = require('net')
|
const net = require('net')
|
||||||
const toPull = require('stream-to-pull-stream')
|
const toPull = require('stream-to-pull-stream')
|
||||||
const EventEmitter = require('events').EventEmitter
|
const EventEmitter = require('events').EventEmitter
|
||||||
@ -84,7 +83,7 @@ module.exports = (handler) => {
|
|||||||
|
|
||||||
listener.listen = (ma, callback) => {
|
listener.listen = (ma, callback) => {
|
||||||
listeningAddr = ma
|
listeningAddr = ma
|
||||||
if (includes(ma.protoNames(), 'ipfs')) {
|
if (ma.protoNames().includes('ipfs')) {
|
||||||
ipfsId = getIpfsId(ma)
|
ipfsId = getIpfsId(ma)
|
||||||
listeningAddr = ma.decapsulate('ipfs')
|
listeningAddr = ma.decapsulate('ipfs')
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user