libp2p 0.45.9-d2f1eff4 → 0.45.9-daeb43d8
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 +96 -77
- package/dist/index.min.js +28 -28
- package/dist/src/address-manager/index.d.ts +5 -5
- package/dist/src/address-manager/index.d.ts.map +1 -1
- package/dist/src/autonat/index.d.ts +6 -6
- package/dist/src/autonat/index.d.ts.map +1 -1
- package/dist/src/autonat/index.js +3 -3
- package/dist/src/circuit-relay/index.d.ts +1 -1
- package/dist/src/circuit-relay/index.d.ts.map +1 -1
- package/dist/src/circuit-relay/server/advert-service.d.ts +3 -3
- package/dist/src/circuit-relay/server/advert-service.d.ts.map +1 -1
- package/dist/src/circuit-relay/server/advert-service.js +1 -1
- package/dist/src/circuit-relay/server/advert-service.js.map +1 -1
- package/dist/src/circuit-relay/server/index.d.ts +7 -7
- package/dist/src/circuit-relay/server/index.d.ts.map +1 -1
- package/dist/src/circuit-relay/server/index.js +9 -9
- package/dist/src/circuit-relay/server/index.js.map +1 -1
- package/dist/src/circuit-relay/server/reservation-store.d.ts +3 -3
- package/dist/src/circuit-relay/server/reservation-store.d.ts.map +1 -1
- package/dist/src/circuit-relay/server/reservation-voucher.d.ts +2 -2
- package/dist/src/circuit-relay/transport/discovery.d.ts +8 -8
- package/dist/src/circuit-relay/transport/discovery.d.ts.map +1 -1
- package/dist/src/circuit-relay/transport/discovery.js +3 -4
- package/dist/src/circuit-relay/transport/discovery.js.map +1 -1
- package/dist/src/circuit-relay/transport/index.d.ts +10 -10
- package/dist/src/circuit-relay/transport/index.d.ts.map +1 -1
- package/dist/src/circuit-relay/transport/index.js +7 -7
- package/dist/src/circuit-relay/transport/index.js.map +1 -1
- package/dist/src/circuit-relay/transport/listener.d.ts +2 -2
- package/dist/src/circuit-relay/transport/listener.d.ts.map +1 -1
- package/dist/src/circuit-relay/transport/listener.js +3 -3
- package/dist/src/circuit-relay/transport/listener.js.map +1 -1
- package/dist/src/circuit-relay/transport/reservation-store.d.ts +7 -7
- package/dist/src/circuit-relay/transport/reservation-store.d.ts.map +1 -1
- package/dist/src/circuit-relay/transport/reservation-store.js +2 -2
- package/dist/src/circuit-relay/transport/reservation-store.js.map +1 -1
- package/dist/src/circuit-relay/utils.d.ts +1 -1
- package/dist/src/components.d.ts +15 -14
- package/dist/src/components.d.ts.map +1 -1
- package/dist/src/components.js +2 -2
- package/dist/src/components.js.map +1 -1
- package/dist/src/config/connection-gater.browser.d.ts +1 -1
- package/dist/src/config/connection-gater.d.ts +1 -1
- package/dist/src/config.d.ts +1 -2
- package/dist/src/config.d.ts.map +1 -1
- package/dist/src/config.js +2 -2
- package/dist/src/config.js.map +1 -1
- package/dist/src/connection/index.d.ts +4 -4
- package/dist/src/connection/index.d.ts.map +1 -1
- package/dist/src/connection/index.js +3 -3
- package/dist/src/connection/index.js.map +1 -1
- package/dist/src/connection-manager/auto-dial.d.ts +5 -5
- package/dist/src/connection-manager/auto-dial.d.ts.map +1 -1
- package/dist/src/connection-manager/connection-pruner.d.ts +4 -4
- package/dist/src/connection-manager/connection-pruner.d.ts.map +1 -1
- package/dist/src/connection-manager/dial-queue.d.ts +7 -8
- package/dist/src/connection-manager/dial-queue.d.ts.map +1 -1
- package/dist/src/connection-manager/dial-queue.js +6 -6
- package/dist/src/connection-manager/dial-queue.js.map +1 -1
- package/dist/src/connection-manager/index.d.ts +10 -11
- package/dist/src/connection-manager/index.d.ts.map +1 -1
- package/dist/src/connection-manager/index.js +6 -6
- package/dist/src/connection-manager/index.js.map +1 -1
- package/dist/src/content-routing/index.d.ts +5 -5
- package/dist/src/content-routing/index.d.ts.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/content-routing/utils.d.ts +2 -2
- package/dist/src/content-routing/utils.js +1 -1
- package/dist/src/content-routing/utils.js.map +1 -1
- package/dist/src/fetch/index.d.ts +5 -5
- package/dist/src/fetch/index.d.ts.map +1 -1
- package/dist/src/fetch/index.js +1 -1
- package/dist/src/fetch/index.js.map +1 -1
- package/dist/src/get-peer.d.ts +1 -1
- package/dist/src/get-peer.js +2 -2
- package/dist/src/get-peer.js.map +1 -1
- package/dist/src/identify/identify.d.ts +4 -4
- package/dist/src/identify/identify.d.ts.map +1 -1
- package/dist/src/identify/identify.js +3 -3
- package/dist/src/identify/identify.js.map +1 -1
- package/dist/src/identify/index.d.ts +7 -7
- package/dist/src/identify/index.d.ts.map +1 -1
- package/dist/src/index.d.ts +11 -12
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/insecure/index.d.ts +1 -1
- package/dist/src/insecure/index.js +1 -1
- package/dist/src/insecure/index.js.map +1 -1
- package/dist/src/libp2p.d.ts +11 -11
- package/dist/src/libp2p.d.ts.map +1 -1
- package/dist/src/libp2p.js +5 -5
- package/dist/src/libp2p.js.map +1 -1
- package/dist/src/peer-routing.d.ts +5 -5
- package/dist/src/peer-routing.d.ts.map +1 -1
- package/dist/src/peer-routing.js +1 -1
- package/dist/src/peer-routing.js.map +1 -1
- package/dist/src/ping/index.d.ts +4 -4
- package/dist/src/ping/index.d.ts.map +1 -1
- package/dist/src/ping/index.js +1 -1
- package/dist/src/ping/index.js.map +1 -1
- package/dist/src/pnet/index.d.ts +1 -1
- package/dist/src/pnet/index.js +1 -1
- package/dist/src/pnet/index.js.map +1 -1
- package/dist/src/registrar.d.ts +7 -6
- package/dist/src/registrar.d.ts.map +1 -1
- package/dist/src/registrar.js +7 -11
- package/dist/src/registrar.js.map +1 -1
- package/dist/src/transport-manager.d.ts +9 -9
- package/dist/src/transport-manager.d.ts.map +1 -1
- package/dist/src/transport-manager.js +4 -4
- package/dist/src/transport-manager.js.map +1 -1
- package/dist/src/upgrader.d.ts +12 -12
- package/dist/src/upgrader.d.ts.map +1 -1
- package/dist/src/upgrader.js +1 -1
- package/dist/src/upgrader.js.map +1 -1
- package/dist/src/upnp-nat/index.d.ts +4 -4
- package/dist/src/upnp-nat/index.d.ts.map +1 -1
- package/dist/src/upnp-nat/index.js +1 -1
- package/dist/src/upnp-nat/index.js.map +1 -1
- package/dist/src/utils/peer-job-queue.d.ts +1 -1
- package/dist/src/utils/peer-job-queue.js +1 -1
- package/dist/src/utils/peer-job-queue.js.map +1 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/package.json +39 -64
- package/src/address-manager/index.ts +5 -5
- package/src/autonat/index.ts +12 -12
- package/src/circuit-relay/index.ts +1 -1
- package/src/circuit-relay/server/advert-service.ts +3 -3
- package/src/circuit-relay/server/index.ts +17 -17
- package/src/circuit-relay/server/reservation-store.ts +3 -3
- package/src/circuit-relay/server/reservation-voucher.ts +2 -2
- package/src/circuit-relay/transport/discovery.ts +10 -11
- package/src/circuit-relay/transport/index.ts +17 -18
- package/src/circuit-relay/transport/listener.ts +7 -7
- package/src/circuit-relay/transport/reservation-store.ts +9 -9
- package/src/circuit-relay/utils.ts +1 -1
- package/src/components.ts +16 -15
- package/src/config/connection-gater.browser.ts +1 -1
- package/src/config/connection-gater.ts +1 -1
- package/src/config.ts +3 -4
- package/src/connection/index.ts +6 -6
- package/src/connection-manager/auto-dial.ts +5 -5
- package/src/connection-manager/connection-pruner.ts +4 -4
- package/src/connection-manager/dial-queue.ts +13 -14
- package/src/connection-manager/index.ts +16 -17
- package/src/content-routing/index.ts +6 -6
- package/src/content-routing/utils.ts +3 -3
- package/src/fetch/index.ts +7 -7
- package/src/get-peer.ts +3 -3
- package/src/identify/identify.ts +12 -13
- package/src/identify/index.ts +7 -7
- package/src/index.ts +11 -12
- package/src/insecure/index.ts +3 -3
- package/src/libp2p.ts +14 -14
- package/src/peer-routing.ts +6 -6
- package/src/ping/index.ts +7 -7
- package/src/pnet/index.ts +2 -2
- package/src/registrar.ts +14 -17
- package/src/transport-manager.ts +12 -12
- package/src/upgrader.ts +13 -14
- package/src/upnp-nat/index.ts +5 -5
- package/src/utils/peer-job-queue.ts +2 -2
- package/src/version.ts +1 -1
- package/dist/src/pubsub/dummy-pubsub.d.ts +0 -18
- package/dist/src/pubsub/dummy-pubsub.d.ts.map +0 -1
- package/dist/src/pubsub/dummy-pubsub.js +0 -38
- package/dist/src/pubsub/dummy-pubsub.js.map +0 -1
- package/src/pubsub/dummy-pubsub.ts +0 -53
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/upnp-nat/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAe,MAAM,8BAA8B,CAAA;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/upnp-nat/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAe,MAAM,8BAA8B,CAAA;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAA;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,WAAW,MAAM,YAAY,CAAA;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AACpC,OAAO,KAAK,GAAG,MAAM,eAAe,CAAA;AAMpC,MAAM,GAAG,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAA;AACrC,MAAM,WAAW,GAAG,IAAI,CAAA;AAExB,SAAS,QAAQ,CAAE,GAAG,GAAG,IAAI,EAAE,GAAG,GAAG,KAAK;IACxC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAA;AAC1D,CAAC;AA+CD,MAAM,OAAO;IACM,UAAU,CA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|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
2
|
-
import { CodeError } from '@libp2p/
|
|
2
|
+
import { CodeError } from '@libp2p/interface/errors';
|
|
3
3
|
import PQueue from 'p-queue';
|
|
4
4
|
import { codes } from '../errors.js';
|
|
5
5
|
// Port of lower_bound from https://en.cppreference.com/w/cpp/algorithm/lower_bound
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"peer-job-queue.js","sourceRoot":"","sources":["../../../src/utils/peer-job-queue.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAE7D,OAAO,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"peer-job-queue.js","sourceRoot":"","sources":["../../../src/utils/peer-job-queue.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAE7D,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,MAAM,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AAIpC,mFAAmF;AACnF,uEAAuE;AACvE,SAAS,UAAU,CAAK,KAAmB,EAAE,KAAQ,EAAE,UAAkC;IACvF,IAAI,KAAK,GAAG,CAAC,CAAA;IACb,IAAI,KAAK,GAAG,KAAK,CAAC,MAAM,CAAA;IAExB,OAAO,KAAK,GAAG,CAAC,EAAE;QAChB,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAA;QAClC,IAAI,EAAE,GAAG,KAAK,GAAG,IAAI,CAAA;QAErB,IAAI,UAAU,CAAC,KAAK,CAAC,EAAE,CAAE,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE;YACtC,KAAK,GAAG,EAAE,EAAE,CAAA;YACZ,KAAK,IAAI,IAAI,GAAG,CAAC,CAAA;SAClB;aAAM;YACL,KAAK,GAAG,IAAI,CAAA;SACb;KACF;IAED,OAAO,KAAK,CAAA;AACd,CAAC;AAcD;;;GAGG;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AAC,MAAM,CAAC,CAC/E,CAAC,GAAG,CAAC,CAAC,OAAuC,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;SAChE;QAED,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CACvB,CAAC,OAA2C,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,QAAQ,CACvF,CAAC,GAAG,CAAC,CAAC,OAAuC,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;IACjE,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAA;IAC3B,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,YAAa,SAAQ,MAAmD;IACnF,YAAa,UAAgE,EAAE;QAC7E,KAAK,CAAC;YACJ,GAAG,OAAO;YACV,UAAU,EAAE,iBAAiB;SAC9B,CAAC,CAAA;IACJ,CAAC;IAED;;;OAGG;IACH,MAAM,CAAE,MAAc;QACpB,OAAO,IAAI,CAAC,MAAM,CAAC;YACjB,MAAM;SACP,CAAC,GAAG,CAAC,CAAA;IACR,CAAC;CACF"}
|
package/dist/src/version.d.ts
CHANGED
package/dist/src/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "libp2p",
|
|
3
|
-
"version": "0.45.9-
|
|
3
|
+
"version": "0.45.9-daeb43d8",
|
|
4
4
|
"description": "JavaScript implementation of libp2p, a modular peer to peer network stack",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
6
|
"homepage": "https://github.com/libp2p/js-libp2p/tree/master/packages/libp2p#readme",
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
"scripts": {
|
|
96
96
|
"clean": "aegir clean",
|
|
97
97
|
"lint": "aegir lint",
|
|
98
|
-
"dep-check": "aegir dep-check
|
|
98
|
+
"dep-check": "aegir dep-check",
|
|
99
99
|
"prepublishOnly": "node scripts/update-version.js && npm run build",
|
|
100
100
|
"build": "aegir build",
|
|
101
101
|
"generate": "run-s generate:proto:*",
|
|
@@ -115,59 +115,39 @@
|
|
|
115
115
|
},
|
|
116
116
|
"dependencies": {
|
|
117
117
|
"@achingbrain/nat-port-mapper": "^1.0.9",
|
|
118
|
-
"@libp2p/crypto": "
|
|
119
|
-
"@libp2p/interface
|
|
120
|
-
"@libp2p/interface-
|
|
121
|
-
"@libp2p/
|
|
122
|
-
"@libp2p/
|
|
123
|
-
"@libp2p/
|
|
124
|
-
"@libp2p/
|
|
125
|
-
"@libp2p/
|
|
126
|
-
"@libp2p/
|
|
127
|
-
"@libp2p/
|
|
128
|
-
"@libp2p/
|
|
129
|
-
"@libp2p/
|
|
130
|
-
"@
|
|
131
|
-
"@
|
|
132
|
-
"@libp2p/interface-peer-store": "2.0.4-d2f1eff4",
|
|
133
|
-
"@libp2p/interface-pubsub": "4.0.1-d2f1eff4",
|
|
134
|
-
"@libp2p/interface-record": "2.0.7-d2f1eff4",
|
|
135
|
-
"@libp2p/interface-registrar": "2.0.12-d2f1eff4",
|
|
136
|
-
"@libp2p/interface-stream-muxer": "4.1.2-d2f1eff4",
|
|
137
|
-
"@libp2p/interface-transport": "4.0.3-d2f1eff4",
|
|
138
|
-
"@libp2p/interfaces": "3.3.2-d2f1eff4",
|
|
139
|
-
"@libp2p/keychain": "^2.0.0",
|
|
140
|
-
"@libp2p/logger": "^2.1.1",
|
|
141
|
-
"@libp2p/multistream-select": "^3.1.8",
|
|
142
|
-
"@libp2p/peer-collections": "^3.0.1",
|
|
143
|
-
"@libp2p/peer-id": "^2.0.0",
|
|
144
|
-
"@libp2p/peer-id-factory": "^2.0.0",
|
|
145
|
-
"@libp2p/peer-record": "^5.0.0",
|
|
146
|
-
"@libp2p/peer-store": "^8.2.0",
|
|
147
|
-
"@libp2p/topology": "^4.0.1",
|
|
148
|
-
"@libp2p/tracked-map": "^3.0.0",
|
|
149
|
-
"@libp2p/utils": "^3.0.10",
|
|
150
|
-
"@multiformats/mafmt": "^12.0.0",
|
|
151
|
-
"@multiformats/multiaddr": "^12.0.0",
|
|
118
|
+
"@libp2p/crypto": "1.0.17-daeb43d8",
|
|
119
|
+
"@libp2p/interface": "0.0.1-daeb43d8",
|
|
120
|
+
"@libp2p/interface-internal": "0.0.1-daeb43d8",
|
|
121
|
+
"@libp2p/keychain": "2.0.1-daeb43d8",
|
|
122
|
+
"@libp2p/logger": "2.1.1-daeb43d8",
|
|
123
|
+
"@libp2p/multistream-select": "3.1.9-daeb43d8",
|
|
124
|
+
"@libp2p/peer-collections": "3.0.2-daeb43d8",
|
|
125
|
+
"@libp2p/peer-id": "2.0.3-daeb43d8",
|
|
126
|
+
"@libp2p/peer-id-factory": "2.0.3-daeb43d8",
|
|
127
|
+
"@libp2p/peer-record": "5.0.4-daeb43d8",
|
|
128
|
+
"@libp2p/peer-store": "8.2.1-daeb43d8",
|
|
129
|
+
"@libp2p/utils": "3.0.12-daeb43d8",
|
|
130
|
+
"@multiformats/mafmt": "^12.1.2",
|
|
131
|
+
"@multiformats/multiaddr": "^12.1.3",
|
|
152
132
|
"abortable-iterator": "^5.0.1",
|
|
153
133
|
"any-signal": "^4.1.1",
|
|
154
|
-
"datastore-core": "^9.0.
|
|
155
|
-
"interface-datastore": "^8.
|
|
156
|
-
"it-all": "^3.0.
|
|
157
|
-
"it-drain": "^3.0.
|
|
134
|
+
"datastore-core": "^9.0.1",
|
|
135
|
+
"interface-datastore": "^8.2.0",
|
|
136
|
+
"it-all": "^3.0.2",
|
|
137
|
+
"it-drain": "^3.0.2",
|
|
158
138
|
"it-filter": "^3.0.1",
|
|
159
139
|
"it-first": "^3.0.1",
|
|
160
140
|
"it-handshake": "^4.1.3",
|
|
161
141
|
"it-length-prefixed": "^9.0.1",
|
|
162
|
-
"it-map": "^3.0.
|
|
142
|
+
"it-map": "^3.0.3",
|
|
163
143
|
"it-merge": "^3.0.0",
|
|
164
|
-
"it-pair": "^2.0.
|
|
144
|
+
"it-pair": "^2.0.6",
|
|
165
145
|
"it-parallel": "^3.0.0",
|
|
166
146
|
"it-pb-stream": "^4.0.1",
|
|
167
147
|
"it-pipe": "^3.0.1",
|
|
168
148
|
"it-stream-types": "^2.0.1",
|
|
169
149
|
"merge-options": "^3.0.4",
|
|
170
|
-
"multiformats": "^
|
|
150
|
+
"multiformats": "^12.0.1",
|
|
171
151
|
"p-defer": "^4.0.0",
|
|
172
152
|
"p-queue": "^7.3.4",
|
|
173
153
|
"p-retry": "^5.0.0",
|
|
@@ -175,44 +155,39 @@
|
|
|
175
155
|
"protons-runtime": "^5.0.0",
|
|
176
156
|
"rate-limiter-flexible": "^2.3.11",
|
|
177
157
|
"uint8arraylist": "^2.4.3",
|
|
178
|
-
"uint8arrays": "^4.0.
|
|
179
|
-
"wherearewe": "^2.0.
|
|
158
|
+
"uint8arrays": "^4.0.4",
|
|
159
|
+
"wherearewe": "^2.0.1",
|
|
180
160
|
"xsalsa20": "^1.1.0"
|
|
181
161
|
},
|
|
182
162
|
"devDependencies": {
|
|
183
163
|
"@chainsafe/libp2p-gossipsub": "^8.0.0",
|
|
184
164
|
"@chainsafe/libp2p-noise": "^12.0.0",
|
|
185
165
|
"@chainsafe/libp2p-yamux": "^4.0.1",
|
|
186
|
-
"@libp2p/bootstrap": "
|
|
166
|
+
"@libp2p/bootstrap": "8.0.0-daeb43d8",
|
|
187
167
|
"@libp2p/daemon-client": "^6.0.2",
|
|
188
168
|
"@libp2p/daemon-server": "^5.0.2",
|
|
189
|
-
"@libp2p/floodsub": "
|
|
190
|
-
"@libp2p/interface-compliance-tests": "3.0.7-
|
|
191
|
-
"@libp2p/interface-connection-compliance-tests": "2.0.9-d2f1eff4",
|
|
192
|
-
"@libp2p/interface-connection-encrypter-compliance-tests": "5.0.1-d2f1eff4",
|
|
193
|
-
"@libp2p/interface-mocks": "12.0.1-d2f1eff4",
|
|
169
|
+
"@libp2p/floodsub": "7.0.2-daeb43d8",
|
|
170
|
+
"@libp2p/interface-compliance-tests": "3.0.7-daeb43d8",
|
|
194
171
|
"@libp2p/interop": "^8.0.0",
|
|
195
|
-
"@libp2p/kad-dht": "
|
|
196
|
-
"@libp2p/mdns": "
|
|
197
|
-
"@libp2p/mplex": "
|
|
198
|
-
"@libp2p/
|
|
199
|
-
"@libp2p/
|
|
200
|
-
"@libp2p/websockets": "^6.0.1",
|
|
172
|
+
"@libp2p/kad-dht": "9.3.6-daeb43d8",
|
|
173
|
+
"@libp2p/mdns": "8.0.0-daeb43d8",
|
|
174
|
+
"@libp2p/mplex": "8.0.4-daeb43d8",
|
|
175
|
+
"@libp2p/tcp": "7.0.3-daeb43d8",
|
|
176
|
+
"@libp2p/websockets": "6.0.3-daeb43d8",
|
|
201
177
|
"@types/varint": "^6.0.0",
|
|
202
178
|
"@types/xsalsa20": "^1.1.0",
|
|
203
|
-
"aegir": "^39.0.
|
|
204
|
-
"cborg": "^1.8.1",
|
|
179
|
+
"aegir": "^39.0.10",
|
|
205
180
|
"delay": "^6.0.0",
|
|
206
|
-
"execa": "^7.
|
|
207
|
-
"go-libp2p": "^1.
|
|
181
|
+
"execa": "^7.1.1",
|
|
182
|
+
"go-libp2p": "^1.1.1",
|
|
208
183
|
"it-pushable": "^3.0.0",
|
|
209
184
|
"it-to-buffer": "^4.0.1",
|
|
210
185
|
"npm-run-all": "^4.1.5",
|
|
211
|
-
"p-event": "^
|
|
186
|
+
"p-event": "^6.0.0",
|
|
212
187
|
"p-times": "^4.0.0",
|
|
213
|
-
"p-wait-for": "^5.0.
|
|
188
|
+
"p-wait-for": "^5.0.2",
|
|
214
189
|
"protons": "^7.0.2",
|
|
215
|
-
"sinon": "^15.
|
|
190
|
+
"sinon": "^15.1.2",
|
|
216
191
|
"sinon-ts": "^1.0.0"
|
|
217
192
|
},
|
|
218
193
|
"browser": {
|
|
@@ -2,11 +2,11 @@ import { logger } from '@libp2p/logger'
|
|
|
2
2
|
import { peerIdFromString } from '@libp2p/peer-id'
|
|
3
3
|
import { multiaddr } from '@multiformats/multiaddr'
|
|
4
4
|
import { debounce } from './utils.js'
|
|
5
|
-
import type { Libp2pEvents } from '@libp2p/interface
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
8
|
-
import type {
|
|
9
|
-
import type {
|
|
5
|
+
import type { Libp2pEvents } from '@libp2p/interface'
|
|
6
|
+
import type { EventEmitter } from '@libp2p/interface/events'
|
|
7
|
+
import type { PeerId } from '@libp2p/interface/peer-id'
|
|
8
|
+
import type { PeerStore } from '@libp2p/interface/peer-store'
|
|
9
|
+
import type { TransportManager } from '@libp2p/interface-internal/transport-manager'
|
|
10
10
|
import type { Multiaddr } from '@multiformats/multiaddr'
|
|
11
11
|
|
|
12
12
|
const log = logger('libp2p:address-manager')
|
package/src/autonat/index.ts
CHANGED
|
@@ -17,15 +17,15 @@ import {
|
|
|
17
17
|
PROTOCOL_NAME, PROTOCOL_PREFIX, PROTOCOL_VERSION, REFRESH_INTERVAL, STARTUP_DELAY, TIMEOUT
|
|
18
18
|
} from './constants.js'
|
|
19
19
|
import { Message } from './pb/index.js'
|
|
20
|
-
import type {
|
|
21
|
-
import type {
|
|
22
|
-
import type {
|
|
23
|
-
import type {
|
|
24
|
-
import type {
|
|
25
|
-
import type {
|
|
26
|
-
import type {
|
|
27
|
-
import type {
|
|
28
|
-
import type {
|
|
20
|
+
import type { Connection } from '@libp2p/interface/connection'
|
|
21
|
+
import type { PeerId } from '@libp2p/interface/peer-id'
|
|
22
|
+
import type { PeerInfo } from '@libp2p/interface/peer-info'
|
|
23
|
+
import type { PeerRouting } from '@libp2p/interface/peer-routing'
|
|
24
|
+
import type { Startable } from '@libp2p/interface/startable'
|
|
25
|
+
import type { AddressManager } from '@libp2p/interface-internal/address-manager'
|
|
26
|
+
import type { ConnectionManager } from '@libp2p/interface-internal/connection-manager'
|
|
27
|
+
import type { IncomingStreamData, Registrar } from '@libp2p/interface-internal/registrar'
|
|
28
|
+
import type { TransportManager } from '@libp2p/interface-internal/transport-manager'
|
|
29
29
|
|
|
30
30
|
const log = logger('libp2p:autonat')
|
|
31
31
|
|
|
@@ -258,7 +258,7 @@ class DefaultAutoNATService implements Startable {
|
|
|
258
258
|
.filter(ma => {
|
|
259
259
|
const isFromSameHost = ma.toOptions().host === data.connection.remoteAddr.toOptions().host
|
|
260
260
|
|
|
261
|
-
log.trace('request to dial %
|
|
261
|
+
log.trace('request to dial %a was sent from %a is same host %s', ma, data.connection.remoteAddr, isFromSameHost)
|
|
262
262
|
// skip any Multiaddrs where the target node's IP does not match the sending node's IP
|
|
263
263
|
return isFromSameHost
|
|
264
264
|
})
|
|
@@ -281,7 +281,7 @@ class DefaultAutoNATService implements Startable {
|
|
|
281
281
|
.filter(ma => {
|
|
282
282
|
const isSupportedTransport = Boolean(self.components.transportManager.transportForMultiaddr(ma))
|
|
283
283
|
|
|
284
|
-
log.trace('transport for %
|
|
284
|
+
log.trace('transport for %a is supported %s', ma, isSupportedTransport)
|
|
285
285
|
// skip any Multiaddrs that have transports we do not support
|
|
286
286
|
return isSupportedTransport
|
|
287
287
|
})
|
|
@@ -324,7 +324,7 @@ class DefaultAutoNATService implements Startable {
|
|
|
324
324
|
})
|
|
325
325
|
|
|
326
326
|
if (!connection.remoteAddr.equals(multiaddr)) {
|
|
327
|
-
log.error('tried to dial %
|
|
327
|
+
log.error('tried to dial %a but dialed %a', multiaddr, connection.remoteAddr)
|
|
328
328
|
throw new Error('Unexpected remote address')
|
|
329
329
|
}
|
|
330
330
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Limit } from './pb/index.js'
|
|
2
|
-
import type { EventEmitter } from '@libp2p/
|
|
2
|
+
import type { EventEmitter } from '@libp2p/interface/events'
|
|
3
3
|
import type { PeerMap } from '@libp2p/peer-collections'
|
|
4
4
|
import type { Multiaddr } from '@multiformats/multiaddr'
|
|
5
5
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EventEmitter } from '@libp2p/
|
|
1
|
+
import { EventEmitter } from '@libp2p/interface/events'
|
|
2
2
|
import { logger } from '@libp2p/logger'
|
|
3
3
|
import pRetry from 'p-retry'
|
|
4
4
|
import { codes } from '../../errors.js'
|
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
RELAY_RENDEZVOUS_NS
|
|
8
8
|
} from '../constants.js'
|
|
9
9
|
import { namespaceToCid } from '../utils.js'
|
|
10
|
-
import type { ContentRouting } from '@libp2p/interface
|
|
11
|
-
import type { Startable } from '@libp2p/
|
|
10
|
+
import type { ContentRouting } from '@libp2p/interface/content-routing'
|
|
11
|
+
import type { Startable } from '@libp2p/interface/startable'
|
|
12
12
|
|
|
13
13
|
const log = logger('libp2p:circuit-relay:advert-service')
|
|
14
14
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { setMaxListeners } from 'events'
|
|
2
|
-
import { EventEmitter } from '@libp2p/
|
|
2
|
+
import { EventEmitter } from '@libp2p/interface/events'
|
|
3
3
|
import { logger } from '@libp2p/logger'
|
|
4
4
|
import { peerIdFromBytes } from '@libp2p/peer-id'
|
|
5
5
|
import { RecordEnvelope } from '@libp2p/peer-record'
|
|
@@ -19,14 +19,14 @@ import { AdvertService, type AdvertServiceComponents, type AdvertServiceInit } f
|
|
|
19
19
|
import { ReservationStore, type ReservationStoreInit } from './reservation-store.js'
|
|
20
20
|
import { ReservationVoucherRecord } from './reservation-voucher.js'
|
|
21
21
|
import type { CircuitRelayService, RelayReservation } from '../index.js'
|
|
22
|
-
import type {
|
|
23
|
-
import type {
|
|
24
|
-
import type {
|
|
25
|
-
import type {
|
|
26
|
-
import type {
|
|
27
|
-
import type {
|
|
28
|
-
import type {
|
|
29
|
-
import type {
|
|
22
|
+
import type { Connection, Stream } from '@libp2p/interface/connection'
|
|
23
|
+
import type { ConnectionGater } from '@libp2p/interface/connection-gater'
|
|
24
|
+
import type { PeerId } from '@libp2p/interface/peer-id'
|
|
25
|
+
import type { PeerStore } from '@libp2p/interface/peer-store'
|
|
26
|
+
import type { Startable } from '@libp2p/interface/startable'
|
|
27
|
+
import type { AddressManager } from '@libp2p/interface-internal/address-manager'
|
|
28
|
+
import type { ConnectionManager } from '@libp2p/interface-internal/connection-manager'
|
|
29
|
+
import type { IncomingStreamData, Registrar } from '@libp2p/interface-internal/registrar'
|
|
30
30
|
import type { PeerMap } from '@libp2p/peer-collections'
|
|
31
31
|
|
|
32
32
|
const log = logger('libp2p:circuit-relay:server')
|
|
@@ -193,7 +193,7 @@ class CircuitRelayServer extends EventEmitter<RelayServerEvents> implements Star
|
|
|
193
193
|
}
|
|
194
194
|
|
|
195
195
|
async onHop ({ connection, stream }: IncomingStreamData): Promise<void> {
|
|
196
|
-
log('received circuit v2 hop protocol stream from %
|
|
196
|
+
log('received circuit v2 hop protocol stream from %p', connection.remotePeer)
|
|
197
197
|
|
|
198
198
|
const hopTimeoutPromise = pDefer<HopMessage>()
|
|
199
199
|
const timeout = setTimeout(() => {
|
|
@@ -239,7 +239,7 @@ class CircuitRelayServer extends EventEmitter<RelayServerEvents> implements Star
|
|
|
239
239
|
case HopMessage.Type.RESERVE: await this.handleReserve({ stream, request, connection }); break
|
|
240
240
|
case HopMessage.Type.CONNECT: await this.handleConnect({ stream, request, connection }); break
|
|
241
241
|
default: {
|
|
242
|
-
log.error('invalid hop request type %s via peer %
|
|
242
|
+
log.error('invalid hop request type %s via peer %p', request.type, connection.remotePeer)
|
|
243
243
|
stream.pb(HopMessage).write({ type: HopMessage.Type.STATUS, status: Status.UNEXPECTED_MESSAGE })
|
|
244
244
|
}
|
|
245
245
|
}
|
|
@@ -247,7 +247,7 @@ class CircuitRelayServer extends EventEmitter<RelayServerEvents> implements Star
|
|
|
247
247
|
|
|
248
248
|
async handleReserve ({ stream, request, connection }: HopProtocolOptions): Promise<void> {
|
|
249
249
|
const hopstr = stream.pb(HopMessage)
|
|
250
|
-
log('hop reserve request from %
|
|
250
|
+
log('hop reserve request from %p', connection.remotePeer)
|
|
251
251
|
|
|
252
252
|
if (isRelayAddr(connection.remoteAddr)) {
|
|
253
253
|
log.error('relay reservation over circuit connection denied for peer: %p', connection.remotePeer)
|
|
@@ -329,7 +329,7 @@ class CircuitRelayServer extends EventEmitter<RelayServerEvents> implements Star
|
|
|
329
329
|
return
|
|
330
330
|
}
|
|
331
331
|
|
|
332
|
-
log('hop connect request from %
|
|
332
|
+
log('hop connect request from %p', connection.remotePeer)
|
|
333
333
|
|
|
334
334
|
let dstPeer: PeerId
|
|
335
335
|
|
|
@@ -381,7 +381,7 @@ class CircuitRelayServer extends EventEmitter<RelayServerEvents> implements Star
|
|
|
381
381
|
})
|
|
382
382
|
|
|
383
383
|
if (destinationStream == null) {
|
|
384
|
-
log.error('failed to open stream to destination peer %
|
|
384
|
+
log.error('failed to open stream to destination peer %p', destinationConnection?.remotePeer)
|
|
385
385
|
hopstr.write({ type: HopMessage.Type.STATUS, status: Status.CONNECTION_FAILED })
|
|
386
386
|
return
|
|
387
387
|
}
|
|
@@ -414,17 +414,17 @@ class CircuitRelayServer extends EventEmitter<RelayServerEvents> implements Star
|
|
|
414
414
|
try {
|
|
415
415
|
response = await stopstr.read()
|
|
416
416
|
} catch (err) {
|
|
417
|
-
log.error('error parsing stop message response from %
|
|
417
|
+
log.error('error parsing stop message response from %p', connection.remotePeer)
|
|
418
418
|
}
|
|
419
419
|
|
|
420
420
|
if (response == null) {
|
|
421
|
-
log.error('could not read response from %
|
|
421
|
+
log.error('could not read response from %p', connection.remotePeer)
|
|
422
422
|
stream.close()
|
|
423
423
|
return
|
|
424
424
|
}
|
|
425
425
|
|
|
426
426
|
if (response.status === Status.OK) {
|
|
427
|
-
log('stop request to %
|
|
427
|
+
log('stop request to %p was successful', connection.remotePeer)
|
|
428
428
|
return pbstr.unwrap()
|
|
429
429
|
}
|
|
430
430
|
|
|
@@ -2,9 +2,9 @@ import { PeerMap } from '@libp2p/peer-collections'
|
|
|
2
2
|
import { DEFAULT_DATA_LIMIT, DEFAULT_DURATION_LIMIT, DEFAULT_MAX_RESERVATION_CLEAR_INTERVAL, DEFAULT_MAX_RESERVATION_STORE_SIZE, DEFAULT_MAX_RESERVATION_TTL } from '../constants.js'
|
|
3
3
|
import { type Limit, Status } from '../pb/index.js'
|
|
4
4
|
import type { RelayReservation } from '../index.js'
|
|
5
|
-
import type {
|
|
6
|
-
import type {
|
|
7
|
-
import type { Startable } from '@libp2p/
|
|
5
|
+
import type { RecursivePartial } from '@libp2p/interface'
|
|
6
|
+
import type { PeerId } from '@libp2p/interface/peer-id'
|
|
7
|
+
import type { Startable } from '@libp2p/interface/startable'
|
|
8
8
|
import type { Multiaddr } from '@multiformats/multiaddr'
|
|
9
9
|
|
|
10
10
|
export type ReservationStatus = Status.OK | Status.PERMISSION_DENIED | Status.RESERVATION_REFUSED
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReservationVoucher } from '../pb/index.js'
|
|
2
|
-
import type { PeerId } from '@libp2p/interface
|
|
3
|
-
import type { Record } from '@libp2p/interface
|
|
2
|
+
import type { PeerId } from '@libp2p/interface/peer-id'
|
|
3
|
+
import type { Record } from '@libp2p/interface/record'
|
|
4
4
|
|
|
5
5
|
export interface ReservationVoucherOptions {
|
|
6
6
|
relay: PeerId
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import { EventEmitter } from '@libp2p/
|
|
1
|
+
import { EventEmitter } from '@libp2p/interface/events'
|
|
2
2
|
import { logger } from '@libp2p/logger'
|
|
3
|
-
import { createTopology } from '@libp2p/topology'
|
|
4
3
|
import {
|
|
5
4
|
RELAY_RENDEZVOUS_NS,
|
|
6
5
|
RELAY_V2_HOP_CODEC
|
|
7
6
|
} from '../constants.js'
|
|
8
7
|
import { namespaceToCid } from '../utils.js'
|
|
9
|
-
import type {
|
|
10
|
-
import type {
|
|
11
|
-
import type {
|
|
12
|
-
import type {
|
|
13
|
-
import type {
|
|
14
|
-
import type {
|
|
15
|
-
import type {
|
|
8
|
+
import type { ContentRouting } from '@libp2p/interface/content-routing'
|
|
9
|
+
import type { PeerId } from '@libp2p/interface/peer-id'
|
|
10
|
+
import type { PeerStore } from '@libp2p/interface/peer-store'
|
|
11
|
+
import type { Startable } from '@libp2p/interface/startable'
|
|
12
|
+
import type { ConnectionManager } from '@libp2p/interface-internal/connection-manager'
|
|
13
|
+
import type { Registrar } from '@libp2p/interface-internal/registrar'
|
|
14
|
+
import type { TransportManager } from '@libp2p/interface-internal/transport-manager'
|
|
16
15
|
|
|
17
16
|
const log = logger('libp2p:circuit-relay:discover-relays')
|
|
18
17
|
|
|
@@ -57,11 +56,11 @@ export class RelayDiscovery extends EventEmitter<RelayDiscoveryEvents> implement
|
|
|
57
56
|
async start (): Promise<void> {
|
|
58
57
|
// register a topology listener for when new peers are encountered
|
|
59
58
|
// that support the hop protocol
|
|
60
|
-
this.topologyId = await this.registrar.register(RELAY_V2_HOP_CODEC,
|
|
59
|
+
this.topologyId = await this.registrar.register(RELAY_V2_HOP_CODEC, {
|
|
61
60
|
onConnect: (peerId) => {
|
|
62
61
|
this.safeDispatchEvent('relay:discover', { detail: peerId })
|
|
63
62
|
}
|
|
64
|
-
})
|
|
63
|
+
})
|
|
65
64
|
|
|
66
65
|
void this.discover()
|
|
67
66
|
.catch(err => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { CodeError } from '@libp2p/interface/errors'
|
|
2
|
+
import { symbol, type Transport, type CreateListenerOptions, type Listener, type Upgrader } from '@libp2p/interface/transport'
|
|
3
3
|
import { logger } from '@libp2p/logger'
|
|
4
4
|
import { peerIdFromBytes, peerIdFromString } from '@libp2p/peer-id'
|
|
5
5
|
import { streamToMaConnection } from '@libp2p/utils/stream-to-ma-conn'
|
|
@@ -13,17 +13,16 @@ import { StopMessage, HopMessage, Status } from '../pb/index.js'
|
|
|
13
13
|
import { RelayDiscovery, type RelayDiscoveryComponents } from './discovery.js'
|
|
14
14
|
import { createListener } from './listener.js'
|
|
15
15
|
import { type RelayStoreInit, ReservationStore } from './reservation-store.js'
|
|
16
|
-
import type {
|
|
17
|
-
import type { Connection, Stream } from '@libp2p/interface
|
|
18
|
-
import type { ConnectionGater } from '@libp2p/interface
|
|
19
|
-
import type {
|
|
20
|
-
import type {
|
|
21
|
-
import type {
|
|
22
|
-
import type {
|
|
23
|
-
import type {
|
|
24
|
-
import type {
|
|
25
|
-
import type {
|
|
26
|
-
import type { EventEmitter } from '@libp2p/interfaces/events'
|
|
16
|
+
import type { Libp2pEvents, AbortOptions } from '@libp2p/interface'
|
|
17
|
+
import type { Connection, Stream } from '@libp2p/interface/connection'
|
|
18
|
+
import type { ConnectionGater } from '@libp2p/interface/connection-gater'
|
|
19
|
+
import type { ContentRouting } from '@libp2p/interface/content-routing'
|
|
20
|
+
import type { EventEmitter } from '@libp2p/interface/events'
|
|
21
|
+
import type { PeerId } from '@libp2p/interface/peer-id'
|
|
22
|
+
import type { PeerStore } from '@libp2p/interface/peer-store'
|
|
23
|
+
import type { AddressManager } from '@libp2p/interface-internal/address-manager'
|
|
24
|
+
import type { ConnectionManager } from '@libp2p/interface-internal/connection-manager'
|
|
25
|
+
import type { IncomingStreamData, Registrar } from '@libp2p/interface-internal/registrar'
|
|
27
26
|
import type { Multiaddr } from '@multiformats/multiaddr'
|
|
28
27
|
|
|
29
28
|
const log = logger('libp2p:circuit-relay:transport')
|
|
@@ -267,7 +266,7 @@ class CircuitRelayTransport implements Transport {
|
|
|
267
266
|
localAddr: relayAddr.encapsulate(`/p2p-circuit/p2p/${this.peerId.toString()}`)
|
|
268
267
|
})
|
|
269
268
|
|
|
270
|
-
log('new outbound connection %
|
|
269
|
+
log('new outbound connection %a', maConn.remoteAddr)
|
|
271
270
|
return await this.upgrader.upgradeOutbound(maConn)
|
|
272
271
|
} catch (err) {
|
|
273
272
|
log.error(`Circuit relay dial to destination ${destinationPeer.toString()} via relay ${connection.remotePeer.toString()} failed`, err)
|
|
@@ -313,17 +312,17 @@ class CircuitRelayTransport implements Transport {
|
|
|
313
312
|
}
|
|
314
313
|
|
|
315
314
|
const stopstr = pbstr.pb(StopMessage)
|
|
316
|
-
log('new circuit relay v2 stop stream from %
|
|
315
|
+
log('new circuit relay v2 stop stream from %p', connection.remotePeer)
|
|
317
316
|
|
|
318
317
|
// Validate the STOP request has the required input
|
|
319
318
|
if (request.type !== StopMessage.Type.CONNECT) {
|
|
320
|
-
log.error('invalid stop connect request via peer %
|
|
319
|
+
log.error('invalid stop connect request via peer %p', connection.remotePeer)
|
|
321
320
|
stopstr.write({ type: StopMessage.Type.STATUS, status: Status.UNEXPECTED_MESSAGE })
|
|
322
321
|
return
|
|
323
322
|
}
|
|
324
323
|
|
|
325
324
|
if (!isValidStop(request)) {
|
|
326
|
-
log.error('invalid stop connect request via peer %
|
|
325
|
+
log.error('invalid stop connect request via peer %p', connection.remotePeer)
|
|
327
326
|
stopstr.write({ type: StopMessage.Type.STATUS, status: Status.MALFORMED_MESSAGE })
|
|
328
327
|
return
|
|
329
328
|
}
|
|
@@ -347,7 +346,7 @@ class CircuitRelayTransport implements Transport {
|
|
|
347
346
|
|
|
348
347
|
log('new inbound connection %s', maConn.remoteAddr)
|
|
349
348
|
await this.upgrader.upgradeInbound(maConn)
|
|
350
|
-
log('%s connection %
|
|
349
|
+
log('%s connection %a upgraded', 'inbound', maConn.remoteAddr)
|
|
351
350
|
}
|
|
352
351
|
}
|
|
353
352
|
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { CodeError } from '@libp2p/
|
|
2
|
-
import { EventEmitter } from '@libp2p/
|
|
1
|
+
import { CodeError } from '@libp2p/interface/errors'
|
|
2
|
+
import { EventEmitter } from '@libp2p/interface/events'
|
|
3
3
|
import { logger } from '@libp2p/logger'
|
|
4
4
|
import { PeerMap } from '@libp2p/peer-collections'
|
|
5
5
|
import { peerIdFromString } from '@libp2p/peer-id'
|
|
6
6
|
import { multiaddr } from '@multiformats/multiaddr'
|
|
7
7
|
import type { ReservationStore } from './reservation-store.js'
|
|
8
|
-
import type { Connection } from '@libp2p/interface
|
|
9
|
-
import type {
|
|
10
|
-
import type {
|
|
11
|
-
import type {
|
|
8
|
+
import type { Connection } from '@libp2p/interface/connection'
|
|
9
|
+
import type { PeerId } from '@libp2p/interface/peer-id'
|
|
10
|
+
import type { Listener, ListenerEvents } from '@libp2p/interface/transport'
|
|
11
|
+
import type { ConnectionManager } from '@libp2p/interface-internal/connection-manager'
|
|
12
12
|
import type { Multiaddr } from '@multiformats/multiaddr'
|
|
13
13
|
|
|
14
14
|
const log = logger('libp2p:circuit-relay:transport:listener')
|
|
@@ -37,7 +37,7 @@ class CircuitRelayTransportListener extends EventEmitter<ListenerEvents> impleme
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
async listen (addr: Multiaddr): Promise<void> {
|
|
40
|
-
log('listen on %
|
|
40
|
+
log('listen on %a', addr)
|
|
41
41
|
|
|
42
42
|
const relayPeerStr = addr.getPeerId()
|
|
43
43
|
let relayConn: Connection | undefined
|