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 4.1.0 to 5.0.0

26

dist/src/index.d.ts

@@ -1,6 +0,3 @@

/// <reference types="node" />
import net from 'net';
import { CreateListenerOptions, DialOptions, Listener, symbol, Transport } from '@libp2p/interface-transport';
import type { AbortOptions, Multiaddr } from '@multiformats/multiaddr';
import type { Connection } from '@libp2p/interface-connection';
import { CreateListenerOptions, DialOptions, Transport } from '@libp2p/interface-transport';
import type { AbortOptions } from '@multiformats/multiaddr';
export interface TCPOptions {

@@ -38,20 +35,3 @@ /**

}
export declare class TCP implements Transport {
private readonly opts;
constructor(options?: TCPOptions);
get [symbol](): true;
get [Symbol.toStringTag](): string;
dial(ma: Multiaddr, options: TCPDialOptions): Promise<Connection>;
_connect(ma: Multiaddr, options: TCPDialOptions): Promise<net.Socket>;
/**
* Creates a TCP listener. The provided `handler` function will be called
* anytime a new incoming Connection has been successfully upgraded via
* `upgrader.upgradeInbound`.
*/
createListener(options: TCPCreateListenerOptions): Listener;
/**
* Takes a list of `Multiaddr`s and returns only valid TCP addresses
*/
filter(multiaddrs: Multiaddr[]): Multiaddr[];
}
export declare function tcp(init?: TCPOptions): (components?: any) => Transport;
//# sourceMappingURL=index.d.ts.map

7

dist/src/index.js

@@ -12,3 +12,3 @@ import net from 'net';

const log = logger('libp2p:tcp');
export class TCP {
class TCP {
constructor(options = {}) {

@@ -119,2 +119,7 @@ this.opts = options;

}
export function tcp(init = {}) {
return () => {
return new TCP(init);
};
}
//# sourceMappingURL=index.js.map
{
"name": "@libp2p/tcp",
"version": "4.1.0",
"version": "5.0.0",
"description": "Node.js implementation of the TCP module that libp2p uses, which implements the interface-connection and interface-transport interfaces",

@@ -151,4 +151,4 @@ "license": "Apache-2.0 OR MIT",

"devDependencies": {
"@libp2p/interface-mocks": "^6.0.0",
"@libp2p/interface-transport-compliance-tests": "^2.0.6",
"@libp2p/interface-mocks": "^7.0.1",
"@libp2p/interface-transport-compliance-tests": "^3.0.0",
"aegir": "^37.5.3",

@@ -159,4 +159,4 @@ "it-all": "^1.0.6",

"sinon": "^14.0.0",
"uint8arrays": "^3.0.0"
"uint8arrays": "^4.0.2"
}
}

@@ -39,5 +39,5 @@ # @libp2p/tcp <!-- omit in toc -->

```js
import { TCP } from '@libp2p/tcp'
import { tcp } from '@libp2p/tcp'
import { multiaddr } from '@multiformats/multiaddr'
import {pipe} from 'it-pipe'
import { pipe } from 'it-pipe'
import all from 'it-all'

@@ -51,5 +51,5 @@

const tcp = new TCP()
const transport = tcp()()
const listener = tcp.createListener({
const listener = transport.createListener({
upgrader,

@@ -69,3 +69,3 @@ handler: (socket) => {

const socket = await tcp.dial(addr, { upgrader })
const socket = await transport.dial(addr, { upgrader })
const values = await pipe(

@@ -95,3 +95,3 @@ socket,

`libp2p-tcp` accepts TCP addresses as both IPFS and non IPFS encapsulated addresses, i.e:
`@libp2p/tcp` accepts TCP addresses as both IPFS and non IPFS encapsulated addresses, i.e:

@@ -98,0 +98,0 @@ `/ip4/127.0.0.1/tcp/4001`

@@ -58,3 +58,3 @@ import net from 'net'

export class TCP implements Transport {
class TCP implements Transport {
private readonly opts: TCPOptions

@@ -193,1 +193,7 @@

}
export function tcp (init: TCPOptions = {}): (components?: any) => Transport {
return () => {
return new TCP(init)
}
}

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