@libp2p/tcp 1.0.11 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,23 +1,16 @@
1
- # js-libp2p-tcp <!-- omit in toc -->
1
+ # @libp2p/tcp <!-- omit in toc -->
2
2
 
3
- [![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)
4
- [![](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/)
5
- [![](https://img.shields.io/badge/freenode-%23libp2p-yellow.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23libp2p)
6
- [![Discourse posts](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg)](https://discuss.libp2p.io)
7
- [![](https://img.shields.io/codecov/c/github/libp2p/js-libp2p-tcp.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-tcp)
8
- [![Build Status](https://github.com/libp2p/js-libp2p-tcp/actions/workflows/js-test-and-release.yml/badge.svg?branch=main)](https://github.com/libp2p/js-libp2p-tcp/actions/workflows/js-test-and-release.yml)
9
- [![Dependency Status](https://david-dm.org/libp2p/js-libp2p-tcp.svg?style=flat-square)](https://david-dm.org/libp2p/js-libp2p-tcp)
10
- [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)
3
+ [![libp2p.io](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/)
4
+ [![IRC](https://img.shields.io/badge/freenode-%23libp2p-yellow.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23libp2p)
5
+ [![Discuss](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg?style=flat-square)](https://discuss.libp2p.io)
6
+ [![codecov](https://img.shields.io/codecov/c/github/libp2p/js-libp2p-tcp.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-tcp)
7
+ [![CI](https://img.shields.io/github/workflow/status/libp2p/js-libp2p-interfaces/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/libp2p/js-libp2p-tcp/actions/workflows/js-test-and-release.yml)
11
8
 
12
- [![](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)
13
- [![](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)
9
+ > Node.js implementation of the TCP module that libp2p uses, which implements the interface-connection and interface-transport interfaces
14
10
 
15
- > JavaScript implementation of the TCP module for libp2p. It exposes the [interface-transport](https://github.com/libp2p/js-libp2p-interfaces/tree/master/packages/libp2p-interfaces/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.
16
-
17
- ## Table of Contents <!-- omit in toc -->
11
+ ## Table of contents <!-- omit in toc -->
18
12
 
19
13
  - [Install](#install)
20
- - [npm](#npm)
21
14
  - [Usage](#usage)
22
15
  - [API](#api)
23
16
  - [Transport](#transport)
@@ -25,11 +18,16 @@
25
18
  - [Contribute](#contribute)
26
19
  - [Contribute](#contribute-1)
27
20
  - [License](#license)
28
- - [Contribution](#contribution)
21
+ - [Contribution](#contribution)
29
22
 
30
23
  ## Install
31
24
 
32
- ### npm
25
+ ```console
26
+ $ npm i @libp2p/tcp
27
+ ```
28
+
29
+ [![](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)
30
+ [![](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)
33
31
 
34
32
  ```sh
35
33
  > npm install @libp2p/tcp
@@ -117,16 +115,16 @@ Small note: If editing the README, please conform to the [standard-readme](https
117
115
 
118
116
  The libp2p implementation in JavaScript is a work in progress. As such, there are a few things you can do right now to help out:
119
117
 
120
- - Go through the modules and **check out existing issues**. This is especially useful for modules in active development. Some knowledge of IPFS/libp2p may be required, as well as the infrastructure behind it - for instance, you may need to read up on p2p and more complex operations like muxing to be able to help technically.
121
- - **Perform code reviews**. More eyes will help a) speed the project along b) ensure quality and c) reduce possible future bugs.
118
+ - Go through the modules and **check out existing issues**. This is especially useful for modules in active development. Some knowledge of IPFS/libp2p may be required, as well as the infrastructure behind it - for instance, you may need to read up on p2p and more complex operations like muxing to be able to help technically.
119
+ - **Perform code reviews**. More eyes will help a) speed the project along b) ensure quality and c) reduce possible future bugs.
122
120
 
123
121
  ## License
124
122
 
125
123
  Licensed under either of
126
124
 
127
- * Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / http://www.apache.org/licenses/LICENSE-2.0)
128
- * MIT ([LICENSE-MIT](LICENSE-MIT) / http://opensource.org/licenses/MIT)
125
+ - Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
126
+ - MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)
129
127
 
130
- ### Contribution
128
+ ## Contribution
131
129
 
132
130
  Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
@@ -1,19 +1,19 @@
1
1
  /// <reference types="node" />
2
2
  import net from 'net';
3
- import { CreateListenerOptions, DialOptions, symbol, Transport } from '@libp2p/interfaces/transport';
3
+ import { CreateListenerOptions, DialOptions, symbol, Transport } from '@libp2p/interface-transport';
4
4
  import type { Multiaddr } from '@multiformats/multiaddr';
5
5
  import type { AbortOptions } from '@libp2p/interfaces';
6
6
  export declare class TCP implements Transport {
7
7
  get [symbol](): true;
8
8
  get [Symbol.toStringTag](): string;
9
- dial(ma: Multiaddr, options: DialOptions): Promise<import("@libp2p/interfaces/dist/src/connection").Connection>;
9
+ dial(ma: Multiaddr, options: DialOptions): Promise<import("@libp2p/interface-connection/dist/src").Connection>;
10
10
  _connect(ma: Multiaddr, options?: AbortOptions): Promise<net.Socket>;
11
11
  /**
12
12
  * Creates a TCP listener. The provided `handler` function will be called
13
13
  * anytime a new incoming Connection has been successfully upgraded via
14
14
  * `upgrader.upgradeInbound`.
15
15
  */
16
- createListener(options: CreateListenerOptions): import("@libp2p/interfaces/transport").Listener;
16
+ createListener(options: CreateListenerOptions): import("@libp2p/interface-transport").Listener;
17
17
  /**
18
18
  * Takes a list of `Multiaddr`s and returns only valid TCP addresses
19
19
  */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA,OAAO,GAAG,MAAM,KAAK,CAAA;AASrB,OAAO,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AACpG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAExD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAItD,qBAAa,GAAI,YAAW,SAAS;IACnC,IAAI,CAAC,MAAM,CAAC,IAAK,IAAI,CAEpB;IAED,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,WAEvB;IAEK,IAAI,CAAE,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW;IAezC,QAAQ,CAAE,EAAE,EAAE,SAAS,EAAE,OAAO,GAAE,YAAiB;IA+DzD;;;;OAIG;IACH,cAAc,CAAE,OAAO,EAAE,qBAAqB;IAI9C;;OAEG;IACH,MAAM,CAAE,UAAU,EAAE,SAAS,EAAE;CAWhC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA,OAAO,GAAG,MAAM,KAAK,CAAA;AASrB,OAAO,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAA;AACnG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAExD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAItD,qBAAa,GAAI,YAAW,SAAS;IACnC,IAAI,CAAC,MAAM,CAAC,IAAK,IAAI,CAEpB;IAED,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,WAEvB;IAEK,IAAI,CAAE,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW;IAezC,QAAQ,CAAE,EAAE,EAAE,SAAS,EAAE,OAAO,GAAE,YAAiB;IA+DzD;;;;OAIG;IACH,cAAc,CAAE,OAAO,EAAE,qBAAqB;IAI9C;;OAEG;IACH,MAAM,CAAE,UAAU,EAAE,SAAS,EAAE;CAWhC"}
package/dist/src/index.js CHANGED
@@ -7,7 +7,7 @@ import { createListener } from './listener.js';
7
7
  import { multiaddrToNetConfig } from './utils.js';
8
8
  import { AbortError } from '@libp2p/interfaces/errors';
9
9
  import { CODE_CIRCUIT, CODE_P2P } from './constants.js';
10
- import { symbol } from '@libp2p/interfaces/transport';
10
+ import { symbol } from '@libp2p/interface-transport';
11
11
  const log = logger('libp2p:tcp');
12
12
  export class TCP {
13
13
  get [symbol]() {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAA;AACrB,OAAO,KAAK,KAAK,MAAM,qBAAqB,CAAA;AAC5C,OAAO,OAAO,MAAM,UAAU,CAAA;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACvC,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CA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IACJ,CAAC;IAED;;;;OAIG;IACH,cAAc,CAAE,OAA8B;QAC5C,OAAO,cAAc,CAAC,OAAO,CAAC,CAAA;IAChC,CAAC;IAED;;OAEG;IACH,MAAM,CAAE,UAAuB;QAC7B,UAAU,GAAG,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAA;QAElE,OAAO,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE;YAC5B,IAAI,EAAE,CAAC,UAAU,EAAE,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE;gBAC1C,OAAO,KAAK,CAAA;aACb;YAED,OAAO,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAA;QACxD,CAAC,CAAC,CAAA;IACJ,CAAC;CACF"}
@@ -1,5 +1,5 @@
1
- import type { Connection } from '@libp2p/interfaces/connection';
2
- import type { Upgrader, Listener } from '@libp2p/interfaces/transport';
1
+ import type { Connection } from '@libp2p/interface-connection';
2
+ import type { Upgrader, Listener } from '@libp2p/interface-transport';
3
3
  interface Context {
4
4
  handler?: (conn: Connection) => void;
5
5
  upgrader: Upgrader;
@@ -1 +1 @@
1
- {"version":3,"file":"listener.d.ts","sourceRoot":"","sources":["../../src/listener.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,KAAK,EAAuB,QAAQ,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAA;AAqB3F,UAAU,OAAO;IACf,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,IAAI,CAAA;IACpC,QAAQ,EAAE,QAAQ,CAAA;CACnB;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAE,OAAO,EAAE,OAAO,YAsH/C"}
1
+ {"version":3,"file":"listener.d.ts","sourceRoot":"","sources":["../../src/listener.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAuB,UAAU,EAAE,MAAM,8BAA8B,CAAA;AACnF,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AAqBrE,UAAU,OAAO;IACf,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,IAAI,CAAA;IACpC,QAAQ,EAAE,QAAQ,CAAA;CACnB;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAE,OAAO,EAAE,OAAO,YAsH/C"}
@@ -1,6 +1,6 @@
1
1
  import type { Socket } from 'net';
2
2
  import type { Multiaddr } from '@multiformats/multiaddr';
3
- import type { MultiaddrConnection } from '@libp2p/interfaces/transport';
3
+ import type { MultiaddrConnection } from '@libp2p/interface-connection';
4
4
  interface ToConnectionOptions {
5
5
  listeningAddr?: Multiaddr;
6
6
  remoteAddr?: Multiaddr;
@@ -11,6 +11,6 @@ interface ToConnectionOptions {
11
11
  * Convert a socket into a MultiaddrConnection
12
12
  * https://github.com/libp2p/interface-transport#multiaddrconnection
13
13
  */
14
- export declare const toMultiaddrConnection: (socket: Socket, options?: ToConnectionOptions | undefined) => MultiaddrConnection;
14
+ export declare const toMultiaddrConnection: (socket: Socket, options?: ToConnectionOptions) => MultiaddrConnection;
15
15
  export {};
16
16
  //# sourceMappingURL=socket-to-conn.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"socket-to-conn.d.ts","sourceRoot":"","sources":["../../src/socket-to-conn.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,KAAK,CAAA;AACjC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAA;AAIvE,UAAU,mBAAmB;IAC3B,aAAa,CAAC,EAAE,SAAS,CAAA;IACzB,UAAU,CAAC,EAAE,SAAS,CAAA;IACtB,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB;AAED;;;GAGG;AACH,eAAO,MAAM,qBAAqB,WAAY,MAAM,mEAmGnD,CAAA"}
1
+ {"version":3,"file":"socket-to-conn.d.ts","sourceRoot":"","sources":["../../src/socket-to-conn.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,KAAK,CAAA;AACjC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAA;AAIvE,UAAU,mBAAmB;IAC3B,aAAa,CAAC,EAAE,SAAS,CAAA;IACzB,UAAU,CAAC,EAAE,SAAS,CAAA;IACtB,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB;AAED;;;GAGG;AACH,eAAO,MAAM,qBAAqB,WAAY,MAAM,YAAY,mBAAmB,wBAmGlF,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@libp2p/tcp",
3
- "version": "1.0.11",
3
+ "version": "3.0.0",
4
4
  "description": "Node.js implementation of the TCP module that libp2p uses, which implements the interface-connection and interface-transport interfaces",
5
5
  "license": "Apache-2.0 OR MIT",
6
6
  "homepage": "https://github.com/libp2p/js-libp2p-tcp#readme",
@@ -34,6 +34,7 @@
34
34
  ],
35
35
  "exports": {
36
36
  ".": {
37
+ "types": "./src/index.d.ts",
37
38
  "import": "./dist/src/index.js"
38
39
  }
39
40
  },
@@ -135,9 +136,11 @@
135
136
  "release": "aegir release"
136
137
  },
137
138
  "dependencies": {
138
- "@libp2p/interfaces": "^2.0.1",
139
- "@libp2p/logger": "^1.1.2",
140
- "@libp2p/utils": "^1.0.9",
139
+ "@libp2p/interface-connection": "^2.0.0",
140
+ "@libp2p/interface-transport": "^1.0.0",
141
+ "@libp2p/interfaces": "^3.0.2",
142
+ "@libp2p/logger": "^2.0.0",
143
+ "@libp2p/utils": "^2.0.0",
141
144
  "@multiformats/mafmt": "^11.0.2",
142
145
  "@multiformats/multiaddr": "^10.1.5",
143
146
  "abortable-iterator": "^4.0.2",
@@ -145,7 +148,8 @@
145
148
  "stream-to-it": "^0.2.2"
146
149
  },
147
150
  "devDependencies": {
148
- "@libp2p/interface-compliance-tests": "^2.0.1",
151
+ "@libp2p/interface-mocks": "^2.0.1",
152
+ "@libp2p/interface-transport-compliance-tests": "^2.0.0",
149
153
  "aegir": "^37.0.4",
150
154
  "it-all": "^1.0.6",
151
155
  "it-pipe": "^2.0.3",
package/src/index.ts CHANGED
@@ -7,7 +7,7 @@ import { createListener } from './listener.js'
7
7
  import { multiaddrToNetConfig } from './utils.js'
8
8
  import { AbortError } from '@libp2p/interfaces/errors'
9
9
  import { CODE_CIRCUIT, CODE_P2P } from './constants.js'
10
- import { CreateListenerOptions, DialOptions, symbol, Transport } from '@libp2p/interfaces/transport'
10
+ import { CreateListenerOptions, DialOptions, symbol, Transport } from '@libp2p/interface-transport'
11
11
  import type { Multiaddr } from '@multiformats/multiaddr'
12
12
  import type { Socket } from 'net'
13
13
  import type { AbortOptions } from '@libp2p/interfaces'
package/src/listener.ts CHANGED
@@ -7,8 +7,8 @@ import {
7
7
  multiaddrToNetConfig
8
8
  } from './utils.js'
9
9
  import { EventEmitter, CustomEvent } from '@libp2p/interfaces/events'
10
- import type { Connection } from '@libp2p/interfaces/connection'
11
- import type { MultiaddrConnection, Upgrader, Listener } from '@libp2p/interfaces/transport'
10
+ import type { MultiaddrConnection, Connection } from '@libp2p/interface-connection'
11
+ import type { Upgrader, Listener } from '@libp2p/interface-transport'
12
12
  import type { Server } from 'net'
13
13
  import type { Multiaddr } from '@multiformats/multiaddr'
14
14
 
@@ -6,7 +6,7 @@ import { ipPortToMultiaddr as toMultiaddr } from '@libp2p/utils/ip-port-to-multi
6
6
  import { CLOSE_TIMEOUT } from './constants.js'
7
7
  import type { Socket } from 'net'
8
8
  import type { Multiaddr } from '@multiformats/multiaddr'
9
- import type { MultiaddrConnection } from '@libp2p/interfaces/transport'
9
+ import type { MultiaddrConnection } from '@libp2p/interface-connection'
10
10
 
11
11
  const log = logger('libp2p:tcp:socket')
12
12