@libp2p/bootstrap 1.0.4 → 2.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,15 +1,26 @@
1
- # js-libp2p-bootstrap
1
+ # @libp2p/bootstrap <!-- 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-bootstrap.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-bootstrap)
8
- [![Build Status](https://github.com/libp2p/js-libp2p-bootstrap/actions/workflows/js-test-and-release.yml/badge.svg?branch=main)](https://github.com/libp2p/js-libp2p-bootstrap/actions/workflows/js-test-and-release.yml)
9
- [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)
10
- ![](https://img.shields.io/badge/Node.js-%3E%3D14.0.0-orange.svg?style=flat-square)
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-bootstrap.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-bootstrap)
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-bootstrap/actions/workflows/js-test-and-release.yml)
11
8
 
12
- > JavaScript libp2p Implementation of the railing process of a Node through a bootstrap peer list
9
+ > Node.js IPFS Implementation of the railing process of a Node through a bootstrap peer list
10
+
11
+ ## Table of contents <!-- omit in toc -->
12
+
13
+ - [Install](#install)
14
+ - [Usage](#usage)
15
+ - [Contribute](#contribute)
16
+ - [License](#license)
17
+ - [Contribution](#contribution)
18
+
19
+ ## Install
20
+
21
+ ```console
22
+ $ npm i @libp2p/bootstrap
23
+ ```
13
24
 
14
25
  ## Usage
15
26
 
@@ -60,16 +71,16 @@ start()
60
71
 
61
72
  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:
62
73
 
63
- - 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.
64
- - **Perform code reviews**. More eyes will help a) speed the project along b) ensure quality and c) reduce possible future bugs.
74
+ - 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.
75
+ - **Perform code reviews**. More eyes will help a) speed the project along b) ensure quality and c) reduce possible future bugs.
65
76
 
66
77
  ## License
67
78
 
68
79
  Licensed under either of
69
80
 
70
- * Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / http://www.apache.org/licenses/LICENSE-2.0)
71
- * MIT ([LICENSE-MIT](LICENSE-MIT) / http://opensource.org/licenses/MIT)
81
+ - Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
82
+ - MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)
72
83
 
73
- ### Contribution
84
+ ## Contribution
74
85
 
75
86
  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,5 +1,6 @@
1
1
  import { EventEmitter } from '@libp2p/interfaces/events';
2
- import type { PeerDiscovery, PeerDiscoveryEvents } from '@libp2p/interfaces/peer-discovery';
2
+ import type { PeerDiscovery, PeerDiscoveryEvents } from '@libp2p/interface-peer-discovery';
3
+ import { symbol } from '@libp2p/interface-peer-discovery';
3
4
  export interface BootstrapOptions {
4
5
  /**
5
6
  * The list of peer addresses in multi-address format
@@ -19,6 +20,8 @@ export declare class Bootstrap extends EventEmitter<PeerDiscoveryEvents> impleme
19
20
  private readonly list;
20
21
  private readonly interval;
21
22
  constructor(options?: BootstrapOptions);
23
+ get [symbol](): true;
24
+ get [Symbol.toStringTag](): string;
22
25
  isStarted(): boolean;
23
26
  /**
24
27
  * Start emitting events
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAe,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAErE,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAA;AAM3F,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,IAAI,EAAE,MAAM,EAAE,CAAA;IAEd;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED;;GAEG;AACH,qBAAa,SAAU,SAAQ,YAAY,CAAC,mBAAmB,CAAE,YAAW,aAAa;IACvF,MAAM,CAAC,GAAG,SAAc;IAExB,OAAO,CAAC,KAAK,CAAC,CAAgC;IAC9C,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAY;IACjC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAQ;gBAEpB,OAAO,GAAE,gBAA+B;IAiCrD,SAAS;IAIT;;OAEG;IACH,KAAK;IAUL;;OAEG;IACH,uBAAuB;IAUvB;;OAEG;IACH,IAAI;CAOL"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAe,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAErE,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAA;AAG1F,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAA;AAIzD,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,IAAI,EAAE,MAAM,EAAE,CAAA;IAEd;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED;;GAEG;AACH,qBAAa,SAAU,SAAQ,YAAY,CAAC,mBAAmB,CAAE,YAAW,aAAa;IACvF,MAAM,CAAC,GAAG,SAAc;IAExB,OAAO,CAAC,KAAK,CAAC,CAAgC;IAC9C,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAY;IACjC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAQ;gBAEpB,OAAO,GAAE,gBAA+B;IAiCrD,IAAI,CAAC,MAAM,CAAC,IAAK,IAAI,CAEpB;IAED,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,WAEvB;IAED,SAAS;IAIT;;OAEG;IACH,KAAK;IAUL;;OAEG;IACH,uBAAuB;IAUvB;;OAEG;IACH,IAAI;CAOL"}
package/dist/src/index.js CHANGED
@@ -3,6 +3,7 @@ import { P2P } from '@multiformats/mafmt';
3
3
  import { CustomEvent, EventEmitter } from '@libp2p/interfaces/events';
4
4
  import { logger } from '@libp2p/logger';
5
5
  import { peerIdFromString } from '@libp2p/peer-id';
6
+ import { symbol } from '@libp2p/interface-peer-discovery';
6
7
  const log = logger('libp2p:bootstrap');
7
8
  /**
8
9
  * Emits 'peer' events on a regular interval for each peer in the provided list.
@@ -34,6 +35,12 @@ export class Bootstrap extends EventEmitter {
34
35
  this.list.push(peerData);
35
36
  }
36
37
  }
38
+ get [symbol]() {
39
+ return true;
40
+ }
41
+ get [Symbol.toStringTag]() {
42
+ return '@libp2p/bootstrap';
43
+ }
37
44
  isStarted() {
38
45
  return Boolean(this.timer);
39
46
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACnD,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAA;AACzC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACrE,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAGvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAElD,MAAM,GAAG,GAAG,MAAM,CAAC,kBAAkB,CAAC,CAAA;AActC;;GAEG;AACH,MAAM,OAAO,SAAU,SAAQ,YAAiC;IAO9D,YAAa,UAA4B,EAAE,IAAI,EAAE,EAAE,EAAE;QACnD,IAAI,OAAO,CAAC,IAAI,IAAI,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;YACrD,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAA;SAC/D;QACD,KAAK,EAAE,CAAA;QAEP,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,KAAK,CAAA;QACzC,IAAI,CAAC,IAAI,GAAG,EAAE,CAAA;QAEd,KAAK,MAAM,SAAS,IAAI,OAAO,CAAC,IAAI,EAAE;YACpC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE;gBAC3B,GAAG,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAA;gBAC9B,SAAQ;aACT;YAED,MAAM,EAAE,GAAG,IAAI,SAAS,CAAC,SAAS,CAAC,CAAA;YACnC,MAAM,SAAS,GAAG,EAAE,CAAC,SAAS,EAAE,CAAA;YAEhC,IAAI,SAAS,IAAI,IAAI,EAAE;gBACrB,GAAG,CAAC,KAAK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
2
2
  "name": "@libp2p/bootstrap",
3
- "version": "1.0.4",
3
+ "version": "2.0.0",
4
4
  "description": "Node.js IPFS Implementation of the railing process of a Node through a bootstrap peer list",
5
5
  "license": "Apache-2.0 OR MIT",
6
6
  "homepage": "https://github.com/libp2p/js-libp2p-bootstrap#readme",
@@ -28,6 +28,7 @@
28
28
  ],
29
29
  "exports": {
30
30
  ".": {
31
+ "types": "./src/index.d.ts",
31
32
  "import": "./dist/src/index.js"
32
33
  }
33
34
  },
@@ -133,14 +134,17 @@
133
134
  "release": "aegir release"
134
135
  },
135
136
  "dependencies": {
136
- "@libp2p/interfaces": "^1.3.31",
137
- "@libp2p/logger": "^1.1.3",
137
+ "@libp2p/interface-peer-discovery": "^1.0.0",
138
+ "@libp2p/interface-peer-info": "^1.0.1",
139
+ "@libp2p/interfaces": "^3.0.2",
140
+ "@libp2p/logger": "^2.0.0",
138
141
  "@libp2p/peer-id": "^1.1.9",
139
142
  "@multiformats/mafmt": "^11.0.2",
140
143
  "@multiformats/multiaddr": "^10.1.7"
141
144
  },
142
145
  "devDependencies": {
143
- "@libp2p/interface-compliance-tests": "^1.1.32",
144
- "aegir": "^37.0.7"
146
+ "@libp2p/interface-peer-discovery-compliance-tests": "^1.0.0",
147
+ "@libp2p/interface-peer-id": "^1.0.2",
148
+ "aegir": "^37.2.0"
145
149
  }
146
150
  }
package/src/index.ts CHANGED
@@ -2,9 +2,10 @@ import { Multiaddr } from '@multiformats/multiaddr'
2
2
  import { P2P } from '@multiformats/mafmt'
3
3
  import { CustomEvent, EventEmitter } from '@libp2p/interfaces/events'
4
4
  import { logger } from '@libp2p/logger'
5
- import type { PeerDiscovery, PeerDiscoveryEvents } from '@libp2p/interfaces/peer-discovery'
6
- import type { PeerInfo } from '@libp2p/interfaces/peer-info'
5
+ import type { PeerDiscovery, PeerDiscoveryEvents } from '@libp2p/interface-peer-discovery'
6
+ import type { PeerInfo } from '@libp2p/interface-peer-info'
7
7
  import { peerIdFromString } from '@libp2p/peer-id'
8
+ import { symbol } from '@libp2p/interface-peer-discovery'
8
9
 
9
10
  const log = logger('libp2p:bootstrap')
10
11
 
@@ -63,6 +64,14 @@ export class Bootstrap extends EventEmitter<PeerDiscoveryEvents> implements Peer
63
64
  }
64
65
  }
65
66
 
67
+ get [symbol] (): true {
68
+ return true
69
+ }
70
+
71
+ get [Symbol.toStringTag] () {
72
+ return '@libp2p/bootstrap'
73
+ }
74
+
66
75
  isStarted () {
67
76
  return Boolean(this.timer)
68
77
  }