libp2p 0.45.8 → 0.45.9-05abd49f

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.
Files changed (171) hide show
  1. package/README.md +1 -1
  2. package/dist/index.min.js +28 -28
  3. package/dist/src/address-manager/index.d.ts +5 -5
  4. package/dist/src/address-manager/index.d.ts.map +1 -1
  5. package/dist/src/autonat/index.d.ts +6 -6
  6. package/dist/src/autonat/index.d.ts.map +1 -1
  7. package/dist/src/circuit-relay/index.d.ts +1 -1
  8. package/dist/src/circuit-relay/index.d.ts.map +1 -1
  9. package/dist/src/circuit-relay/server/advert-service.d.ts +3 -3
  10. package/dist/src/circuit-relay/server/advert-service.d.ts.map +1 -1
  11. package/dist/src/circuit-relay/server/advert-service.js +1 -1
  12. package/dist/src/circuit-relay/server/advert-service.js.map +1 -1
  13. package/dist/src/circuit-relay/server/index.d.ts +12 -7
  14. package/dist/src/circuit-relay/server/index.d.ts.map +1 -1
  15. package/dist/src/circuit-relay/server/index.js +10 -2
  16. package/dist/src/circuit-relay/server/index.js.map +1 -1
  17. package/dist/src/circuit-relay/server/reservation-store.d.ts +3 -3
  18. package/dist/src/circuit-relay/server/reservation-store.d.ts.map +1 -1
  19. package/dist/src/circuit-relay/server/reservation-voucher.d.ts +2 -2
  20. package/dist/src/circuit-relay/transport/discovery.d.ts +8 -8
  21. package/dist/src/circuit-relay/transport/discovery.d.ts.map +1 -1
  22. package/dist/src/circuit-relay/transport/discovery.js +3 -4
  23. package/dist/src/circuit-relay/transport/discovery.js.map +1 -1
  24. package/dist/src/circuit-relay/transport/index.d.ts +12 -12
  25. package/dist/src/circuit-relay/transport/index.d.ts.map +1 -1
  26. package/dist/src/circuit-relay/transport/index.js +5 -4
  27. package/dist/src/circuit-relay/transport/index.js.map +1 -1
  28. package/dist/src/circuit-relay/transport/listener.d.ts +2 -2
  29. package/dist/src/circuit-relay/transport/listener.d.ts.map +1 -1
  30. package/dist/src/circuit-relay/transport/listener.js +2 -2
  31. package/dist/src/circuit-relay/transport/listener.js.map +1 -1
  32. package/dist/src/circuit-relay/transport/reservation-store.d.ts +7 -7
  33. package/dist/src/circuit-relay/transport/reservation-store.d.ts.map +1 -1
  34. package/dist/src/circuit-relay/transport/reservation-store.js +1 -1
  35. package/dist/src/circuit-relay/transport/reservation-store.js.map +1 -1
  36. package/dist/src/circuit-relay/utils.d.ts +1 -1
  37. package/dist/src/components.d.ts +15 -14
  38. package/dist/src/components.d.ts.map +1 -1
  39. package/dist/src/components.js +2 -2
  40. package/dist/src/components.js.map +1 -1
  41. package/dist/src/config/connection-gater.browser.d.ts +1 -1
  42. package/dist/src/config/connection-gater.d.ts +1 -1
  43. package/dist/src/config.d.ts +1 -2
  44. package/dist/src/config.d.ts.map +1 -1
  45. package/dist/src/config.js +2 -2
  46. package/dist/src/config.js.map +1 -1
  47. package/dist/src/connection/index.d.ts +4 -4
  48. package/dist/src/connection/index.d.ts.map +1 -1
  49. package/dist/src/connection/index.js +3 -3
  50. package/dist/src/connection/index.js.map +1 -1
  51. package/dist/src/connection-manager/auto-dial.d.ts +5 -5
  52. package/dist/src/connection-manager/auto-dial.d.ts.map +1 -1
  53. package/dist/src/connection-manager/connection-pruner.d.ts +4 -4
  54. package/dist/src/connection-manager/connection-pruner.d.ts.map +1 -1
  55. package/dist/src/connection-manager/dial-queue.d.ts +7 -8
  56. package/dist/src/connection-manager/dial-queue.d.ts.map +1 -1
  57. package/dist/src/connection-manager/dial-queue.js +1 -1
  58. package/dist/src/connection-manager/dial-queue.js.map +1 -1
  59. package/dist/src/connection-manager/index.d.ts +10 -11
  60. package/dist/src/connection-manager/index.d.ts.map +1 -1
  61. package/dist/src/connection-manager/index.js +2 -2
  62. package/dist/src/connection-manager/index.js.map +1 -1
  63. package/dist/src/content-routing/index.d.ts +5 -5
  64. package/dist/src/content-routing/index.d.ts.map +1 -1
  65. package/dist/src/content-routing/index.js +1 -1
  66. package/dist/src/content-routing/index.js.map +1 -1
  67. package/dist/src/content-routing/utils.d.ts +2 -2
  68. package/dist/src/content-routing/utils.js +1 -1
  69. package/dist/src/content-routing/utils.js.map +1 -1
  70. package/dist/src/fetch/index.d.ts +5 -5
  71. package/dist/src/fetch/index.d.ts.map +1 -1
  72. package/dist/src/fetch/index.js +1 -1
  73. package/dist/src/fetch/index.js.map +1 -1
  74. package/dist/src/get-peer.d.ts +1 -1
  75. package/dist/src/get-peer.js +2 -2
  76. package/dist/src/get-peer.js.map +1 -1
  77. package/dist/src/identify/identify.d.ts +4 -4
  78. package/dist/src/identify/identify.d.ts.map +1 -1
  79. package/dist/src/identify/identify.js +1 -1
  80. package/dist/src/identify/identify.js.map +1 -1
  81. package/dist/src/identify/index.d.ts +7 -7
  82. package/dist/src/identify/index.d.ts.map +1 -1
  83. package/dist/src/index.d.ts +11 -12
  84. package/dist/src/index.d.ts.map +1 -1
  85. package/dist/src/index.js.map +1 -1
  86. package/dist/src/insecure/index.d.ts +1 -1
  87. package/dist/src/insecure/index.js +1 -1
  88. package/dist/src/insecure/index.js.map +1 -1
  89. package/dist/src/libp2p.d.ts +11 -11
  90. package/dist/src/libp2p.d.ts.map +1 -1
  91. package/dist/src/libp2p.js +5 -5
  92. package/dist/src/libp2p.js.map +1 -1
  93. package/dist/src/peer-routing.d.ts +5 -5
  94. package/dist/src/peer-routing.d.ts.map +1 -1
  95. package/dist/src/peer-routing.js +1 -1
  96. package/dist/src/peer-routing.js.map +1 -1
  97. package/dist/src/ping/index.d.ts +4 -4
  98. package/dist/src/ping/index.d.ts.map +1 -1
  99. package/dist/src/ping/index.js +1 -1
  100. package/dist/src/ping/index.js.map +1 -1
  101. package/dist/src/pnet/index.d.ts +1 -1
  102. package/dist/src/pnet/index.js +1 -1
  103. package/dist/src/pnet/index.js.map +1 -1
  104. package/dist/src/registrar.d.ts +7 -6
  105. package/dist/src/registrar.d.ts.map +1 -1
  106. package/dist/src/registrar.js +7 -11
  107. package/dist/src/registrar.js.map +1 -1
  108. package/dist/src/transport-manager.d.ts +9 -9
  109. package/dist/src/transport-manager.d.ts.map +1 -1
  110. package/dist/src/transport-manager.js +3 -3
  111. package/dist/src/transport-manager.js.map +1 -1
  112. package/dist/src/upgrader.d.ts +12 -12
  113. package/dist/src/upgrader.d.ts.map +1 -1
  114. package/dist/src/upgrader.js +8 -6
  115. package/dist/src/upgrader.js.map +1 -1
  116. package/dist/src/upnp-nat/index.d.ts +4 -4
  117. package/dist/src/upnp-nat/index.d.ts.map +1 -1
  118. package/dist/src/upnp-nat/index.js +1 -1
  119. package/dist/src/upnp-nat/index.js.map +1 -1
  120. package/dist/src/utils/peer-job-queue.d.ts +1 -1
  121. package/dist/src/utils/peer-job-queue.js +1 -1
  122. package/dist/src/utils/peer-job-queue.js.map +1 -1
  123. package/dist/src/version.d.ts +1 -1
  124. package/dist/src/version.d.ts.map +1 -1
  125. package/dist/src/version.js +1 -1
  126. package/dist/src/version.js.map +1 -1
  127. package/package.json +42 -71
  128. package/src/address-manager/index.ts +5 -5
  129. package/src/autonat/index.ts +9 -9
  130. package/src/circuit-relay/index.ts +1 -1
  131. package/src/circuit-relay/server/advert-service.ts +3 -3
  132. package/src/circuit-relay/server/index.ts +25 -10
  133. package/src/circuit-relay/server/reservation-store.ts +3 -3
  134. package/src/circuit-relay/server/reservation-voucher.ts +2 -2
  135. package/src/circuit-relay/transport/discovery.ts +10 -11
  136. package/src/circuit-relay/transport/index.ts +17 -17
  137. package/src/circuit-relay/transport/listener.ts +6 -6
  138. package/src/circuit-relay/transport/reservation-store.ts +8 -8
  139. package/src/circuit-relay/utils.ts +1 -1
  140. package/src/components.ts +16 -15
  141. package/src/config/connection-gater.browser.ts +1 -1
  142. package/src/config/connection-gater.ts +1 -1
  143. package/src/config.ts +3 -4
  144. package/src/connection/index.ts +6 -6
  145. package/src/connection-manager/auto-dial.ts +5 -5
  146. package/src/connection-manager/connection-pruner.ts +4 -4
  147. package/src/connection-manager/dial-queue.ts +8 -9
  148. package/src/connection-manager/index.ts +12 -13
  149. package/src/content-routing/index.ts +6 -6
  150. package/src/content-routing/utils.ts +3 -3
  151. package/src/fetch/index.ts +7 -7
  152. package/src/get-peer.ts +3 -3
  153. package/src/identify/identify.ts +10 -11
  154. package/src/identify/index.ts +7 -7
  155. package/src/index.ts +11 -12
  156. package/src/insecure/index.ts +3 -3
  157. package/src/libp2p.ts +14 -14
  158. package/src/peer-routing.ts +6 -6
  159. package/src/ping/index.ts +7 -7
  160. package/src/pnet/index.ts +2 -2
  161. package/src/registrar.ts +14 -17
  162. package/src/transport-manager.ts +11 -11
  163. package/src/upgrader.ts +22 -20
  164. package/src/upnp-nat/index.ts +5 -5
  165. package/src/utils/peer-job-queue.ts +2 -2
  166. package/src/version.ts +1 -1
  167. package/dist/src/pubsub/dummy-pubsub.d.ts +0 -18
  168. package/dist/src/pubsub/dummy-pubsub.d.ts.map +0 -1
  169. package/dist/src/pubsub/dummy-pubsub.js +0 -38
  170. package/dist/src/pubsub/dummy-pubsub.js.map +0 -1
  171. package/src/pubsub/dummy-pubsub.ts +0 -53
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "libp2p",
3
- "version": "0.45.8",
3
+ "version": "0.45.9-05abd49f",
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#readme",
6
+ "homepage": "https://github.com/libp2p/js-libp2p/tree/master/packages/libp2p#readme",
7
7
  "repository": {
8
8
  "type": "git",
9
9
  "url": "git+https://github.com/libp2p/js-libp2p.git"
@@ -19,10 +19,6 @@
19
19
  "peer",
20
20
  "peer-to-peer"
21
21
  ],
22
- "engines": {
23
- "node": ">=16.0.0",
24
- "npm": ">=7.0.0"
25
- },
26
22
  "type": "module",
27
23
  "types": "./dist/src/index.d.ts",
28
24
  "typesVersions": {
@@ -72,10 +68,6 @@
72
68
  "types": "./dist/src/insecure/index.d.ts",
73
69
  "import": "./dist/src/insecure/index.js"
74
70
  },
75
- "./upnp-nat": {
76
- "types": "./dist/src/upnp-nat/index.d.ts",
77
- "import": "./dist/src/upnp-nat/index.js"
78
- },
79
71
  "./ping": {
80
72
  "types": "./dist/src/ping/index.d.ts",
81
73
  "import": "./dist/src/ping/index.js"
@@ -83,6 +75,10 @@
83
75
  "./pnet": {
84
76
  "types": "./dist/src/pnet/index.d.ts",
85
77
  "import": "./dist/src/pnet/index.js"
78
+ },
79
+ "./upnp-nat": {
80
+ "types": "./dist/src/upnp-nat/index.d.ts",
81
+ "import": "./dist/src/upnp-nat/index.js"
86
82
  }
87
83
  },
88
84
  "eslintConfig": {
@@ -99,7 +95,7 @@
99
95
  "scripts": {
100
96
  "clean": "aegir clean",
101
97
  "lint": "aegir lint",
102
- "dep-check": "aegir dep-check -i protons",
98
+ "dep-check": "aegir dep-check",
103
99
  "prepublishOnly": "node scripts/update-version.js && npm run build",
104
100
  "build": "aegir build",
105
101
  "generate": "run-s generate:proto:*",
@@ -119,104 +115,79 @@
119
115
  },
120
116
  "dependencies": {
121
117
  "@achingbrain/nat-port-mapper": "^1.0.9",
122
- "@libp2p/crypto": "^1.0.17",
123
- "@libp2p/interface-address-manager": "^3.0.0",
124
- "@libp2p/interface-connection": "^5.0.0",
125
- "@libp2p/interface-connection-encrypter": "^4.0.0",
126
- "@libp2p/interface-connection-gater": "^3.0.0",
127
- "@libp2p/interface-connection-manager": "^3.0.0",
128
- "@libp2p/interface-content-routing": "^2.1.0",
129
- "@libp2p/interface-keychain": "^2.0.4",
130
- "@libp2p/interface-libp2p": "^3.2.0",
131
- "@libp2p/interface-metrics": "^4.0.0",
132
- "@libp2p/interface-peer-discovery": "^2.0.0",
133
- "@libp2p/interface-peer-id": "^2.0.1",
134
- "@libp2p/interface-peer-info": "^1.0.3",
135
- "@libp2p/interface-peer-routing": "^1.1.0",
136
- "@libp2p/interface-peer-store": "^2.0.4",
137
- "@libp2p/interface-pubsub": "^4.0.0",
138
- "@libp2p/interface-record": "^2.0.6",
139
- "@libp2p/interface-registrar": "^2.0.3",
140
- "@libp2p/interface-stream-muxer": "^4.0.0",
141
- "@libp2p/interface-transport": "^4.0.0",
142
- "@libp2p/interfaces": "^3.2.0",
143
- "@libp2p/keychain": "^2.0.0",
144
- "@libp2p/logger": "^2.1.1",
145
- "@libp2p/multistream-select": "^3.1.8",
146
- "@libp2p/peer-collections": "^3.0.0",
147
- "@libp2p/peer-id": "^2.0.0",
148
- "@libp2p/peer-id-factory": "^2.0.0",
149
- "@libp2p/peer-record": "^5.0.0",
150
- "@libp2p/peer-store": "^8.2.0",
151
- "@libp2p/topology": "^4.0.1",
152
- "@libp2p/tracked-map": "^3.0.0",
153
- "@libp2p/utils": "^3.0.10",
154
- "@multiformats/mafmt": "^12.0.0",
155
- "@multiformats/multiaddr": "^12.0.0",
118
+ "@libp2p/crypto": "1.0.17-05abd49f",
119
+ "@libp2p/interface": "0.0.1-05abd49f",
120
+ "@libp2p/interface-internal": "0.0.1-05abd49f",
121
+ "@libp2p/keychain": "2.0.1-05abd49f",
122
+ "@libp2p/logger": "2.1.1-05abd49f",
123
+ "@libp2p/multistream-select": "3.1.9-05abd49f",
124
+ "@libp2p/peer-collections": "3.0.2-05abd49f",
125
+ "@libp2p/peer-id": "2.0.3-05abd49f",
126
+ "@libp2p/peer-id-factory": "2.0.3-05abd49f",
127
+ "@libp2p/peer-record": "5.0.4-05abd49f",
128
+ "@libp2p/peer-store": "8.2.1-05abd49f",
129
+ "@libp2p/utils": "3.0.12-05abd49f",
130
+ "@multiformats/mafmt": "^12.1.2",
131
+ "@multiformats/multiaddr": "^12.1.3",
156
132
  "abortable-iterator": "^5.0.1",
157
133
  "any-signal": "^4.1.1",
158
- "datastore-core": "^9.0.0",
159
- "interface-datastore": "^8.0.0",
160
- "it-all": "^3.0.1",
161
- "it-drain": "^3.0.1",
134
+ "datastore-core": "^9.0.1",
135
+ "interface-datastore": "^8.2.0",
136
+ "it-all": "^3.0.2",
137
+ "it-drain": "^3.0.2",
162
138
  "it-filter": "^3.0.1",
163
139
  "it-first": "^3.0.1",
164
140
  "it-handshake": "^4.1.3",
165
141
  "it-length-prefixed": "^9.0.1",
166
- "it-map": "^3.0.2",
142
+ "it-map": "^3.0.3",
167
143
  "it-merge": "^3.0.0",
168
- "it-pair": "^2.0.2",
144
+ "it-pair": "^2.0.6",
169
145
  "it-parallel": "^3.0.0",
170
146
  "it-pb-stream": "^4.0.1",
171
147
  "it-pipe": "^3.0.1",
172
148
  "it-stream-types": "^2.0.1",
173
149
  "merge-options": "^3.0.4",
174
- "multiformats": "^11.0.0",
150
+ "multiformats": "^12.0.1",
175
151
  "p-defer": "^4.0.0",
176
152
  "p-queue": "^7.3.4",
177
153
  "p-retry": "^5.0.0",
178
154
  "private-ip": "^3.0.0",
179
155
  "protons-runtime": "^5.0.0",
180
156
  "rate-limiter-flexible": "^2.3.11",
181
- "uint8arraylist": "^2.3.2",
182
- "uint8arrays": "^4.0.2",
183
- "wherearewe": "^2.0.0",
157
+ "uint8arraylist": "^2.4.3",
158
+ "uint8arrays": "^4.0.4",
159
+ "wherearewe": "^2.0.1",
184
160
  "xsalsa20": "^1.1.0"
185
161
  },
186
162
  "devDependencies": {
187
163
  "@chainsafe/libp2p-gossipsub": "^8.0.0",
188
164
  "@chainsafe/libp2p-noise": "^12.0.0",
189
165
  "@chainsafe/libp2p-yamux": "^4.0.1",
190
- "@libp2p/bootstrap": "^8.0.0",
166
+ "@libp2p/bootstrap": "8.0.0-05abd49f",
191
167
  "@libp2p/daemon-client": "^6.0.2",
192
168
  "@libp2p/daemon-server": "^5.0.2",
193
169
  "@libp2p/floodsub": "^7.0.1",
194
- "@libp2p/interface-compliance-tests": "^3.0.6",
195
- "@libp2p/interface-connection-compliance-tests": "^2.0.8",
196
- "@libp2p/interface-connection-encrypter-compliance-tests": "^5.0.0",
197
- "@libp2p/interface-mocks": "^12.0.0",
170
+ "@libp2p/interface-compliance-tests": "3.0.7-05abd49f",
198
171
  "@libp2p/interop": "^8.0.0",
199
- "@libp2p/kad-dht": "^9.2.0",
200
- "@libp2p/mdns": "^8.0.0",
201
- "@libp2p/mplex": "^8.0.1",
202
- "@libp2p/pubsub": "^7.0.1",
203
- "@libp2p/tcp": "^7.0.1",
204
- "@libp2p/websockets": "^6.0.1",
172
+ "@libp2p/kad-dht": "9.3.6-05abd49f",
173
+ "@libp2p/mdns": "8.0.0-05abd49f",
174
+ "@libp2p/mplex": "8.0.4-05abd49f",
175
+ "@libp2p/tcp": "7.0.3-05abd49f",
176
+ "@libp2p/websockets": "6.0.3-05abd49f",
205
177
  "@types/varint": "^6.0.0",
206
178
  "@types/xsalsa20": "^1.1.0",
207
- "aegir": "^39.0.5",
208
- "cborg": "^1.8.1",
179
+ "aegir": "^39.0.10",
209
180
  "delay": "^6.0.0",
210
181
  "execa": "^7.0.0",
211
- "go-libp2p": "^1.0.1",
182
+ "go-libp2p": "^1.1.1",
212
183
  "it-pushable": "^3.0.0",
213
184
  "it-to-buffer": "^4.0.1",
214
185
  "npm-run-all": "^4.1.5",
215
- "p-event": "^5.0.1",
186
+ "p-event": "^6.0.0",
216
187
  "p-times": "^4.0.0",
217
188
  "p-wait-for": "^5.0.0",
218
189
  "protons": "^7.0.2",
219
- "sinon": "^15.0.1",
190
+ "sinon": "^15.1.2",
220
191
  "sinon-ts": "^1.0.0"
221
192
  },
222
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-libp2p'
6
- import type { PeerId } from '@libp2p/interface-peer-id'
7
- import type { PeerStore } from '@libp2p/interface-peer-store'
8
- import type { TransportManager } from '@libp2p/interface-transport'
9
- import type { EventEmitter } from '@libp2p/interfaces/events'
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')
@@ -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 { AddressManager } from '@libp2p/interface-address-manager'
21
- import type { Connection } from '@libp2p/interface-connection'
22
- import type { ConnectionManager } from '@libp2p/interface-connection-manager'
23
- import type { PeerId } from '@libp2p/interface-peer-id'
24
- import type { PeerInfo } from '@libp2p/interface-peer-info'
25
- import type { PeerRouting } from '@libp2p/interface-peer-routing'
26
- import type { IncomingStreamData, Registrar } from '@libp2p/interface-registrar'
27
- import type { TransportManager } from '@libp2p/interface-transport'
28
- import type { Startable } from '@libp2p/interfaces/startable'
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
 
@@ -1,5 +1,5 @@
1
1
  import type { Limit } from './pb/index.js'
2
- import type { EventEmitter } from '@libp2p/interfaces/events'
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/interfaces/events'
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-content-routing'
11
- import type { Startable } from '@libp2p/interfaces/startable'
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,11 +1,12 @@
1
1
  import { setMaxListeners } from 'events'
2
- import { EventEmitter } from '@libp2p/interfaces/events'
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'
6
6
  import { type Multiaddr, multiaddr } from '@multiformats/multiaddr'
7
7
  import { pbStream, type ProtobufStream } from 'it-pb-stream'
8
8
  import pDefer from 'p-defer'
9
+ import { MAX_CONNECTIONS } from '../../connection-manager/constants.js'
9
10
  import {
10
11
  CIRCUIT_PROTO_CODE,
11
12
  DEFAULT_HOP_TIMEOUT,
@@ -18,14 +19,14 @@ import { AdvertService, type AdvertServiceComponents, type AdvertServiceInit } f
18
19
  import { ReservationStore, type ReservationStoreInit } from './reservation-store.js'
19
20
  import { ReservationVoucherRecord } from './reservation-voucher.js'
20
21
  import type { CircuitRelayService, RelayReservation } from '../index.js'
21
- import type { AddressManager } from '@libp2p/interface-address-manager'
22
- import type { Connection, Stream } from '@libp2p/interface-connection'
23
- import type { ConnectionGater } from '@libp2p/interface-connection-gater'
24
- import type { ConnectionManager } from '@libp2p/interface-connection-manager'
25
- import type { PeerId } from '@libp2p/interface-peer-id'
26
- import type { PeerStore } from '@libp2p/interface-peer-store'
27
- import type { IncomingStreamData, Registrar } from '@libp2p/interface-registrar'
28
- import type { Startable } from '@libp2p/interfaces/startable'
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'
29
30
  import type { PeerMap } from '@libp2p/peer-collections'
30
31
 
31
32
  const log = logger('libp2p:circuit-relay:server')
@@ -59,6 +60,12 @@ export interface CircuitRelayServerInit {
59
60
  * The maximum number of simultaneous HOP outbound streams that can be open at once
60
61
  */
61
62
  maxOutboundHopStreams?: number
63
+
64
+ /**
65
+ * The maximum number of simultaneous STOP outbound streams that can be open at
66
+ * once. (default: 300)
67
+ */
68
+ maxOutboundStopStreams?: number
62
69
  }
63
70
 
64
71
  export interface HopProtocolOptions {
@@ -87,6 +94,10 @@ export interface RelayServerEvents {
87
94
  'relay:advert:error': CustomEvent<Error>
88
95
  }
89
96
 
97
+ const defaults = {
98
+ maxOutboundStopStreams: MAX_CONNECTIONS
99
+ }
100
+
90
101
  class CircuitRelayServer extends EventEmitter<RelayServerEvents> implements Startable, CircuitRelayService {
91
102
  private readonly registrar: Registrar
92
103
  private readonly peerStore: PeerStore
@@ -101,6 +112,7 @@ class CircuitRelayServer extends EventEmitter<RelayServerEvents> implements Star
101
112
  private readonly shutdownController: AbortController
102
113
  private readonly maxInboundHopStreams?: number
103
114
  private readonly maxOutboundHopStreams?: number
115
+ private readonly maxOutboundStopStreams: number
104
116
 
105
117
  /**
106
118
  * Creates an instance of Relay
@@ -119,6 +131,7 @@ class CircuitRelayServer extends EventEmitter<RelayServerEvents> implements Star
119
131
  this.shutdownController = new AbortController()
120
132
  this.maxInboundHopStreams = init.maxInboundHopStreams
121
133
  this.maxOutboundHopStreams = init.maxOutboundHopStreams
134
+ this.maxOutboundStopStreams = init.maxOutboundStopStreams ?? defaults.maxOutboundStopStreams
122
135
 
123
136
  try {
124
137
  // fails on node < 15.4
@@ -390,7 +403,9 @@ class CircuitRelayServer extends EventEmitter<RelayServerEvents> implements Star
390
403
  request
391
404
  }: StopOptions): Promise<Stream | undefined> {
392
405
  log('starting circuit relay v2 stop request to %s', connection.remotePeer)
393
- const stream = await connection.newStream([RELAY_V2_STOP_CODEC])
406
+ const stream = await connection.newStream([RELAY_V2_STOP_CODEC], {
407
+ maxOutboundStreams: this.maxOutboundStopStreams
408
+ })
394
409
  const pbstr = pbStream(stream)
395
410
  const stopstr = pbstr.pb(StopMessage)
396
411
  stopstr.write(request)
@@ -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 { PeerId } from '@libp2p/interface-peer-id'
6
- import type { RecursivePartial } from '@libp2p/interfaces'
7
- import type { Startable } from '@libp2p/interfaces/startable'
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-peer-id'
3
- import type { Record } from '@libp2p/interface-record'
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/interfaces/events'
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 { ConnectionManager } from '@libp2p/interface-connection-manager'
10
- import type { ContentRouting } from '@libp2p/interface-content-routing'
11
- import type { PeerId } from '@libp2p/interface-peer-id'
12
- import type { PeerStore } from '@libp2p/interface-peer-store'
13
- import type { Registrar } from '@libp2p/interface-registrar'
14
- import type { TransportManager } from '@libp2p/interface-transport'
15
- import type { Startable } from '@libp2p/interfaces/startable'
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, createTopology({
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 { symbol, type Upgrader, type Listener, type Transport, type CreateListenerOptions } from '@libp2p/interface-transport'
2
- import { CodeError } from '@libp2p/interfaces/errors'
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 { AddressManager } from '@libp2p/interface-address-manager'
17
- import type { Connection, Stream } from '@libp2p/interface-connection'
18
- import type { ConnectionGater } from '@libp2p/interface-connection-gater'
19
- import type { ConnectionManager } from '@libp2p/interface-connection-manager'
20
- import type { ContentRouting } from '@libp2p/interface-content-routing'
21
- import type { Libp2pEvents } from '@libp2p/interface-libp2p'
22
- import type { PeerId } from '@libp2p/interface-peer-id'
23
- import type { PeerStore } from '@libp2p/interface-peer-store'
24
- import type { IncomingStreamData, Registrar } from '@libp2p/interface-registrar'
25
- import type { AbortOptions } from '@libp2p/interfaces'
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')
@@ -82,14 +81,15 @@ export interface CircuitRelayTransportInit extends RelayStoreInit {
82
81
 
83
82
  /**
84
83
  * The maximum number of simultaneous STOP outbound streams that can be open at
85
- * once. STOP streams are opened by the relay server so this setting is
86
- * effectively ignored. (default: 32)
84
+ * once. If this transport is used along with the relay server these settings
85
+ * should be set to the same value (default: 300)
87
86
  */
88
87
  maxOutboundStopStreams?: number
89
88
  }
90
89
 
91
90
  const defaults = {
92
- maxInboundStopStreams: MAX_CONNECTIONS
91
+ maxInboundStopStreams: MAX_CONNECTIONS,
92
+ maxOutboundStopStreams: MAX_CONNECTIONS
93
93
  }
94
94
 
95
95
  class CircuitRelayTransport implements Transport {
@@ -115,7 +115,7 @@ class CircuitRelayTransport implements Transport {
115
115
  this.addressManager = components.addressManager
116
116
  this.connectionGater = components.connectionGater
117
117
  this.maxInboundStopStreams = init.maxInboundStopStreams ?? defaults.maxInboundStopStreams
118
- this.maxOutboundStopStreams = init.maxOutboundStopStreams
118
+ this.maxOutboundStopStreams = init.maxOutboundStopStreams ?? defaults.maxOutboundStopStreams
119
119
 
120
120
  if (init.discoverRelays != null && init.discoverRelays > 0) {
121
121
  this.discovery = new RelayDiscovery(components)
@@ -1,14 +1,14 @@
1
- import { CodeError } from '@libp2p/interfaces/errors'
2
- import { EventEmitter } from '@libp2p/interfaces/events'
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-connection'
9
- import type { ConnectionManager } from '@libp2p/interface-connection-manager'
10
- import type { PeerId } from '@libp2p/interface-peer-id'
11
- import type { Listener, ListenerEvents } from '@libp2p/interface-transport'
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')
@@ -1,4 +1,4 @@
1
- import { EventEmitter } from '@libp2p/interfaces/events'
1
+ import { EventEmitter } from '@libp2p/interface/events'
2
2
  import { logger } from '@libp2p/logger'
3
3
  import { PeerMap } from '@libp2p/peer-collections'
4
4
  import { multiaddr } from '@multiformats/multiaddr'
@@ -8,13 +8,13 @@ import { DEFAULT_RESERVATION_CONCURRENCY, RELAY_TAG, RELAY_V2_HOP_CODEC } from '
8
8
  import { HopMessage, Status } from '../pb/index.js'
9
9
  import { getExpirationMilliseconds } from '../utils.js'
10
10
  import type { Reservation } from '../pb/index.js'
11
- import type { Connection } from '@libp2p/interface-connection'
12
- import type { ConnectionManager } from '@libp2p/interface-connection-manager'
13
- import type { Libp2pEvents } from '@libp2p/interface-libp2p'
14
- import type { PeerId } from '@libp2p/interface-peer-id'
15
- import type { PeerStore } from '@libp2p/interface-peer-store'
16
- import type { TransportManager } from '@libp2p/interface-transport'
17
- import type { Startable } from '@libp2p/interfaces/startable'
11
+ import type { Libp2pEvents } from '@libp2p/interface'
12
+ import type { Connection } from '@libp2p/interface/connection'
13
+ import type { PeerId } from '@libp2p/interface/peer-id'
14
+ import type { PeerStore } from '@libp2p/interface/peer-store'
15
+ import type { Startable } from '@libp2p/interface/startable'
16
+ import type { ConnectionManager } from '@libp2p/interface-internal/connection-manager'
17
+ import type { TransportManager } from '@libp2p/interface-internal/transport-manager'
18
18
 
19
19
  const log = logger('libp2p:circuit-relay:transport:reservation-store')
20
20
 
@@ -5,7 +5,7 @@ import { CID } from 'multiformats/cid'
5
5
  import { sha256 } from 'multiformats/hashes/sha2'
6
6
  import { DEFAULT_DATA_LIMIT, DEFAULT_DURATION_LIMIT } from './constants.js'
7
7
  import type { Limit } from './pb/index.js'
8
- import type { Stream } from '@libp2p/interface-connection'
8
+ import type { Stream } from '@libp2p/interface/connection'
9
9
  import type { Source } from 'it-stream-types'
10
10
  import type { Uint8ArrayList } from 'uint8arraylist'
11
11
 
package/src/components.ts CHANGED
@@ -1,18 +1,19 @@
1
- import { CodeError } from '@libp2p/interfaces/errors'
2
- import { isStartable, type Startable } from '@libp2p/interfaces/startable'
3
- import type { AddressManager } from '@libp2p/interface-address-manager'
4
- import type { ConnectionProtector } from '@libp2p/interface-connection'
5
- import type { ConnectionGater } from '@libp2p/interface-connection-gater'
6
- import type { ConnectionManager } from '@libp2p/interface-connection-manager'
7
- import type { ContentRouting } from '@libp2p/interface-content-routing'
8
- import type { Libp2pEvents } from '@libp2p/interface-libp2p'
9
- import type { Metrics } from '@libp2p/interface-metrics'
10
- import type { PeerId } from '@libp2p/interface-peer-id'
11
- import type { PeerRouting } from '@libp2p/interface-peer-routing'
12
- import type { PeerStore } from '@libp2p/interface-peer-store'
13
- import type { Registrar } from '@libp2p/interface-registrar'
14
- import type { TransportManager, Upgrader } from '@libp2p/interface-transport'
15
- import type { EventEmitter } from '@libp2p/interfaces/events'
1
+ import { CodeError } from '@libp2p/interface/errors'
2
+ import { isStartable, type Startable } from '@libp2p/interface/startable'
3
+ import type { Libp2pEvents } from '@libp2p/interface'
4
+ import type { ConnectionProtector } from '@libp2p/interface/connection'
5
+ import type { ConnectionGater } from '@libp2p/interface/connection-gater'
6
+ import type { ContentRouting } from '@libp2p/interface/content-routing'
7
+ import type { EventEmitter } from '@libp2p/interface/events'
8
+ import type { Metrics } from '@libp2p/interface/metrics'
9
+ import type { PeerId } from '@libp2p/interface/peer-id'
10
+ import type { PeerRouting } from '@libp2p/interface/peer-routing'
11
+ import type { PeerStore } from '@libp2p/interface/peer-store'
12
+ import type { Upgrader } from '@libp2p/interface/transport'
13
+ import type { AddressManager } from '@libp2p/interface-internal/address-manager'
14
+ import type { ConnectionManager } from '@libp2p/interface-internal/connection-manager'
15
+ import type { Registrar } from '@libp2p/interface-internal/registrar'
16
+ import type { TransportManager } from '@libp2p/interface-internal/transport-manager'
16
17
  import type { Datastore } from 'interface-datastore'
17
18
 
18
19
  export interface Components extends Record<string, any>, Startable {
@@ -1,5 +1,5 @@
1
1
  import isPrivate from 'private-ip'
2
- import type { ConnectionGater } from '@libp2p/interface-connection-gater'
2
+ import type { ConnectionGater } from '@libp2p/interface/connection-gater'
3
3
  import type { Multiaddr } from '@multiformats/multiaddr'
4
4
 
5
5
  /**
@@ -1,4 +1,4 @@
1
- import type { ConnectionGater } from '@libp2p/interface-connection-gater'
1
+ import type { ConnectionGater } from '@libp2p/interface/connection-gater'
2
2
 
3
3
  /**
4
4
  * Returns a default connection gater implementation that allows everything
package/src/config.ts CHANGED
@@ -1,12 +1,11 @@
1
- import { FaultTolerance } from '@libp2p/interface-transport'
2
- import { CodeError } from '@libp2p/interfaces/errors'
1
+ import { CodeError } from '@libp2p/interface/errors'
2
+ import { FaultTolerance } from '@libp2p/interface/transport'
3
3
  import { publicAddressesFirst } from '@libp2p/utils/address-sort'
4
4
  import { dnsaddrResolver } from '@multiformats/multiaddr/resolvers'
5
5
  import mergeOptions from 'merge-options'
6
6
  import { codes, messages } from './errors.js'
7
7
  import type { Libp2pInit } from './index.js'
8
- import type { ServiceMap } from '@libp2p/interface-libp2p'
9
- import type { RecursivePartial } from '@libp2p/interfaces'
8
+ import type { ServiceMap, RecursivePartial } from '@libp2p/interface'
10
9
  import type { Multiaddr } from '@multiformats/multiaddr'
11
10
 
12
11
  const DefaultConfig: Partial<Libp2pInit> = {