Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@libp2p/tcp

Package Overview
Dependencies
Maintainers
6
Versions
576
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@libp2p/tcp - npm Package Compare versions

Comparing version 3.0.5 to 3.0.6

1

dist/src/index.js

@@ -24,2 +24,3 @@ import net from 'net';

const socket = await this._connect(ma, options);
socket.setKeepAlive(true);
// Avoid uncaught errors caused by unstable connections

@@ -26,0 +27,0 @@ socket.on('error', err => {

@@ -27,2 +27,3 @@ import net from 'net';

const server = Object.assign(net.createServer(socket => {
socket.setKeepAlive(true);
// Avoid uncaught errors caused by unstable connections

@@ -29,0 +30,0 @@ socket.on('error', err => {

@@ -24,3 +24,14 @@ import { abortableSource } from 'abortable-iterator';

}
const remoteAddr = options.remoteAddr ?? toMultiaddr(socket.remoteAddress ?? '', socket.remotePort ?? '');
let remoteAddr;
if (options.remoteAddr != null) {
remoteAddr = options.remoteAddr;
}
else {
if (socket.remoteAddress == null || socket.remotePort == null) {
// this can be undefined if the socket is destroyed (for example, if the client disconnected)
// https://nodejs.org/dist/latest-v16.x/docs/api/net.html#socketremoteaddress
throw errCode(new Error('Could not determine remote address or port'), 'ERR_NO_REMOTE_ADDRESS');
}
remoteAddr = toMultiaddr(socket.remoteAddress, socket.remotePort);
}
const { host, port } = remoteAddr.toOptions();

@@ -27,0 +38,0 @@ const { sink, source } = toIterable.duplex(socket);

2

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

@@ -5,0 +5,0 @@ "license": "Apache-2.0 OR MIT",

@@ -52,2 +52,3 @@ import net from 'net'

const socket = await this._connect(ma, options)
socket.setKeepAlive(true)

@@ -54,0 +55,0 @@ // Avoid uncaught errors caused by unstable connections

@@ -51,2 +51,4 @@ import net from 'net'

const server: ServerWithMultiaddrConnections = Object.assign(net.createServer(socket => {
socket.setKeepAlive(true)
// Avoid uncaught errors caused by unstable connections

@@ -53,0 +55,0 @@ socket.on('error', err => {

@@ -41,3 +41,16 @@ import { abortableSource } from 'abortable-iterator'

const remoteAddr = options.remoteAddr ?? toMultiaddr(socket.remoteAddress ?? '', socket.remotePort ?? '')
let remoteAddr: Multiaddr
if (options.remoteAddr != null) {
remoteAddr = options.remoteAddr
} else {
if (socket.remoteAddress == null || socket.remotePort == null) {
// this can be undefined if the socket is destroyed (for example, if the client disconnected)
// https://nodejs.org/dist/latest-v16.x/docs/api/net.html#socketremoteaddress
throw errCode(new Error('Could not determine remote address or port'), 'ERR_NO_REMOTE_ADDRESS')
}
remoteAddr = toMultiaddr(socket.remoteAddress, socket.remotePort)
}
const { host, port } = remoteAddr.toOptions()

@@ -44,0 +57,0 @@ const { sink, source } = toIterable.duplex(socket)

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc