libp2p 0.46.20 → 0.46.21-0b4a2ee79
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 +53 -40
- package/dist/index.min.js +40 -28
- package/dist/src/address-manager/index.d.ts +3 -1
- package/dist/src/address-manager/index.d.ts.map +1 -1
- package/dist/src/address-manager/index.js +3 -3
- package/dist/src/address-manager/index.js.map +1 -1
- package/dist/src/components.d.ts +3 -1
- package/dist/src/components.d.ts.map +1 -1
- package/dist/src/components.js.map +1 -1
- package/dist/src/connection/index.d.ts +2 -2
- package/dist/src/connection/index.d.ts.map +1 -1
- package/dist/src/connection/index.js +9 -9
- package/dist/src/connection/index.js.map +1 -1
- package/dist/src/connection-manager/auto-dial.d.ts +1 -1
- package/dist/src/connection-manager/auto-dial.d.ts.map +1 -1
- package/dist/src/connection-manager/auto-dial.js +21 -21
- package/dist/src/connection-manager/auto-dial.js.map +1 -1
- package/dist/src/connection-manager/connection-pruner.d.ts +1 -1
- package/dist/src/connection-manager/connection-pruner.d.ts.map +1 -1
- package/dist/src/connection-manager/connection-pruner.js +8 -8
- package/dist/src/connection-manager/connection-pruner.js.map +1 -1
- package/dist/src/connection-manager/constants.defaults.d.ts +0 -4
- package/dist/src/connection-manager/constants.defaults.d.ts.map +1 -1
- package/dist/src/connection-manager/constants.defaults.js +0 -4
- package/dist/src/connection-manager/constants.defaults.js.map +1 -1
- package/dist/src/connection-manager/dial-queue.d.ts +1 -3
- package/dist/src/connection-manager/dial-queue.d.ts.map +1 -1
- package/dist/src/connection-manager/dial-queue.js +30 -37
- package/dist/src/connection-manager/dial-queue.js.map +1 -1
- package/dist/src/connection-manager/index.d.ts +1 -8
- package/dist/src/connection-manager/index.d.ts.map +1 -1
- package/dist/src/connection-manager/index.js +16 -17
- package/dist/src/connection-manager/index.js.map +1 -1
- package/dist/src/content-routing/index.js +1 -1
- package/dist/src/content-routing/index.js.map +1 -1
- package/dist/src/errors.d.ts +0 -2
- package/dist/src/errors.d.ts.map +1 -1
- package/dist/src/errors.js +0 -2
- package/dist/src/errors.js.map +1 -1
- package/dist/src/get-peer.d.ts.map +1 -1
- package/dist/src/get-peer.js +0 -3
- package/dist/src/get-peer.js.map +1 -1
- package/dist/src/index.d.ts +5 -6
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/libp2p.d.ts +1 -2
- package/dist/src/libp2p.d.ts.map +1 -1
- package/dist/src/libp2p.js +23 -54
- package/dist/src/libp2p.js.map +1 -1
- package/dist/src/peer-routing.d.ts +5 -1
- package/dist/src/peer-routing.d.ts.map +1 -1
- package/dist/src/peer-routing.js +11 -8
- package/dist/src/peer-routing.js.map +1 -1
- package/dist/src/registrar.d.ts +3 -0
- package/dist/src/registrar.d.ts.map +1 -1
- package/dist/src/registrar.js +3 -3
- package/dist/src/registrar.js.map +1 -1
- package/dist/src/transport-manager.d.ts +3 -1
- package/dist/src/transport-manager.d.ts.map +1 -1
- package/dist/src/transport-manager.js +10 -10
- package/dist/src/transport-manager.js.map +1 -1
- package/dist/src/upgrader.d.ts +2 -2
- package/dist/src/upgrader.d.ts.map +1 -1
- package/dist/src/upgrader.js +75 -37
- package/dist/src/upgrader.js.map +1 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.d.ts.map +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/version.js.map +1 -1
- package/package.json +34 -106
- package/src/address-manager/index.ts +5 -5
- package/src/components.ts +3 -1
- package/src/connection/index.ts +9 -10
- package/src/connection-manager/auto-dial.ts +21 -21
- package/src/connection-manager/connection-pruner.ts +8 -8
- package/src/connection-manager/constants.defaults.ts +0 -5
- package/src/connection-manager/dial-queue.ts +29 -38
- package/src/connection-manager/index.ts +16 -25
- package/src/content-routing/index.ts +1 -1
- package/src/errors.ts +0 -2
- package/src/get-peer.ts +0 -4
- package/src/index.ts +6 -7
- package/src/libp2p.ts +23 -61
- package/src/peer-routing.ts +15 -10
- package/src/registrar.ts +6 -5
- package/src/transport-manager.ts +12 -12
- package/src/upgrader.ts +100 -40
- package/src/version.ts +1 -1
- package/dist/src/autonat/constants.d.ts +0 -18
- package/dist/src/autonat/constants.d.ts.map +0 -1
- package/dist/src/autonat/constants.js +0 -18
- package/dist/src/autonat/constants.js.map +0 -1
- package/dist/src/autonat/index.d.ts +0 -62
- package/dist/src/autonat/index.d.ts.map +0 -1
- package/dist/src/autonat/index.js +0 -447
- package/dist/src/autonat/index.js.map +0 -1
- package/dist/src/autonat/pb/index.d.ts +0 -57
- package/dist/src/autonat/pb/index.d.ts.map +0 -1
- package/dist/src/autonat/pb/index.js +0 -250
- package/dist/src/autonat/pb/index.js.map +0 -1
- package/dist/src/circuit-relay/constants.d.ts +0 -50
- package/dist/src/circuit-relay/constants.d.ts.map +0 -1
- package/dist/src/circuit-relay/constants.js +0 -56
- package/dist/src/circuit-relay/constants.js.map +0 -1
- package/dist/src/circuit-relay/index.d.ts +0 -55
- package/dist/src/circuit-relay/index.d.ts.map +0 -1
- package/dist/src/circuit-relay/index.js +0 -38
- package/dist/src/circuit-relay/index.js.map +0 -1
- package/dist/src/circuit-relay/pb/index.d.ts +0 -93
- package/dist/src/circuit-relay/pb/index.d.ts.map +0 -1
- package/dist/src/circuit-relay/pb/index.js +0 -425
- package/dist/src/circuit-relay/pb/index.js.map +0 -1
- package/dist/src/circuit-relay/server/advert-service.d.ts +0 -43
- package/dist/src/circuit-relay/server/advert-service.d.ts.map +0 -1
- package/dist/src/circuit-relay/server/advert-service.js +0 -73
- package/dist/src/circuit-relay/server/advert-service.js.map +0 -1
- package/dist/src/circuit-relay/server/index.d.ts +0 -65
- package/dist/src/circuit-relay/server/index.d.ts.map +0 -1
- package/dist/src/circuit-relay/server/index.js +0 -312
- package/dist/src/circuit-relay/server/index.js.map +0 -1
- package/dist/src/circuit-relay/server/reservation-store.d.ts +0 -49
- package/dist/src/circuit-relay/server/reservation-store.d.ts.map +0 -1
- package/dist/src/circuit-relay/server/reservation-store.js +0 -65
- package/dist/src/circuit-relay/server/reservation-store.js.map +0 -1
- package/dist/src/circuit-relay/server/reservation-voucher.d.ts +0 -18
- package/dist/src/circuit-relay/server/reservation-voucher.d.ts.map +0 -1
- package/dist/src/circuit-relay/server/reservation-voucher.js +0 -36
- package/dist/src/circuit-relay/server/reservation-voucher.js.map +0 -1
- package/dist/src/circuit-relay/transport/discovery.d.ts +0 -45
- package/dist/src/circuit-relay/transport/discovery.d.ts.map +0 -1
- package/dist/src/circuit-relay/transport/discovery.js +0 -97
- package/dist/src/circuit-relay/transport/discovery.js.map +0 -1
- package/dist/src/circuit-relay/transport/index.d.ts +0 -57
- package/dist/src/circuit-relay/transport/index.d.ts.map +0 -1
- package/dist/src/circuit-relay/transport/index.js +0 -276
- package/dist/src/circuit-relay/transport/index.js.map +0 -1
- package/dist/src/circuit-relay/transport/listener.d.ts +0 -9
- package/dist/src/circuit-relay/transport/listener.d.ts.map +0 -1
- package/dist/src/circuit-relay/transport/listener.js +0 -66
- package/dist/src/circuit-relay/transport/listener.js.map +0 -1
- package/dist/src/circuit-relay/transport/reservation-store.d.ts +0 -72
- package/dist/src/circuit-relay/transport/reservation-store.d.ts.map +0 -1
- package/dist/src/circuit-relay/transport/reservation-store.js +0 -209
- package/dist/src/circuit-relay/transport/reservation-store.js.map +0 -1
- package/dist/src/circuit-relay/utils.d.ts +0 -13
- package/dist/src/circuit-relay/utils.d.ts.map +0 -1
- package/dist/src/circuit-relay/utils.js +0 -108
- package/dist/src/circuit-relay/utils.js.map +0 -1
- package/dist/src/dcutr/dcutr.d.ts +0 -43
- package/dist/src/dcutr/dcutr.d.ts.map +0 -1
- package/dist/src/dcutr/dcutr.js +0 -313
- package/dist/src/dcutr/dcutr.js.map +0 -1
- package/dist/src/dcutr/index.d.ts +0 -92
- package/dist/src/dcutr/index.d.ts.map +0 -1
- package/dist/src/dcutr/index.js +0 -63
- package/dist/src/dcutr/index.js.map +0 -1
- package/dist/src/dcutr/pb/message.d.ts +0 -20
- package/dist/src/dcutr/pb/message.d.ts.map +0 -1
- package/dist/src/dcutr/pb/message.js +0 -77
- package/dist/src/dcutr/pb/message.js.map +0 -1
- package/dist/src/dcutr/utils.d.ts +0 -8
- package/dist/src/dcutr/utils.d.ts.map +0 -1
- package/dist/src/dcutr/utils.js +0 -27
- package/dist/src/dcutr/utils.js.map +0 -1
- package/dist/src/fetch/constants.d.ts +0 -3
- package/dist/src/fetch/constants.d.ts.map +0 -1
- package/dist/src/fetch/constants.js +0 -4
- package/dist/src/fetch/constants.js.map +0 -1
- package/dist/src/fetch/index.d.ts +0 -61
- package/dist/src/fetch/index.d.ts.map +0 -1
- package/dist/src/fetch/index.js +0 -205
- package/dist/src/fetch/index.js.map +0 -1
- package/dist/src/fetch/pb/proto.d.ts +0 -28
- package/dist/src/fetch/pb/proto.d.ts.map +0 -1
- package/dist/src/fetch/pb/proto.js +0 -120
- package/dist/src/fetch/pb/proto.js.map +0 -1
- package/dist/src/identify/consts.d.ts +0 -10
- package/dist/src/identify/consts.d.ts.map +0 -1
- package/dist/src/identify/consts.js +0 -11
- package/dist/src/identify/consts.js.map +0 -1
- package/dist/src/identify/identify.d.ts +0 -54
- package/dist/src/identify/identify.d.ts.map +0 -1
- package/dist/src/identify/identify.js +0 -447
- package/dist/src/identify/identify.js.map +0 -1
- package/dist/src/identify/index.d.ts +0 -72
- package/dist/src/identify/index.d.ts.map +0 -1
- package/dist/src/identify/index.js +0 -15
- package/dist/src/identify/index.js.map +0 -1
- package/dist/src/identify/pb/message.d.ts +0 -17
- package/dist/src/identify/pb/message.d.ts.map +0 -1
- package/dist/src/identify/pb/message.js +0 -98
- package/dist/src/identify/pb/message.js.map +0 -1
- package/dist/src/insecure/index.d.ts +0 -26
- package/dist/src/insecure/index.d.ts.map +0 -1
- package/dist/src/insecure/index.js +0 -110
- package/dist/src/insecure/index.js.map +0 -1
- package/dist/src/insecure/pb/proto.d.ts +0 -30
- package/dist/src/insecure/pb/proto.d.ts.map +0 -1
- package/dist/src/insecure/pb/proto.js +0 -127
- package/dist/src/insecure/pb/proto.js.map +0 -1
- package/dist/src/ping/constants.d.ts +0 -9
- package/dist/src/ping/constants.d.ts.map +0 -1
- package/dist/src/ping/constants.js +0 -15
- package/dist/src/ping/constants.js.map +0 -1
- package/dist/src/ping/index.d.ts +0 -24
- package/dist/src/ping/index.d.ts.map +0 -1
- package/dist/src/ping/index.js +0 -115
- package/dist/src/ping/index.js.map +0 -1
- package/dist/src/pnet/crypto.d.ts +0 -18
- package/dist/src/pnet/crypto.d.ts.map +0 -1
- package/dist/src/pnet/crypto.js +0 -60
- package/dist/src/pnet/crypto.js.map +0 -1
- package/dist/src/pnet/errors.d.ts +0 -6
- package/dist/src/pnet/errors.d.ts.map +0 -1
- package/dist/src/pnet/errors.js +0 -6
- package/dist/src/pnet/errors.js.map +0 -1
- package/dist/src/pnet/index.d.ts +0 -31
- package/dist/src/pnet/index.d.ts.map +0 -1
- package/dist/src/pnet/index.js +0 -97
- package/dist/src/pnet/index.js.map +0 -1
- package/dist/src/pnet/key-generator.d.ts +0 -11
- package/dist/src/pnet/key-generator.d.ts.map +0 -1
- package/dist/src/pnet/key-generator.js +0 -22
- package/dist/src/pnet/key-generator.js.map +0 -1
- package/dist/src/upnp-nat/index.d.ts +0 -71
- package/dist/src/upnp-nat/index.d.ts.map +0 -1
- package/dist/src/upnp-nat/index.js +0 -136
- package/dist/src/upnp-nat/index.js.map +0 -1
- package/dist/src/utils/peer-job-queue.d.ts +0 -33
- package/dist/src/utils/peer-job-queue.d.ts.map +0 -1
- package/dist/src/utils/peer-job-queue.js +0 -82
- package/dist/src/utils/peer-job-queue.js.map +0 -1
- package/dist/typedoc-urls.json +0 -71
- package/src/autonat/constants.ts +0 -19
- package/src/autonat/index.ts +0 -597
- package/src/autonat/pb/index.proto +0 -35
- package/src/autonat/pb/index.ts +0 -320
- package/src/circuit-relay/constants.ts +0 -72
- package/src/circuit-relay/index.ts +0 -59
- package/src/circuit-relay/pb/index.proto +0 -67
- package/src/circuit-relay/pb/index.ts +0 -539
- package/src/circuit-relay/server/advert-service.ts +0 -108
- package/src/circuit-relay/server/index.ts +0 -443
- package/src/circuit-relay/server/reservation-store.ts +0 -116
- package/src/circuit-relay/server/reservation-voucher.ts +0 -51
- package/src/circuit-relay/transport/discovery.ts +0 -136
- package/src/circuit-relay/transport/index.ts +0 -396
- package/src/circuit-relay/transport/listener.ts +0 -97
- package/src/circuit-relay/transport/reservation-store.ts +0 -312
- package/src/circuit-relay/utils.ts +0 -136
- package/src/dcutr/dcutr.ts +0 -378
- package/src/dcutr/index.ts +0 -102
- package/src/dcutr/pb/message.proto +0 -12
- package/src/dcutr/pb/message.ts +0 -96
- package/src/dcutr/utils.ts +0 -33
- package/src/fetch/README.md +0 -41
- package/src/fetch/constants.ts +0 -3
- package/src/fetch/index.ts +0 -315
- package/src/fetch/pb/proto.proto +0 -15
- package/src/fetch/pb/proto.ts +0 -153
- package/src/identify/README.md +0 -13
- package/src/identify/consts.ts +0 -12
- package/src/identify/identify.ts +0 -561
- package/src/identify/index.ts +0 -90
- package/src/identify/pb/message.proto +0 -30
- package/src/identify/pb/message.ts +0 -126
- package/src/insecure/index.ts +0 -138
- package/src/insecure/pb/proto.proto +0 -18
- package/src/insecure/pb/proto.ts +0 -161
- package/src/ping/constants.ts +0 -15
- package/src/ping/index.ts +0 -170
- package/src/pnet/README.md +0 -68
- package/src/pnet/crypto.ts +0 -67
- package/src/pnet/errors.ts +0 -5
- package/src/pnet/index.ts +0 -126
- package/src/pnet/key-generator.ts +0 -23
- package/src/upnp-nat/index.ts +0 -212
- package/src/utils/peer-job-queue.ts +0 -119
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "libp2p",
|
|
3
|
-
"version": "0.46.
|
|
3
|
+
"version": "0.46.21-0b4a2ee79",
|
|
4
4
|
"description": "JavaScript implementation of libp2p, a modular peer to peer network stack",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
|
-
"homepage": "https://github.com/libp2p/js-libp2p/tree/
|
|
6
|
+
"homepage": "https://github.com/libp2p/js-libp2p/tree/main/packages/libp2p#readme",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "git+https://github.com/libp2p/js-libp2p.git"
|
|
@@ -21,22 +21,6 @@
|
|
|
21
21
|
],
|
|
22
22
|
"type": "module",
|
|
23
23
|
"types": "./dist/src/index.d.ts",
|
|
24
|
-
"typesVersions": {
|
|
25
|
-
"*": {
|
|
26
|
-
"*": [
|
|
27
|
-
"*",
|
|
28
|
-
"dist/*",
|
|
29
|
-
"dist/src/*",
|
|
30
|
-
"dist/src/*/index"
|
|
31
|
-
],
|
|
32
|
-
"src/*": [
|
|
33
|
-
"*",
|
|
34
|
-
"dist/*",
|
|
35
|
-
"dist/src/*",
|
|
36
|
-
"dist/src/*/index"
|
|
37
|
-
]
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
24
|
"files": [
|
|
41
25
|
"src",
|
|
42
26
|
"dist",
|
|
@@ -47,42 +31,6 @@
|
|
|
47
31
|
".": {
|
|
48
32
|
"types": "./dist/src/index.d.ts",
|
|
49
33
|
"import": "./dist/src/index.js"
|
|
50
|
-
},
|
|
51
|
-
"./autonat": {
|
|
52
|
-
"types": "./dist/src/autonat/index.d.ts",
|
|
53
|
-
"import": "./dist/src/autonat/index.js"
|
|
54
|
-
},
|
|
55
|
-
"./circuit-relay": {
|
|
56
|
-
"types": "./dist/src/circuit-relay/index.d.ts",
|
|
57
|
-
"import": "./dist/src/circuit-relay/index.js"
|
|
58
|
-
},
|
|
59
|
-
"./dcutr": {
|
|
60
|
-
"types": "./dist/src/dcutr/index.d.ts",
|
|
61
|
-
"import": "./dist/src/dcutr/index.js"
|
|
62
|
-
},
|
|
63
|
-
"./fetch": {
|
|
64
|
-
"types": "./dist/src/fetch/index.d.ts",
|
|
65
|
-
"import": "./dist/src/fetch/index.js"
|
|
66
|
-
},
|
|
67
|
-
"./identify": {
|
|
68
|
-
"types": "./dist/src/identify/index.d.ts",
|
|
69
|
-
"import": "./dist/src/identify/index.js"
|
|
70
|
-
},
|
|
71
|
-
"./insecure": {
|
|
72
|
-
"types": "./dist/src/insecure/index.d.ts",
|
|
73
|
-
"import": "./dist/src/insecure/index.js"
|
|
74
|
-
},
|
|
75
|
-
"./ping": {
|
|
76
|
-
"types": "./dist/src/ping/index.d.ts",
|
|
77
|
-
"import": "./dist/src/ping/index.js"
|
|
78
|
-
},
|
|
79
|
-
"./pnet": {
|
|
80
|
-
"types": "./dist/src/pnet/index.d.ts",
|
|
81
|
-
"import": "./dist/src/pnet/index.js"
|
|
82
|
-
},
|
|
83
|
-
"./upnp-nat": {
|
|
84
|
-
"types": "./dist/src/upnp-nat/index.d.ts",
|
|
85
|
-
"import": "./dist/src/upnp-nat/index.js"
|
|
86
34
|
}
|
|
87
35
|
},
|
|
88
36
|
"eslintConfig": {
|
|
@@ -103,13 +51,6 @@
|
|
|
103
51
|
"dep-check": "aegir dep-check",
|
|
104
52
|
"prepublishOnly": "node scripts/update-version.js && npm run build",
|
|
105
53
|
"build": "aegir build",
|
|
106
|
-
"generate": "run-s generate:proto:*",
|
|
107
|
-
"generate:proto:autonat": "protons ./src/autonat/pb/index.proto",
|
|
108
|
-
"generate:proto:circuit-relay": "protons ./src/circuit-relay/pb/index.proto",
|
|
109
|
-
"generate:proto:dcutr": "protons ./src/dcutr/pb/message.proto",
|
|
110
|
-
"generate:proto:fetch": "protons ./src/fetch/pb/proto.proto",
|
|
111
|
-
"generate:proto:identify": "protons ./src/identify/pb/message.proto",
|
|
112
|
-
"generate:proto:plaintext": "protons ./src/insecure/pb/proto.proto",
|
|
113
54
|
"test": "aegir test",
|
|
114
55
|
"test:node": "aegir test -t node -f \"./dist/test/**/*.{node,spec}.js\" --cov",
|
|
115
56
|
"test:chrome": "aegir test -t browser -f \"./dist/test/**/*.spec.js\" --cov",
|
|
@@ -120,22 +61,19 @@
|
|
|
120
61
|
"test:interop": "aegir test -t node -f dist/test/interop.js"
|
|
121
62
|
},
|
|
122
63
|
"dependencies": {
|
|
123
|
-
"@
|
|
124
|
-
"@libp2p/
|
|
125
|
-
"@libp2p/interface": "
|
|
126
|
-
"@libp2p/
|
|
127
|
-
"@libp2p/
|
|
128
|
-
"@libp2p/
|
|
129
|
-
"@libp2p/
|
|
130
|
-
"@libp2p/peer-
|
|
131
|
-
"@libp2p/peer-
|
|
132
|
-
"@libp2p/
|
|
133
|
-
"@
|
|
134
|
-
"@
|
|
135
|
-
"@
|
|
136
|
-
"@multiformats/mafmt": "^12.1.2",
|
|
137
|
-
"@multiformats/multiaddr": "^12.1.5",
|
|
138
|
-
"@multiformats/multiaddr-matcher": "^1.0.0",
|
|
64
|
+
"@libp2p/crypto": "2.0.8-0b4a2ee79",
|
|
65
|
+
"@libp2p/interface": "0.1.6-0b4a2ee79",
|
|
66
|
+
"@libp2p/interface-internal": "0.1.9-0b4a2ee79",
|
|
67
|
+
"@libp2p/logger": "3.1.0-0b4a2ee79",
|
|
68
|
+
"@libp2p/multistream-select": "4.0.6-0b4a2ee79",
|
|
69
|
+
"@libp2p/peer-collections": "4.0.8-0b4a2ee79",
|
|
70
|
+
"@libp2p/peer-id": "3.0.6-0b4a2ee79",
|
|
71
|
+
"@libp2p/peer-id-factory": "3.0.8-0b4a2ee79",
|
|
72
|
+
"@libp2p/peer-store": "9.0.9-0b4a2ee79",
|
|
73
|
+
"@libp2p/utils": "4.0.7-0b4a2ee79",
|
|
74
|
+
"@multiformats/mafmt": "^12.1.6",
|
|
75
|
+
"@multiformats/multiaddr": "^12.1.10",
|
|
76
|
+
"@multiformats/multiaddr-matcher": "^1.1.0",
|
|
139
77
|
"any-signal": "^4.1.1",
|
|
140
78
|
"datastore-core": "^9.0.1",
|
|
141
79
|
"delay": "^6.0.0",
|
|
@@ -143,55 +81,45 @@
|
|
|
143
81
|
"it-all": "^3.0.2",
|
|
144
82
|
"it-drain": "^3.0.2",
|
|
145
83
|
"it-filter": "^3.0.1",
|
|
146
|
-
"it-first": "^3.0.
|
|
147
|
-
"it-
|
|
148
|
-
"it-length-prefixed": "^9.0.1",
|
|
149
|
-
"it-map": "^3.0.3",
|
|
84
|
+
"it-first": "^3.0.3",
|
|
85
|
+
"it-map": "^3.0.4",
|
|
150
86
|
"it-merge": "^3.0.0",
|
|
151
|
-
"it-pair": "^2.0.6",
|
|
152
|
-
"it-parallel": "^3.0.0",
|
|
153
87
|
"it-pipe": "^3.0.1",
|
|
154
|
-
"it-protobuf-stream": "^1.0.0",
|
|
155
88
|
"it-stream-types": "^2.0.1",
|
|
156
89
|
"merge-options": "^3.0.4",
|
|
157
|
-
"multiformats": "^12.
|
|
90
|
+
"multiformats": "^12.1.3",
|
|
158
91
|
"p-defer": "^4.0.0",
|
|
159
|
-
"p-queue": "^7.
|
|
160
|
-
"
|
|
161
|
-
"private-ip": "^3.0.0",
|
|
162
|
-
"protons-runtime": "^5.0.0",
|
|
92
|
+
"p-queue": "^7.4.1",
|
|
93
|
+
"private-ip": "^3.0.1",
|
|
163
94
|
"rate-limiter-flexible": "^3.0.0",
|
|
164
95
|
"uint8arraylist": "^2.4.3",
|
|
165
|
-
"uint8arrays": "^4.0.6"
|
|
166
|
-
"wherearewe": "^2.0.1",
|
|
167
|
-
"xsalsa20": "^1.1.0"
|
|
96
|
+
"uint8arrays": "^4.0.6"
|
|
168
97
|
},
|
|
169
98
|
"devDependencies": {
|
|
170
99
|
"@chainsafe/libp2p-gossipsub": "^10.0.0",
|
|
171
|
-
"@chainsafe/libp2p-noise": "^13.0.
|
|
100
|
+
"@chainsafe/libp2p-noise": "^13.0.2",
|
|
172
101
|
"@chainsafe/libp2p-yamux": "^5.0.0",
|
|
173
|
-
"@libp2p/bootstrap": "
|
|
102
|
+
"@libp2p/bootstrap": "9.0.12-0b4a2ee79",
|
|
103
|
+
"@libp2p/circuit-relay-v2": "0.0.0-0b4a2ee79",
|
|
174
104
|
"@libp2p/daemon-client": "^7.0.0",
|
|
175
105
|
"@libp2p/daemon-server": "^6.0.0",
|
|
176
|
-
"@libp2p/floodsub": "
|
|
177
|
-
"@libp2p/
|
|
106
|
+
"@libp2p/floodsub": "8.0.13-0b4a2ee79",
|
|
107
|
+
"@libp2p/identify": "0.0.0-0b4a2ee79",
|
|
108
|
+
"@libp2p/interface-compliance-tests": "4.1.5-0b4a2ee79",
|
|
178
109
|
"@libp2p/interop": "^9.0.0",
|
|
179
|
-
"@libp2p/kad-dht": "
|
|
180
|
-
"@libp2p/mdns": "
|
|
181
|
-
"@libp2p/mplex": "
|
|
182
|
-
"@libp2p/
|
|
183
|
-
"@libp2p/
|
|
184
|
-
"@
|
|
110
|
+
"@libp2p/kad-dht": "10.0.15-0b4a2ee79",
|
|
111
|
+
"@libp2p/mdns": "9.0.14-0b4a2ee79",
|
|
112
|
+
"@libp2p/mplex": "9.0.12-0b4a2ee79",
|
|
113
|
+
"@libp2p/plaintext": "0.0.0-0b4a2ee79",
|
|
114
|
+
"@libp2p/tcp": "8.0.13-0b4a2ee79",
|
|
115
|
+
"@libp2p/websockets": "7.0.13-0b4a2ee79",
|
|
185
116
|
"aegir": "^41.0.2",
|
|
186
117
|
"execa": "^8.0.1",
|
|
187
118
|
"go-libp2p": "^1.1.1",
|
|
188
|
-
"it-pushable": "^3.2.
|
|
189
|
-
"it-to-buffer": "^4.0.1",
|
|
190
|
-
"npm-run-all": "^4.1.5",
|
|
119
|
+
"it-pushable": "^3.2.1",
|
|
191
120
|
"p-event": "^6.0.0",
|
|
192
121
|
"p-times": "^4.0.0",
|
|
193
122
|
"p-wait-for": "^5.0.2",
|
|
194
|
-
"protons": "^7.0.2",
|
|
195
123
|
"sinon": "^17.0.0",
|
|
196
124
|
"sinon-ts": "^2.0.0"
|
|
197
125
|
},
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
import { logger } from '@libp2p/logger'
|
|
2
1
|
import { peerIdFromString } from '@libp2p/peer-id'
|
|
3
2
|
import { multiaddr } from '@multiformats/multiaddr'
|
|
4
3
|
import { debounce } from './utils.js'
|
|
5
|
-
import type { Libp2pEvents } from '@libp2p/interface'
|
|
4
|
+
import type { ComponentLogger, Libp2pEvents, Logger } from '@libp2p/interface'
|
|
6
5
|
import type { TypedEventTarget } from '@libp2p/interface/events'
|
|
7
6
|
import type { PeerId } from '@libp2p/interface/peer-id'
|
|
8
7
|
import type { PeerStore } from '@libp2p/interface/peer-store'
|
|
9
8
|
import type { TransportManager } from '@libp2p/interface-internal/transport-manager'
|
|
10
9
|
import type { Multiaddr } from '@multiformats/multiaddr'
|
|
11
10
|
|
|
12
|
-
const log = logger('libp2p:address-manager')
|
|
13
|
-
|
|
14
11
|
export interface AddressManagerInit {
|
|
15
12
|
/**
|
|
16
13
|
* Pass an function in this field to override the list of addresses
|
|
@@ -39,6 +36,7 @@ export interface DefaultAddressManagerComponents {
|
|
|
39
36
|
transportManager: TransportManager
|
|
40
37
|
peerStore: PeerStore
|
|
41
38
|
events: TypedEventTarget<Libp2pEvents>
|
|
39
|
+
logger: ComponentLogger
|
|
42
40
|
}
|
|
43
41
|
|
|
44
42
|
/**
|
|
@@ -75,6 +73,7 @@ function stripPeerId (ma: Multiaddr, peerId: PeerId): Multiaddr {
|
|
|
75
73
|
}
|
|
76
74
|
|
|
77
75
|
export class DefaultAddressManager {
|
|
76
|
+
private readonly log: Logger
|
|
78
77
|
private readonly components: DefaultAddressManagerComponents
|
|
79
78
|
// this is an array to allow for duplicates, e.g. multiples of `/ip4/0.0.0.0/tcp/0`
|
|
80
79
|
private readonly listen: string[]
|
|
@@ -92,6 +91,7 @@ export class DefaultAddressManager {
|
|
|
92
91
|
const { listen = [], announce = [] } = init
|
|
93
92
|
|
|
94
93
|
this.components = components
|
|
94
|
+
this.log = components.logger.forComponent('libp2p:address-manager')
|
|
95
95
|
this.listen = listen.map(ma => ma.toString())
|
|
96
96
|
this.announce = new Set(announce.map(ma => ma.toString()))
|
|
97
97
|
this.observed = new Map()
|
|
@@ -132,7 +132,7 @@ export class DefaultAddressManager {
|
|
|
132
132
|
this.components.peerStore.patch(this.components.peerId, {
|
|
133
133
|
multiaddrs: addrs
|
|
134
134
|
})
|
|
135
|
-
.catch(err => { log.error('error updating addresses', err) })
|
|
135
|
+
.catch(err => { this.log.error('error updating addresses', err) })
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
/**
|
package/src/components.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CodeError } from '@libp2p/interface/errors'
|
|
2
2
|
import { isStartable, type Startable } from '@libp2p/interface/startable'
|
|
3
3
|
import { defaultLogger } from '@libp2p/logger'
|
|
4
|
-
import type { Libp2pEvents, ComponentLogger } from '@libp2p/interface'
|
|
4
|
+
import type { Libp2pEvents, ComponentLogger, NodeInfo } from '@libp2p/interface'
|
|
5
5
|
import type { ConnectionProtector } from '@libp2p/interface/connection'
|
|
6
6
|
import type { ConnectionGater } from '@libp2p/interface/connection-gater'
|
|
7
7
|
import type { ContentRouting } from '@libp2p/interface/content-routing'
|
|
@@ -19,6 +19,7 @@ import type { Datastore } from 'interface-datastore'
|
|
|
19
19
|
|
|
20
20
|
export interface Components extends Record<string, any>, Startable {
|
|
21
21
|
peerId: PeerId
|
|
22
|
+
nodeInfo: NodeInfo
|
|
22
23
|
logger: ComponentLogger
|
|
23
24
|
events: TypedEventTarget<Libp2pEvents>
|
|
24
25
|
addressManager: AddressManager
|
|
@@ -37,6 +38,7 @@ export interface Components extends Record<string, any>, Startable {
|
|
|
37
38
|
|
|
38
39
|
export interface ComponentsInit {
|
|
39
40
|
peerId?: PeerId
|
|
41
|
+
nodeInfo?: NodeInfo
|
|
40
42
|
logger?: ComponentLogger
|
|
41
43
|
events?: TypedEventTarget<Libp2pEvents>
|
|
42
44
|
addressManager?: AddressManager
|
package/src/connection/index.ts
CHANGED
|
@@ -50,6 +50,7 @@ export class ConnectionImpl implements Connection {
|
|
|
50
50
|
public encryption?: string
|
|
51
51
|
public status: ConnectionStatus
|
|
52
52
|
public transient: boolean
|
|
53
|
+
public readonly log: Logger
|
|
53
54
|
|
|
54
55
|
/**
|
|
55
56
|
* User provided tags
|
|
@@ -74,8 +75,6 @@ export class ConnectionImpl implements Connection {
|
|
|
74
75
|
*/
|
|
75
76
|
private readonly _getStreams: () => Stream[]
|
|
76
77
|
|
|
77
|
-
readonly #log: Logger
|
|
78
|
-
|
|
79
78
|
/**
|
|
80
79
|
* An implementation of the js-libp2p connection.
|
|
81
80
|
* Any libp2p transport should use an upgrader to return this connection.
|
|
@@ -92,7 +91,7 @@ export class ConnectionImpl implements Connection {
|
|
|
92
91
|
this.multiplexer = init.multiplexer
|
|
93
92
|
this.encryption = init.encryption
|
|
94
93
|
this.transient = init.transient ?? false
|
|
95
|
-
this
|
|
94
|
+
this.log = init.logger.forComponent(`libp2p:connection:${this.direction}:${this.id}`)
|
|
96
95
|
|
|
97
96
|
if (this.remoteAddr.getPeerId() == null) {
|
|
98
97
|
this.remoteAddr = this.remoteAddr.encapsulate(`/p2p/${this.remotePeer}`)
|
|
@@ -151,7 +150,7 @@ export class ConnectionImpl implements Connection {
|
|
|
151
150
|
return
|
|
152
151
|
}
|
|
153
152
|
|
|
154
|
-
this
|
|
153
|
+
this.log('closing connection to %a', this.remoteAddr)
|
|
155
154
|
|
|
156
155
|
this.status = 'closing'
|
|
157
156
|
|
|
@@ -166,35 +165,35 @@ export class ConnectionImpl implements Connection {
|
|
|
166
165
|
}
|
|
167
166
|
|
|
168
167
|
try {
|
|
169
|
-
this
|
|
168
|
+
this.log.trace('closing all streams')
|
|
170
169
|
|
|
171
170
|
// close all streams gracefully - this can throw if we're not multiplexed
|
|
172
171
|
await Promise.all(
|
|
173
172
|
this.streams.map(async s => s.close(options))
|
|
174
173
|
)
|
|
175
174
|
|
|
176
|
-
this
|
|
175
|
+
this.log.trace('closing underlying transport')
|
|
177
176
|
|
|
178
177
|
// close raw connection
|
|
179
178
|
await this._close(options)
|
|
180
179
|
|
|
181
|
-
this
|
|
180
|
+
this.log.trace('updating timeline with close time')
|
|
182
181
|
|
|
183
182
|
this.status = 'closed'
|
|
184
183
|
this.timeline.close = Date.now()
|
|
185
184
|
} catch (err: any) {
|
|
186
|
-
this
|
|
185
|
+
this.log.error('error encountered during graceful close of connection to %a', this.remoteAddr, err)
|
|
187
186
|
this.abort(err)
|
|
188
187
|
}
|
|
189
188
|
}
|
|
190
189
|
|
|
191
190
|
abort (err: Error): void {
|
|
192
|
-
this
|
|
191
|
+
this.log.error('aborting connection to %a due to error', this.remoteAddr, err)
|
|
193
192
|
|
|
194
193
|
this.status = 'closing'
|
|
195
194
|
this.streams.forEach(s => { s.abort(err) })
|
|
196
195
|
|
|
197
|
-
this
|
|
196
|
+
this.log.error('all streams aborted', this.streams.length)
|
|
198
197
|
|
|
199
198
|
// Abort raw connection
|
|
200
199
|
this._abort(err)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PeerMap, PeerSet } from '@libp2p/peer-collections'
|
|
2
|
+
import { PeerJobQueue } from '@libp2p/utils/peer-job-queue'
|
|
2
3
|
import { toString as uint8ArrayToString } from 'uint8arrays/to-string'
|
|
3
|
-
import { PeerJobQueue } from '../utils/peer-job-queue.js'
|
|
4
4
|
import { AUTO_DIAL_CONCURRENCY, AUTO_DIAL_DISCOVERED_PEERS_DEBOUNCE, AUTO_DIAL_INTERVAL, AUTO_DIAL_MAX_QUEUE_LENGTH, AUTO_DIAL_PEER_RETRY_THRESHOLD, AUTO_DIAL_PRIORITY, LAST_DIAL_FAILURE_KEY, MIN_CONNECTIONS } from './constants.js'
|
|
5
5
|
import type { Libp2pEvents, Logger, ComponentLogger } from '@libp2p/interface'
|
|
6
6
|
import type { TypedEventTarget } from '@libp2p/interface/events'
|
|
@@ -48,7 +48,7 @@ export class AutoDial implements Startable {
|
|
|
48
48
|
private autoDialInterval?: ReturnType<typeof setInterval>
|
|
49
49
|
private started: boolean
|
|
50
50
|
private running: boolean
|
|
51
|
-
readonly
|
|
51
|
+
private readonly log: Logger
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
54
|
* Proactively tries to connect to known peers stored in the PeerStore.
|
|
@@ -64,21 +64,21 @@ export class AutoDial implements Startable {
|
|
|
64
64
|
this.autoDialMaxQueueLength = init.maxQueueLength ?? defaultOptions.maxQueueLength
|
|
65
65
|
this.autoDialPeerRetryThresholdMs = init.autoDialPeerRetryThreshold ?? defaultOptions.autoDialPeerRetryThreshold
|
|
66
66
|
this.autoDialDiscoveredPeersDebounce = init.autoDialDiscoveredPeersDebounce ?? defaultOptions.autoDialDiscoveredPeersDebounce
|
|
67
|
-
this
|
|
67
|
+
this.log = components.logger.forComponent('libp2p:connection-manager:auto-dial')
|
|
68
68
|
this.started = false
|
|
69
69
|
this.running = false
|
|
70
70
|
this.queue = new PeerJobQueue({
|
|
71
71
|
concurrency: init.autoDialConcurrency ?? defaultOptions.autoDialConcurrency
|
|
72
72
|
})
|
|
73
73
|
this.queue.addListener('error', (err) => {
|
|
74
|
-
this
|
|
74
|
+
this.log.error('error during auto-dial', err)
|
|
75
75
|
})
|
|
76
76
|
|
|
77
77
|
// check the min connection limit whenever a peer disconnects
|
|
78
78
|
components.events.addEventListener('connection:close', () => {
|
|
79
79
|
this.autoDial()
|
|
80
80
|
.catch(err => {
|
|
81
|
-
this
|
|
81
|
+
this.log.error(err)
|
|
82
82
|
})
|
|
83
83
|
})
|
|
84
84
|
|
|
@@ -93,7 +93,7 @@ export class AutoDial implements Startable {
|
|
|
93
93
|
debounce = setTimeout(() => {
|
|
94
94
|
this.autoDial()
|
|
95
95
|
.catch(err => {
|
|
96
|
-
this
|
|
96
|
+
this.log.error(err)
|
|
97
97
|
})
|
|
98
98
|
}, this.autoDialDiscoveredPeersDebounce)
|
|
99
99
|
})
|
|
@@ -107,7 +107,7 @@ export class AutoDial implements Startable {
|
|
|
107
107
|
this.autoDialInterval = setTimeout(() => {
|
|
108
108
|
this.autoDial()
|
|
109
109
|
.catch(err => {
|
|
110
|
-
this
|
|
110
|
+
this.log.error('error while autodialing', err)
|
|
111
111
|
})
|
|
112
112
|
}, this.autoDialIntervalMs)
|
|
113
113
|
this.started = true
|
|
@@ -116,7 +116,7 @@ export class AutoDial implements Startable {
|
|
|
116
116
|
afterStart (): void {
|
|
117
117
|
this.autoDial()
|
|
118
118
|
.catch(err => {
|
|
119
|
-
this
|
|
119
|
+
this.log.error('error while autodialing', err)
|
|
120
120
|
})
|
|
121
121
|
}
|
|
122
122
|
|
|
@@ -139,24 +139,24 @@ export class AutoDial implements Startable {
|
|
|
139
139
|
// Already has enough connections
|
|
140
140
|
if (numConnections >= this.minConnections) {
|
|
141
141
|
if (this.minConnections > 0) {
|
|
142
|
-
this
|
|
142
|
+
this.log.trace('have enough connections %d/%d', numConnections, this.minConnections)
|
|
143
143
|
}
|
|
144
144
|
return
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
if (this.queue.size > this.autoDialMaxQueueLength) {
|
|
148
|
-
this
|
|
148
|
+
this.log('not enough connections %d/%d but auto dial queue is full', numConnections, this.minConnections)
|
|
149
149
|
return
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
if (this.running) {
|
|
153
|
-
this
|
|
153
|
+
this.log('not enough connections %d/%d - but skipping autodial as it is already running', numConnections, this.minConnections)
|
|
154
154
|
return
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
this.running = true
|
|
158
158
|
|
|
159
|
-
this
|
|
159
|
+
this.log('not enough connections %d/%d - will dial peers to increase the number of connections', numConnections, this.minConnections)
|
|
160
160
|
|
|
161
161
|
const dialQueue = new PeerSet(
|
|
162
162
|
// @ts-expect-error boolean filter removes falsy peer IDs
|
|
@@ -172,25 +172,25 @@ export class AutoDial implements Startable {
|
|
|
172
172
|
(peer) => {
|
|
173
173
|
// Remove peers without addresses
|
|
174
174
|
if (peer.addresses.length === 0) {
|
|
175
|
-
this
|
|
175
|
+
this.log.trace('not autodialing %p because they have no addresses', peer.id)
|
|
176
176
|
return false
|
|
177
177
|
}
|
|
178
178
|
|
|
179
179
|
// remove peers we are already connected to
|
|
180
180
|
if (connections.has(peer.id)) {
|
|
181
|
-
this
|
|
181
|
+
this.log.trace('not autodialing %p because they are already connected', peer.id)
|
|
182
182
|
return false
|
|
183
183
|
}
|
|
184
184
|
|
|
185
185
|
// remove peers we are already dialling
|
|
186
186
|
if (dialQueue.has(peer.id)) {
|
|
187
|
-
this
|
|
187
|
+
this.log.trace('not autodialing %p because they are already being dialed', peer.id)
|
|
188
188
|
return false
|
|
189
189
|
}
|
|
190
190
|
|
|
191
191
|
// remove peers already in the autodial queue
|
|
192
192
|
if (this.queue.hasJob(peer.id)) {
|
|
193
|
-
this
|
|
193
|
+
this.log.trace('not autodialing %p because they are already being autodialed', peer.id)
|
|
194
194
|
return false
|
|
195
195
|
}
|
|
196
196
|
|
|
@@ -249,7 +249,7 @@ export class AutoDial implements Startable {
|
|
|
249
249
|
return Date.now() - lastDialFailureTimestamp > this.autoDialPeerRetryThresholdMs
|
|
250
250
|
})
|
|
251
251
|
|
|
252
|
-
this
|
|
252
|
+
this.log('selected %d/%d peers to dial', peersThatHaveNotFailed.length, peers.length)
|
|
253
253
|
|
|
254
254
|
for (const peer of peersThatHaveNotFailed) {
|
|
255
255
|
this.queue.add(async () => {
|
|
@@ -257,19 +257,19 @@ export class AutoDial implements Startable {
|
|
|
257
257
|
|
|
258
258
|
// Check to see if we still need to auto dial
|
|
259
259
|
if (numConnections >= this.minConnections) {
|
|
260
|
-
this
|
|
260
|
+
this.log('got enough connections now %d/%d', numConnections, this.minConnections)
|
|
261
261
|
this.queue.clear()
|
|
262
262
|
return
|
|
263
263
|
}
|
|
264
264
|
|
|
265
|
-
this
|
|
265
|
+
this.log('connecting to a peerStore stored peer %p', peer.id)
|
|
266
266
|
await this.connectionManager.openConnection(peer.id, {
|
|
267
267
|
priority: this.autoDialPriority
|
|
268
268
|
})
|
|
269
269
|
}, {
|
|
270
270
|
peerId: peer.id
|
|
271
271
|
}).catch(err => {
|
|
272
|
-
this
|
|
272
|
+
this.log.error('could not connect to peerStore stored peer', err)
|
|
273
273
|
})
|
|
274
274
|
}
|
|
275
275
|
|
|
@@ -279,7 +279,7 @@ export class AutoDial implements Startable {
|
|
|
279
279
|
this.autoDialInterval = setTimeout(() => {
|
|
280
280
|
this.autoDial()
|
|
281
281
|
.catch(err => {
|
|
282
|
-
this
|
|
282
|
+
this.log.error('error while autodialing', err)
|
|
283
283
|
})
|
|
284
284
|
}, this.autoDialIntervalMs)
|
|
285
285
|
}
|
|
@@ -32,7 +32,7 @@ export class ConnectionPruner {
|
|
|
32
32
|
private readonly peerStore: PeerStore
|
|
33
33
|
private readonly allow: Multiaddr[]
|
|
34
34
|
private readonly events: TypedEventTarget<Libp2pEvents>
|
|
35
|
-
readonly
|
|
35
|
+
private readonly log: Logger
|
|
36
36
|
|
|
37
37
|
constructor (components: ConnectionPrunerComponents, init: ConnectionPrunerInit = {}) {
|
|
38
38
|
this.maxConnections = init.maxConnections ?? defaultOptions.maxConnections
|
|
@@ -40,13 +40,13 @@ export class ConnectionPruner {
|
|
|
40
40
|
this.connectionManager = components.connectionManager
|
|
41
41
|
this.peerStore = components.peerStore
|
|
42
42
|
this.events = components.events
|
|
43
|
-
this
|
|
43
|
+
this.log = components.logger.forComponent('libp2p:connection-manager:connection-pruner')
|
|
44
44
|
|
|
45
45
|
// check the max connection limit whenever a peer connects
|
|
46
46
|
components.events.addEventListener('connection:open', () => {
|
|
47
47
|
this.maybePruneConnections()
|
|
48
48
|
.catch(err => {
|
|
49
|
-
this
|
|
49
|
+
this.log.error(err)
|
|
50
50
|
})
|
|
51
51
|
})
|
|
52
52
|
}
|
|
@@ -60,12 +60,12 @@ export class ConnectionPruner {
|
|
|
60
60
|
const numConnections = connections.length
|
|
61
61
|
const toPrune = Math.max(numConnections - this.maxConnections, 0)
|
|
62
62
|
|
|
63
|
-
this
|
|
63
|
+
this.log('checking max connections limit %d/%d', numConnections, this.maxConnections)
|
|
64
64
|
if (numConnections <= this.maxConnections) {
|
|
65
65
|
return
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
this
|
|
68
|
+
this.log('max connections limit exceeded %d/%d, pruning %d connection(s)', numConnections, this.maxConnections, toPrune)
|
|
69
69
|
const peerValues = new PeerMap<number>()
|
|
70
70
|
|
|
71
71
|
// work out peer values
|
|
@@ -87,7 +87,7 @@ export class ConnectionPruner {
|
|
|
87
87
|
}, 0))
|
|
88
88
|
} catch (err: any) {
|
|
89
89
|
if (err.code !== 'ERR_NOT_FOUND') {
|
|
90
|
-
this
|
|
90
|
+
this.log.error('error loading peer tags', err)
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
}
|
|
@@ -124,7 +124,7 @@ export class ConnectionPruner {
|
|
|
124
124
|
const toClose = []
|
|
125
125
|
|
|
126
126
|
for (const connection of sortedConnections) {
|
|
127
|
-
this
|
|
127
|
+
this.log('too many connections open - closing a connection to %p', connection.remotePeer)
|
|
128
128
|
// check allow list
|
|
129
129
|
const connectionInAllowList = this.allow.some((ma) => {
|
|
130
130
|
return connection.remoteAddr.toString().startsWith(ma.toString())
|
|
@@ -146,7 +146,7 @@ export class ConnectionPruner {
|
|
|
146
146
|
try {
|
|
147
147
|
await connection.close()
|
|
148
148
|
} catch (err) {
|
|
149
|
-
this
|
|
149
|
+
this.log.error(err)
|
|
150
150
|
}
|
|
151
151
|
})
|
|
152
152
|
)
|
|
@@ -13,11 +13,6 @@ export const INBOUND_UPGRADE_TIMEOUT = 30e3
|
|
|
13
13
|
*/
|
|
14
14
|
export const MAX_PEER_ADDRS_TO_DIAL = 25
|
|
15
15
|
|
|
16
|
-
/**
|
|
17
|
-
* @see https://libp2p.github.io/js-libp2p/interfaces/index._internal_.ConnectionManagerConfig.html#maxParallelDialsPerPeer
|
|
18
|
-
*/
|
|
19
|
-
export const MAX_PARALLEL_DIALS_PER_PEER = 1
|
|
20
|
-
|
|
21
16
|
/**
|
|
22
17
|
* @see https://libp2p.github.io/js-libp2p/interfaces/index._internal_.ConnectionManagerConfig.html#autoDialInterval
|
|
23
18
|
*/
|