Socket
Socket
Sign inDemoInstall

libp2p-tcp

Package Overview
Dependencies
11
Maintainers
1
Versions
57
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.2.0 to 0.2.1

2

package.json
{
"name": "libp2p-tcp",
"version": "0.2.0",
"version": "0.2.1",
"description": "Node.js implementation of the TCP module that libp2p uses, which implements the interface-connection and interface-transport interfaces",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -1,4 +0,5 @@

const debug = require('debug')
const log = debug('libp2p:tcp')
// const debug = require('debug')
// const log = debug('libp2p:tcp')
const tcp = require('net')
const multiaddr = require('multiaddr')

@@ -34,2 +35,3 @@ exports = module.exports = TCP

var count = 0
const freshMultiaddrs = []

@@ -39,5 +41,15 @@ multiaddrs.forEach((m) => {

listener.listen(m.toOptions(), () => {
log('listening on: ', m.toString())
// Node.js likes to convert addr to IPv6 (when 0.0.0.0 for e.g)
const address = listener.address()
if (m.toString().indexOf('ip4')) {
m = m.decapsulate('tcp')
m = m.encapsulate('/tcp/' + address.port)
freshMultiaddrs.push(m)
}
if (address.family === 'IPv6') {
freshMultiaddrs.push(multiaddr('/ip6/' + address.address + '/tcp/' + address.port))
}
if (++count === multiaddrs.length) {
callback()
callback(null, freshMultiaddrs)
}

@@ -44,0 +56,0 @@ })

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc