@libp2p/bootstrap 1.0.6 → 2.0.1
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 +26 -15
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +3 -3
- package/dist/src/index.js.map +1 -1
- package/package.json +20 -12
- package/src/index.ts +5 -5
package/README.md
CHANGED
|
@@ -1,15 +1,26 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @libp2p/bootstrap <!-- omit in toc -->
|
|
2
2
|
|
|
3
|
-
[](https://github.com/libp2p/js-libp2p-bootstrap/actions/workflows/js-test-and-release.yml)
|
|
9
|
-
[](https://github.com/feross/standard)
|
|
10
|
-

|
|
3
|
+
[](http://libp2p.io/)
|
|
4
|
+
[](http://webchat.freenode.net/?channels=%23libp2p)
|
|
5
|
+
[](https://discuss.libp2p.io)
|
|
6
|
+
[](https://codecov.io/gh/libp2p/js-libp2p-bootstrap)
|
|
7
|
+
[](https://github.com/libp2p/js-libp2p-bootstrap/actions/workflows/js-test-and-release.yml)
|
|
11
8
|
|
|
12
|
-
>
|
|
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
|
+
- [Contribute](#contribute-1)
|
|
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
|
-
|
|
64
|
-
|
|
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
|
-
|
|
71
|
-
|
|
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
|
-
|
|
84
|
+
## Contribute
|
|
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.
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EventEmitter } from '@libp2p/interfaces/events';
|
|
2
|
-
import type { PeerDiscovery, PeerDiscoveryEvents } from '@libp2p/
|
|
3
|
-
import { symbol } from '@libp2p/
|
|
2
|
+
import type { PeerDiscovery, PeerDiscoveryEvents } from '@libp2p/interface-peer-discovery';
|
|
3
|
+
import { symbol } from '@libp2p/interface-peer-discovery';
|
|
4
4
|
export interface BootstrapOptions {
|
|
5
5
|
/**
|
|
6
6
|
* The list of peer addresses in multi-address format
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -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,
|
|
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
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
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
5
|
import { peerIdFromString } from '@libp2p/peer-id';
|
|
6
|
-
import { symbol } from '@libp2p/
|
|
6
|
+
import { symbol } from '@libp2p/interface-peer-discovery';
|
|
7
7
|
const log = logger('libp2p:bootstrap');
|
|
8
8
|
/**
|
|
9
9
|
* Emits 'peer' events on a regular interval for each peer in the provided list.
|
|
@@ -21,7 +21,7 @@ export class Bootstrap extends EventEmitter {
|
|
|
21
21
|
log.error('Invalid multiaddr');
|
|
22
22
|
continue;
|
|
23
23
|
}
|
|
24
|
-
const ma =
|
|
24
|
+
const ma = multiaddr(candidate);
|
|
25
25
|
const peerIdStr = ma.getPeerId();
|
|
26
26
|
if (peerIdStr == null) {
|
|
27
27
|
log.error('Invalid bootstrap multiaddr without peer id');
|
package/dist/src/index.js.map
CHANGED
|
@@ -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;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,
|
|
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;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAA;AAEzD,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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WAAW,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,uBAAuB,EAAE,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAA;QAC7E,GAAG,CAAC,mCAAmC,CAAC,CAAA;QACxC,IAAI,CAAC,uBAAuB,EAAE,CAAA;IAChC,CAAC;IAED;;OAEG;IACH,uBAAuB;QACrB,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,EAAE;YACtB,OAAM;SACP;QAED,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;YAC7B,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAW,MAAM,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAA;QAC7E,CAAC,CAAC,CAAA;IACJ,CAAC;IAED;;OAEG;IACH,IAAI;QACF,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,EAAE;YACtB,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;SAC1B;QAED,IAAI,CAAC,KAAK,GAAG,SAAS,CAAA;IACxB,CAAC;;AAtFM,aAAG,GAAG,WAAW,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@libp2p/bootstrap",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
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
|
},
|
|
@@ -64,15 +65,15 @@
|
|
|
64
65
|
"release": "patch"
|
|
65
66
|
},
|
|
66
67
|
{
|
|
67
|
-
"type": "
|
|
68
|
+
"type": "docs",
|
|
68
69
|
"release": "patch"
|
|
69
70
|
},
|
|
70
71
|
{
|
|
71
|
-
"type": "
|
|
72
|
+
"type": "test",
|
|
72
73
|
"release": "patch"
|
|
73
74
|
},
|
|
74
75
|
{
|
|
75
|
-
"type": "
|
|
76
|
+
"type": "deps",
|
|
76
77
|
"release": "patch"
|
|
77
78
|
},
|
|
78
79
|
{
|
|
@@ -102,7 +103,11 @@
|
|
|
102
103
|
},
|
|
103
104
|
{
|
|
104
105
|
"type": "docs",
|
|
105
|
-
"section": "
|
|
106
|
+
"section": "Documentation"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"type": "deps",
|
|
110
|
+
"section": "Dependencies"
|
|
106
111
|
},
|
|
107
112
|
{
|
|
108
113
|
"type": "test",
|
|
@@ -133,14 +138,17 @@
|
|
|
133
138
|
"release": "aegir release"
|
|
134
139
|
},
|
|
135
140
|
"dependencies": {
|
|
136
|
-
"@libp2p/
|
|
137
|
-
"@libp2p/
|
|
138
|
-
"@libp2p/
|
|
139
|
-
"@
|
|
140
|
-
"@
|
|
141
|
+
"@libp2p/interface-peer-discovery": "^1.0.1",
|
|
142
|
+
"@libp2p/interface-peer-info": "^1.0.3",
|
|
143
|
+
"@libp2p/interfaces": "^3.0.3",
|
|
144
|
+
"@libp2p/logger": "^2.0.0",
|
|
145
|
+
"@libp2p/peer-id": "^1.1.15",
|
|
146
|
+
"@multiformats/mafmt": "^11.0.3",
|
|
147
|
+
"@multiformats/multiaddr": "^11.0.0"
|
|
141
148
|
},
|
|
142
149
|
"devDependencies": {
|
|
143
|
-
"@libp2p/interface-compliance-tests": "^
|
|
144
|
-
"
|
|
150
|
+
"@libp2p/interface-peer-discovery-compliance-tests": "^1.0.2",
|
|
151
|
+
"@libp2p/interface-peer-id": "^1.0.4",
|
|
152
|
+
"aegir": "^37.5.3"
|
|
145
153
|
}
|
|
146
154
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
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/
|
|
6
|
-
import type { PeerInfo } from '@libp2p/
|
|
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/
|
|
8
|
+
import { symbol } from '@libp2p/interface-peer-discovery'
|
|
9
9
|
|
|
10
10
|
const log = logger('libp2p:bootstrap')
|
|
11
11
|
|
|
@@ -46,7 +46,7 @@ export class Bootstrap extends EventEmitter<PeerDiscoveryEvents> implements Peer
|
|
|
46
46
|
continue
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
const ma =
|
|
49
|
+
const ma = multiaddr(candidate)
|
|
50
50
|
const peerIdStr = ma.getPeerId()
|
|
51
51
|
|
|
52
52
|
if (peerIdStr == null) {
|