Socket
Socket
Sign inDemoInstall

libp2p-tcp

Package Overview
Dependencies
36
Maintainers
4
Versions
57
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.15.3 to 0.15.4

.github/workflows/main.yml

9

CHANGELOG.md

@@ -0,1 +1,10 @@

## [0.15.4](https://github.com/libp2p/js-libp2p-tcp/compare/v0.15.2...v0.15.4) (2021-04-12)
### Bug Fixes
* hanging close promise ([#140](https://github.com/libp2p/js-libp2p-tcp/issues/140)) ([3813100](https://github.com/libp2p/js-libp2p-tcp/commit/381310043852a9213f1abb62f5f0a7046d806286))
<a name="0.15.3"></a>

@@ -2,0 +11,0 @@ ## [0.15.3](https://github.com/libp2p/js-libp2p-tcp/compare/v0.15.2...v0.15.3) (2021-02-03)

30

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

@@ -24,3 +24,9 @@ "leadMaintainer": "Jacob Heun <jacobheun@gmail.com>",

"keywords": [
"IPFS"
"libp2p",
"network",
"p2p",
"peer",
"peer-to-peer",
"IPFS",
"TCP"
],

@@ -33,10 +39,9 @@ "license": "MIT",

"engines": {
"node": ">=6.0.0",
"npm": ">=3.0.0"
"node": ">=14.0.0"
},
"devDependencies": {
"aegir": "^25.0.0",
"aegir": "^33.0.0",
"it-pipe": "^1.1.0",
"libp2p-interfaces": "^0.4.0",
"sinon": "^9.0.0",
"libp2p-interfaces": "^0.9.0",
"sinon": "^10.0.1",
"streaming-iterables": "^5.0.2"

@@ -47,7 +52,7 @@ },

"class-is": "^1.1.0",
"debug": "^4.1.1",
"err-code": "^2.0.0",
"libp2p-utils": "^0.2.0",
"mafmt": "^8.0.0",
"multiaddr": "^8.0.0",
"debug": "^4.3.1",
"err-code": "^3.0.1",
"libp2p-utils": "^0.3.0",
"mafmt": "^9.0.0",
"multiaddr": "^9.0.1",
"stream-to-it": "^0.2.2"

@@ -67,2 +72,3 @@ },

"Prashanth Chandra <coolshanth94@gmail.com>",
"Ryan Mehta <ryan.mehta@gmail.com>",
"João Antunes <j.goncalo.antunes@gmail.com>",

@@ -69,0 +75,0 @@ "Cayman <caymannava@gmail.com>",

11

README.md

@@ -12,7 +12,7 @@ # js-libp2p-tcp

[![](https://raw.githubusercontent.com/libp2p/interface-transport/master/img/badge.png)](https://github.com/libp2p/interface-transport)
[![](https://raw.githubusercontent.com/libp2p/interface-connection/master/img/badge.png)](https://github.com/libp2p/interface-connection)
[![](https://raw.githubusercontent.com/libp2p/js-libp2p-interfaces/master/src/transport/img/badge.png)](https://github.com/libp2p/js-libp2p-interfaces/tree/master/src/transport)
[![](https://raw.githubusercontent.com/libp2p/js-libp2p-interfaces/master/src/connection/img/badge.png)](https://github.com/libp2p/js-libp2p-interfaces/tree/master/src/connection)
> JavaScript implementation of the TCP module for libp2p. It exposes the [interface-transport](https://github.com/libp2p/interface-connection) for dial/listen. `libp2p-tcp` is a very thin shim that adds support for dialing to a `multiaddr`. This small shim will enable libp2p to use other transports.
> JavaScript implementation of the TCP module for libp2p. It exposes the [interface-transport](https://github.com/libp2p/js-libp2p-interfaces/tree/master/src/transport) for dial/listen. `libp2p-tcp` is a very thin shim that adds support for dialing to a `multiaddr`. This small shim will enable libp2p to use other transports.

@@ -91,3 +91,3 @@ ## Lead Maintainer

[![](https://raw.githubusercontent.com/libp2p/interface-transport/master/img/badge.png)](https://github.com/libp2p/interface-transport)
[![](https://raw.githubusercontent.com/libp2p/js-libp2p-interfaces/master/src/transport/img/badge.png)](https://github.com/libp2p/js-libp2p-interfaces/tree/master/src/transport)

@@ -103,4 +103,5 @@ `libp2p-tcp` accepts TCP addresses as both IPFS and non IPFS encapsulated addresses, i.e:

[![](https://raw.githubusercontent.com/libp2p/interface-connection/master/img/badge.png)](https://github.com/libp2p/interface-connection)
[![](https://raw.githubusercontent.com/libp2p/js-libp2p-interfaces/master/src/connection/img/badge.png)](https://github.com/libp2p/js-libp2p-interfaces/tree/master/src/connection)
## Contribute

@@ -107,0 +108,0 @@

@@ -15,7 +15,9 @@ 'use strict'

/**
* @class TCP
* @typedef {import('multiaddr').Multiaddr} Multiaddr
* @typedef {import('libp2p-interfaces/src/connection').Connection} Connection
*/
class TCP {
/**
* @constructor
* @class
* @param {object} options

@@ -35,3 +37,3 @@ * @param {Upgrader} options.upgrader

* @param {object} options
* @param {AbortSignal} options.signal Used to abort dial requests
* @param {AbortSignal} options.signal - Used to abort dial requests
* @returns {Connection} An upgraded Connection

@@ -53,3 +55,3 @@ */

* @param {object} options
* @param {AbortSignal} options.signal Used to abort dial requests
* @param {AbortSignal} options.signal - Used to abort dial requests
* @returns {Promise<Socket>} Resolves a TCP Socket

@@ -113,2 +115,3 @@ */

* `upgrader.upgradeInbound`.
*
* @param {*} [options]

@@ -129,2 +132,3 @@ * @param {function(Connection)} handler

* Takes a list of `Multiaddr`s and returns only valid TCP addresses
*
* @param {Multiaddr[]} multiaddrs

@@ -131,0 +135,0 @@ * @returns {Multiaddr[]} Valid TCP multiaddrs

@@ -18,4 +18,5 @@ 'use strict'

* Attempts to close the given maConn. If a failure occurs, it will be logged.
*
* @private
* @param {MultiaddrConnection} maConn
* @param {import('libp2p-interfaces/src/transport/types').MultiaddrConnection} maConn
*/

@@ -22,0 +23,0 @@ async function attemptClose (maConn) {

'use strict'
const multiaddr = require('multiaddr')
const { Multiaddr } = require('multiaddr')
const os = require('os')

@@ -19,3 +19,3 @@ const { resolve } = require('path')

function getMultiaddrs (proto, ip, port) {
const toMa = ip => multiaddr(`/${proto}/${ip}/tcp/${port}`)
const toMa = ip => new Multiaddr(`/${proto}/${ip}/tcp/${port}`)
return (isAnyAddr(ip) ? getNetworkAddrs(ProtoFamily[proto]) : [ip]).map(toMa)

@@ -30,3 +30,3 @@ }

* @private
* @param {string} family One of ['IPv6', 'IPv4']
* @param {string} family - One of ['IPv6', 'IPv4']
* @returns {string[]} an array of ip address strings

@@ -33,0 +33,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