@libp2p/utils 6.7.1 → 6.7.2-a02cb0461

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 (120) hide show
  1. package/README.md +16 -1
  2. package/dist/index.min.js +6 -1
  3. package/dist/index.min.js.map +4 -4
  4. package/dist/src/abstract-message-stream.d.ts +129 -0
  5. package/dist/src/abstract-message-stream.d.ts.map +1 -0
  6. package/dist/src/abstract-message-stream.js +389 -0
  7. package/dist/src/abstract-message-stream.js.map +1 -0
  8. package/dist/src/abstract-multiaddr-connection.d.ts +26 -0
  9. package/dist/src/abstract-multiaddr-connection.d.ts.map +1 -0
  10. package/dist/src/abstract-multiaddr-connection.js +66 -0
  11. package/dist/src/abstract-multiaddr-connection.js.map +1 -0
  12. package/dist/src/abstract-stream-muxer.d.ts +53 -0
  13. package/dist/src/abstract-stream-muxer.d.ts.map +1 -0
  14. package/dist/src/abstract-stream-muxer.js +169 -0
  15. package/dist/src/abstract-stream-muxer.js.map +1 -0
  16. package/dist/src/abstract-stream.d.ts +14 -130
  17. package/dist/src/abstract-stream.d.ts.map +1 -1
  18. package/dist/src/abstract-stream.js +39 -321
  19. package/dist/src/abstract-stream.js.map +1 -1
  20. package/dist/src/errors.d.ts +8 -0
  21. package/dist/src/errors.d.ts.map +1 -1
  22. package/dist/src/errors.js +8 -0
  23. package/dist/src/errors.js.map +1 -1
  24. package/dist/src/index.d.ts +33 -1
  25. package/dist/src/index.d.ts.map +1 -1
  26. package/dist/src/index.js +33 -1
  27. package/dist/src/index.js.map +1 -1
  28. package/dist/src/length-prefixed-decoder.d.ts +37 -0
  29. package/dist/src/length-prefixed-decoder.d.ts.map +1 -0
  30. package/dist/src/length-prefixed-decoder.js +64 -0
  31. package/dist/src/length-prefixed-decoder.js.map +1 -0
  32. package/dist/src/message-queue.d.ts +61 -0
  33. package/dist/src/message-queue.d.ts.map +1 -0
  34. package/dist/src/message-queue.js +93 -0
  35. package/dist/src/message-queue.js.map +1 -0
  36. package/dist/src/mock-muxer.d.ts +57 -0
  37. package/dist/src/mock-muxer.d.ts.map +1 -0
  38. package/dist/src/mock-muxer.js +204 -0
  39. package/dist/src/mock-muxer.js.map +1 -0
  40. package/dist/src/mock-stream.d.ts +31 -0
  41. package/dist/src/mock-stream.d.ts.map +1 -0
  42. package/dist/src/mock-stream.js +69 -0
  43. package/dist/src/mock-stream.js.map +1 -0
  44. package/dist/src/multiaddr/index.d.ts +7 -0
  45. package/dist/src/multiaddr/index.d.ts.map +1 -0
  46. package/dist/src/multiaddr/index.js +7 -0
  47. package/dist/src/multiaddr/index.js.map +1 -0
  48. package/dist/src/multiaddr-connection-pair.d.ts +25 -0
  49. package/dist/src/multiaddr-connection-pair.d.ts.map +1 -0
  50. package/dist/src/multiaddr-connection-pair.js +103 -0
  51. package/dist/src/multiaddr-connection-pair.js.map +1 -0
  52. package/dist/src/queue/index.d.ts +5 -0
  53. package/dist/src/queue/index.d.ts.map +1 -1
  54. package/dist/src/queue/index.js +24 -9
  55. package/dist/src/queue/index.js.map +1 -1
  56. package/dist/src/rate-limiter.d.ts +1 -15
  57. package/dist/src/rate-limiter.d.ts.map +1 -1
  58. package/dist/src/rate-limiter.js +1 -14
  59. package/dist/src/rate-limiter.js.map +1 -1
  60. package/dist/src/socket-writer.browser.d.ts +2 -0
  61. package/dist/src/socket-writer.browser.d.ts.map +1 -0
  62. package/dist/src/socket-writer.browser.js +4 -0
  63. package/dist/src/socket-writer.browser.js.map +1 -0
  64. package/dist/src/socket-writer.d.ts +19 -0
  65. package/dist/src/socket-writer.d.ts.map +1 -0
  66. package/dist/src/socket-writer.js +43 -0
  67. package/dist/src/socket-writer.js.map +1 -0
  68. package/dist/src/stream-pair.d.ts +42 -0
  69. package/dist/src/stream-pair.d.ts.map +1 -0
  70. package/dist/src/stream-pair.js +40 -0
  71. package/dist/src/stream-pair.js.map +1 -0
  72. package/dist/src/stream-utils.d.ts +199 -0
  73. package/dist/src/stream-utils.d.ts.map +1 -0
  74. package/dist/src/stream-utils.js +369 -0
  75. package/dist/src/stream-utils.js.map +1 -0
  76. package/package.json +19 -163
  77. package/src/abstract-message-stream.ts +549 -0
  78. package/src/abstract-multiaddr-connection.ts +93 -0
  79. package/src/abstract-stream-muxer.ts +239 -0
  80. package/src/abstract-stream.ts +51 -464
  81. package/src/errors.ts +10 -0
  82. package/src/index.ts +33 -1
  83. package/src/length-prefixed-decoder.ts +98 -0
  84. package/src/message-queue.ts +156 -0
  85. package/src/mock-muxer.ts +304 -0
  86. package/src/mock-stream.ts +101 -0
  87. package/src/multiaddr/index.ts +6 -0
  88. package/src/multiaddr-connection-pair.ts +147 -0
  89. package/src/queue/index.ts +30 -9
  90. package/src/rate-limiter.ts +3 -30
  91. package/src/socket-writer.browser.ts +3 -0
  92. package/src/socket-writer.ts +64 -0
  93. package/src/stream-pair.ts +90 -0
  94. package/src/stream-utils.ts +874 -0
  95. package/dist/src/abort-options.d.ts +0 -7
  96. package/dist/src/abort-options.d.ts.map +0 -1
  97. package/dist/src/abort-options.js +0 -14
  98. package/dist/src/abort-options.js.map +0 -1
  99. package/dist/src/array-equals.d.ts +0 -24
  100. package/dist/src/array-equals.d.ts.map +0 -1
  101. package/dist/src/array-equals.js +0 -31
  102. package/dist/src/array-equals.js.map +0 -1
  103. package/dist/src/close-source.d.ts +0 -4
  104. package/dist/src/close-source.d.ts.map +0 -1
  105. package/dist/src/close-source.js +0 -11
  106. package/dist/src/close-source.js.map +0 -1
  107. package/dist/src/close.d.ts +0 -21
  108. package/dist/src/close.d.ts.map +0 -1
  109. package/dist/src/close.js +0 -49
  110. package/dist/src/close.js.map +0 -1
  111. package/dist/src/stream-to-ma-conn.d.ts +0 -23
  112. package/dist/src/stream-to-ma-conn.d.ts.map +0 -1
  113. package/dist/src/stream-to-ma-conn.js +0 -75
  114. package/dist/src/stream-to-ma-conn.js.map +0 -1
  115. package/dist/typedoc-urls.json +0 -147
  116. package/src/abort-options.ts +0 -20
  117. package/src/array-equals.ts +0 -34
  118. package/src/close-source.ts +0 -14
  119. package/src/close.ts +0 -65
  120. package/src/stream-to-ma-conn.ts +0 -105
@@ -1,342 +1,60 @@
1
- import { StreamResetError, StreamStateError } from '@libp2p/interface';
2
- import { pushable } from 'it-pushable';
3
- import defer from 'p-defer';
4
- import { raceSignal } from 'race-signal';
5
- import { Uint8ArrayList } from 'uint8arraylist';
6
- import { closeSource } from './close-source.js';
7
- const DEFAULT_SEND_CLOSE_WRITE_TIMEOUT = 5000;
8
- function isPromise(thing) {
9
- if (thing == null) {
10
- return false;
11
- }
12
- return typeof thing.then === 'function' &&
13
- typeof thing.catch === 'function' &&
14
- typeof thing.finally === 'function';
15
- }
16
- export class AbstractStream {
1
+ import { pEvent } from 'p-event';
2
+ import { AbstractMessageStream } from './abstract-message-stream.js';
3
+ export class AbstractStream extends AbstractMessageStream {
17
4
  id;
18
- direction;
19
- timeline;
20
5
  protocol;
21
- metadata;
22
- source;
23
- status;
24
- readStatus;
25
- writeStatus;
26
- log;
27
- sinkController;
28
- sinkEnd;
29
- closed;
30
- endErr;
31
- streamSource;
32
- onEnd;
33
- onCloseRead;
34
- onCloseWrite;
35
- onReset;
36
- onAbort;
37
- sendCloseWriteTimeout;
38
- sendingData;
39
6
  constructor(init) {
40
- this.sinkController = new AbortController();
41
- this.sinkEnd = defer();
42
- this.closed = defer();
43
- this.log = init.log;
44
- // stream status
45
- this.status = 'open';
46
- this.readStatus = 'ready';
47
- this.writeStatus = 'ready';
7
+ super(init);
48
8
  this.id = init.id;
49
- this.metadata = init.metadata ?? {};
50
- this.direction = init.direction;
51
- this.timeline = {
52
- open: Date.now()
53
- };
54
- this.sendCloseWriteTimeout = init.sendCloseWriteTimeout ?? DEFAULT_SEND_CLOSE_WRITE_TIMEOUT;
55
- this.onEnd = init.onEnd;
56
- this.onCloseRead = init.onCloseRead;
57
- this.onCloseWrite = init.onCloseWrite;
58
- this.onReset = init.onReset;
59
- this.onAbort = init.onAbort;
60
- this.source = this.streamSource = pushable({
61
- onEnd: (err) => {
62
- if (err != null) {
63
- this.log.trace('source ended with error', err);
64
- }
65
- else {
66
- this.log.trace('source ended');
67
- }
68
- this.onSourceEnd(err);
69
- }
70
- });
71
- // necessary because the libp2p upgrader wraps the sink function
72
- this.sink = this.sink.bind(this);
73
- }
74
- async sink(source) {
75
- if (this.writeStatus !== 'ready') {
76
- throw new StreamStateError(`writable end state is "${this.writeStatus}" not "ready"`);
77
- }
78
- try {
79
- this.writeStatus = 'writing';
80
- const options = {
81
- signal: this.sinkController.signal
82
- };
83
- if (this.direction === 'outbound') { // If initiator, open a new stream
84
- const res = this.sendNewStream(options);
85
- if (isPromise(res)) {
86
- await res;
87
- }
88
- }
89
- const abortListener = () => {
90
- closeSource(source, this.log);
91
- };
92
- try {
93
- this.sinkController.signal.addEventListener('abort', abortListener);
94
- this.log.trace('sink reading from source');
95
- for await (let data of source) {
96
- data = data instanceof Uint8Array ? new Uint8ArrayList(data) : data;
97
- const res = this.sendData(data, options);
98
- if (isPromise(res)) {
99
- this.sendingData = defer();
100
- await res;
101
- this.sendingData.resolve();
102
- this.sendingData = undefined;
103
- }
104
- }
105
- }
106
- finally {
107
- this.sinkController.signal.removeEventListener('abort', abortListener);
108
- }
109
- this.log.trace('sink finished reading from source, write status is "%s"', this.writeStatus);
110
- if (this.writeStatus === 'writing') {
111
- this.writeStatus = 'closing';
112
- this.log.trace('send close write to remote');
113
- await this.sendCloseWrite({
114
- signal: AbortSignal.timeout(this.sendCloseWriteTimeout)
115
- });
116
- this.writeStatus = 'closed';
117
- }
118
- this.onSinkEnd();
119
- }
120
- catch (err) {
121
- this.log.trace('sink ended with error, calling abort with error', err);
122
- this.abort(err);
123
- throw err;
124
- }
125
- finally {
126
- this.log.trace('resolve sink end');
127
- this.sinkEnd.resolve();
128
- }
129
- }
130
- onSourceEnd(err) {
131
- if (this.timeline.closeRead != null) {
132
- return;
133
- }
134
- this.timeline.closeRead = Date.now();
135
- this.readStatus = 'closed';
136
- if (err != null && this.endErr == null) {
137
- this.endErr = err;
138
- }
139
- this.onCloseRead?.();
140
- if (this.timeline.closeWrite != null) {
141
- this.log.trace('source and sink ended');
142
- this.timeline.close = Date.now();
143
- if (this.status !== 'aborted' && this.status !== 'reset') {
144
- this.status = 'closed';
145
- }
146
- if (this.onEnd != null) {
147
- this.onEnd(this.endErr);
148
- }
149
- this.closed.resolve();
150
- }
151
- else {
152
- this.log.trace('source ended, waiting for sink to end');
153
- }
9
+ this.protocol = init.protocol ?? '';
154
10
  }
155
- onSinkEnd(err) {
156
- if (this.timeline.closeWrite != null) {
157
- return;
158
- }
159
- this.timeline.closeWrite = Date.now();
160
- this.writeStatus = 'closed';
161
- if (err != null && this.endErr == null) {
162
- this.endErr = err;
163
- }
164
- this.onCloseWrite?.();
165
- if (this.timeline.closeRead != null) {
166
- this.log.trace('sink and source ended');
167
- this.timeline.close = Date.now();
168
- if (this.status !== 'aborted' && this.status !== 'reset') {
169
- this.status = 'closed';
170
- }
171
- if (this.onEnd != null) {
172
- this.onEnd(this.endErr);
173
- }
174
- this.closed.resolve();
175
- }
176
- else {
177
- this.log.trace('sink ended, waiting for source to end');
178
- }
179
- }
180
- // Close for both Reading and Writing
181
11
  async close(options) {
182
- if (this.status !== 'open') {
183
- return;
184
- }
185
- this.log.trace('closing gracefully');
186
- this.status = 'closing';
187
- // wait for read and write ends to close
188
- await raceSignal(Promise.all([
189
- this.closeWrite(options),
190
- this.closeRead(options),
191
- this.closed.promise
192
- ]), options?.signal);
193
- this.status = 'closed';
194
- this.log.trace('closed gracefully');
195
- }
196
- async closeRead(options = {}) {
197
- if (this.readStatus === 'closing' || this.readStatus === 'closed') {
198
- return;
199
- }
200
- this.log.trace('closing readable end of stream with starting read status "%s"', this.readStatus);
201
- const readStatus = this.readStatus;
202
- this.readStatus = 'closing';
203
- if (this.status !== 'reset' && this.status !== 'aborted' && this.timeline.closeRead == null) {
204
- this.log.trace('send close read to remote');
205
- await this.sendCloseRead(options);
206
- }
207
- if (readStatus === 'ready') {
208
- this.log.trace('ending internal source queue with %d queued bytes', this.streamSource.readableLength);
209
- this.streamSource.end();
210
- }
211
- this.log.trace('closed readable end of stream');
212
- }
213
- async closeWrite(options = {}) {
214
12
  if (this.writeStatus === 'closing' || this.writeStatus === 'closed') {
215
13
  return;
216
14
  }
217
- this.log.trace('closing writable end of stream with starting write status "%s"', this.writeStatus);
218
- if (this.writeStatus === 'ready') {
219
- this.log.trace('sink was never sunk, sink an empty array');
220
- await raceSignal(this.sink([]), options.signal);
221
- }
222
- if (this.writeStatus === 'writing') {
223
- // try to let sending outgoing data succeed
224
- if (this.sendingData != null) {
225
- await raceSignal(this.sendingData.promise, options.signal);
226
- }
227
- // stop reading from the source passed to `.sink`
228
- this.log.trace('aborting source passed to .sink');
229
- this.sinkController.abort();
230
- await raceSignal(this.sinkEnd.promise, options.signal);
231
- }
232
- this.writeStatus = 'closed';
233
- this.log.trace('closed writable end of stream');
234
- }
235
- /**
236
- * Close immediately for reading and writing and send a reset message (local
237
- * error)
238
- */
239
- abort(err) {
240
- if (this.status === 'closed' || this.status === 'aborted' || this.status === 'reset') {
241
- return;
242
- }
243
- this.log('abort with error', err);
244
- // try to send a reset message
245
- this.log('try to send reset to remote');
246
- const res = this.sendReset();
247
- if (isPromise(res)) {
248
- res.catch((err) => {
249
- this.log.error('error sending reset message', err);
15
+ this.writeStatus = 'closing';
16
+ // if we are currently sending data, wait for all the data to be written
17
+ // into the underlying transport
18
+ if (this.sendingData || this.writeBuffer.byteLength > 0) {
19
+ this.log('waiting for write queue to become idle before closing writable end of stream, %d unsent bytes', this.writeBuffer.byteLength);
20
+ await pEvent(this, 'idle', {
21
+ ...options,
22
+ rejectionEvents: [
23
+ 'close'
24
+ ]
250
25
  });
251
26
  }
252
- this.status = 'aborted';
253
- this.timeline.abort = Date.now();
254
- this._closeSinkAndSource(err);
255
- this.onAbort?.(err);
256
- }
257
- /**
258
- * Receive a reset message - close immediately for reading and writing (remote
259
- * error)
260
- */
261
- reset() {
262
- if (this.status === 'closed' || this.status === 'aborted' || this.status === 'reset') {
263
- return;
264
- }
265
- const err = new StreamResetError('stream reset');
266
- this.status = 'reset';
267
- this.timeline.reset = Date.now();
268
- this._closeSinkAndSource(err);
269
- this.onReset?.();
270
- }
271
- _closeSinkAndSource(err) {
272
- this._closeSink(err);
273
- this._closeSource(err);
274
- }
275
- _closeSink(err) {
276
- // if the sink function is running, cause it to end
277
- if (this.writeStatus === 'writing') {
278
- this.log.trace('end sink source');
279
- this.sinkController.abort();
27
+ // now that the underlying transport has all the data, if the buffer is full
28
+ // wait for it to be emptied
29
+ if (this.writableNeedsDrain) {
30
+ this.log('waiting for write queue to drain before closing writable end of stream, %d unsent bytes, sending %s', this.writeBuffer.byteLength, this.sendingData);
31
+ await pEvent(this, 'drain', {
32
+ ...options,
33
+ rejectionEvents: [
34
+ 'close'
35
+ ]
36
+ });
37
+ this.log('write queue drained, closing writable end of stream, %d unsent bytes, sending %s', this.writeBuffer.byteLength, this.sendingData);
280
38
  }
281
- this.onSinkEnd(err);
282
- }
283
- _closeSource(err) {
284
- // if the source is not ending, end it
285
- if (this.readStatus !== 'closing' && this.readStatus !== 'closed') {
286
- this.log.trace('ending source with %d bytes to be read by consumer', this.streamSource.readableLength);
287
- this.readStatus = 'closing';
288
- this.streamSource.end(err);
39
+ await this.sendCloseWrite(options);
40
+ this.writeStatus = 'closed';
41
+ this.log('closed writable end gracefully');
42
+ if (this.remoteWriteStatus === 'closed') {
43
+ this.onTransportClosed();
289
44
  }
290
45
  }
291
- /**
292
- * The remote closed for writing so we should expect to receive no more
293
- * messages
294
- */
295
- remoteCloseWrite() {
46
+ async closeRead(options) {
296
47
  if (this.readStatus === 'closing' || this.readStatus === 'closed') {
297
- this.log('received remote close write but local source is already closed');
298
48
  return;
299
49
  }
300
- this.log.trace('remote close write');
301
- this._closeSource();
302
- }
303
- /**
304
- * The remote closed for reading so we should not send any more
305
- * messages
306
- */
307
- remoteCloseRead() {
308
- if (this.writeStatus === 'closing' || this.writeStatus === 'closed') {
309
- this.log('received remote close read but local sink is already closed');
310
- return;
50
+ // throw away any unread data
51
+ if (this.readBuffer.byteLength > 0) {
52
+ this.readBuffer.consume(this.readBuffer.byteLength);
311
53
  }
312
- this.log.trace('remote close read');
313
- this._closeSink();
314
- }
315
- /**
316
- * The underlying muxer has closed, no more messages can be sent or will
317
- * be received, close immediately to free up resources
318
- */
319
- destroy() {
320
- if (this.status === 'closed' || this.status === 'aborted' || this.status === 'reset') {
321
- this.log('received destroy but we are already closed');
322
- return;
323
- }
324
- this.log.trace('stream destroyed');
325
- this._closeSinkAndSource();
326
- }
327
- /**
328
- * When an extending class reads data from it's implementation-specific source,
329
- * call this method to allow the stream consumer to read the data.
330
- */
331
- sourcePush(data) {
332
- this.streamSource.push(data);
333
- }
334
- /**
335
- * Returns the amount of unread data - can be used to prevent large amounts of
336
- * data building up when the stream consumer is too slow.
337
- */
338
- sourceReadableLength() {
339
- return this.streamSource.readableLength;
54
+ this.readStatus = 'closing';
55
+ await this.sendCloseRead(options);
56
+ this.readStatus = 'closed';
57
+ this.log('closed readable end gracefully');
340
58
  }
341
59
  }
342
60
  //# sourceMappingURL=abstract-stream.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"abstract-stream.js","sourceRoot":"","sources":["../../src/abstract-stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,KAAK,MAAM,SAAS,CAAA;AAC3B,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAO/C,MAAM,gCAAgC,GAAG,IAAI,CAAA;AA+D7C,SAAS,SAAS,CAAgB,KAAU;IAC1C,IAAI,KAAK,IAAI,IAAI,EAAE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,IAAI,CAAC,WAAW,CAAC,CAAA;QAC7I,CAAC;QAED,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAA;QAElC,IAAI,CAAC,WAAW,GAAG,QAAQ,CAAA;QAE3B,IAAI,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAA;QAE1C,IAAI,IAAI,CAAC,iBAAiB,KAAK,QAAQ,EAAE,CAAC;YACxC,IAAI,CAAC,iBAAiB,EAAE,CAAA;QAC1B,CAAC;IACH,CAAC;IAED,KAAK,CAAC,SAAS,CAAE,OAAsB;QACrC,IAAI,IAAI,CAAC,UAAU,KAAK,SAAS,IAAI,IAAI,CAAC,UAAU,KAAK,QAAQ,EAAE,CAAC;YAClE,OAAM;QACR,CAAC;QAED,6BAA6B;QAC7B,IAAI,IAAI,CAAC,UAAU,CAAC,UAAU,GAAG,CAAC,EAAE,CAAC;YACnC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,CAAA;QACrD,CAAC;QAED,IAAI,CAAC,UAAU,GAAG,SAAS,CAAA;QAE3B,MAAM,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAA;QAEjC,IAAI,CAAC,UAAU,GAAG,QAAQ,CAAA;QAE1B,IAAI,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAA;IAC5C,CAAC;CAaF"}
@@ -13,4 +13,12 @@ export declare class QueueFullError extends Error {
13
13
  static name: string;
14
14
  constructor(message?: string);
15
15
  }
16
+ export declare class UnexpectedEOFError extends Error {
17
+ static name: string;
18
+ name: string;
19
+ }
20
+ export declare class MaxEarlyStreamsError extends Error {
21
+ static name: string;
22
+ name: string;
23
+ }
16
24
  //# sourceMappingURL=errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAE1D;;GAEG;AACH,qBAAa,cAAe,SAAQ,KAAK;IACvC,eAAe,EAAE,MAAM,CAAA;IACvB,YAAY,EAAE,MAAM,CAAA;IACpB,cAAc,EAAE,MAAM,CAAA;IACtB,iBAAiB,EAAE,OAAO,CAAA;gBAEb,OAAO,oBAAwB,EAAE,KAAK,EAAE,iBAAiB;CAQvE;AAED,qBAAa,cAAe,SAAQ,KAAK;IACvC,MAAM,CAAC,IAAI,SAAmB;gBAEjB,OAAO,GAAE,MAA6B;CAIpD"}
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAE1D;;GAEG;AACH,qBAAa,cAAe,SAAQ,KAAK;IACvC,eAAe,EAAE,MAAM,CAAA;IACvB,YAAY,EAAE,MAAM,CAAA;IACpB,cAAc,EAAE,MAAM,CAAA;IACtB,iBAAiB,EAAE,OAAO,CAAA;gBAEb,OAAO,oBAAwB,EAAE,KAAK,EAAE,iBAAiB;CAQvE;AAED,qBAAa,cAAe,SAAQ,KAAK;IACvC,MAAM,CAAC,IAAI,SAAmB;gBAEjB,OAAO,GAAE,MAA6B;CAIpD;AAED,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,MAAM,CAAC,IAAI,SAAuB;IAClC,IAAI,SAAuB;CAC5B;AAED,qBAAa,oBAAqB,SAAQ,KAAK;IAC7C,MAAM,CAAC,IAAI,SAAyB;IACpC,IAAI,SAAyB;CAC9B"}
@@ -22,4 +22,12 @@ export class QueueFullError extends Error {
22
22
  this.name = 'QueueFullError';
23
23
  }
24
24
  }
25
+ export class UnexpectedEOFError extends Error {
26
+ static name = 'UnexpectedEOFError';
27
+ name = 'UnexpectedEOFError';
28
+ }
29
+ export class MaxEarlyStreamsError extends Error {
30
+ static name = 'MaxEarlyStreamsError';
31
+ name = 'MaxEarlyStreamsError';
32
+ }
25
33
  //# sourceMappingURL=errors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,OAAO,cAAe,SAAQ,KAAK;IACvC,eAAe,CAAQ;IACvB,YAAY,CAAQ;IACpB,cAAc,CAAQ;IACtB,iBAAiB,CAAS;IAE1B,YAAa,OAAO,GAAG,qBAAqB,EAAE,KAAwB;QACpE,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAA;QAC5B,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC,eAAe,CAAA;QAC5C,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,YAAY,CAAA;QACtC,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC,cAAc,CAAA;QAC1C,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC,iBAAiB,CAAA;IAClD,CAAC;CACF;AAED,MAAM,OAAO,cAAe,SAAQ,KAAK;IACvC,MAAM,CAAC,IAAI,GAAG,gBAAgB,CAAA;IAE9B,YAAa,UAAkB,oBAAoB;QACjD,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAA;IAC9B,CAAC"}
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,OAAO,cAAe,SAAQ,KAAK;IACvC,eAAe,CAAQ;IACvB,YAAY,CAAQ;IACpB,cAAc,CAAQ;IACtB,iBAAiB,CAAS;IAE1B,YAAa,OAAO,GAAG,qBAAqB,EAAE,KAAwB;QACpE,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAA;QAC5B,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC,eAAe,CAAA;QAC5C,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,YAAY,CAAA;QACtC,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC,cAAc,CAAA;QAC1C,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC,iBAAiB,CAAA;IAClD,CAAC;CACF;AAED,MAAM,OAAO,cAAe,SAAQ,KAAK;IACvC,MAAM,CAAC,IAAI,GAAG,gBAAgB,CAAA;IAE9B,YAAa,UAAkB,oBAAoB;QACjD,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAA;IAC9B,CAAC;;AAGH,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAC3C,MAAM,CAAC,IAAI,GAAG,oBAAoB,CAAA;IAClC,IAAI,GAAG,oBAAoB,CAAA;;AAG7B,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IAC7C,MAAM,CAAC,IAAI,GAAG,sBAAsB,CAAA;IACpC,IAAI,GAAG,sBAAsB,CAAA"}
@@ -3,5 +3,37 @@
3
3
  *
4
4
  * This module contains utility functions used by libp2p modules.
5
5
  */
6
- export {};
6
+ export * from './filters/index.js';
7
+ export * from './multiaddr/index.js';
8
+ export * from './queue/index.js';
9
+ export * from './abstract-message-stream.js';
10
+ export * from './abstract-multiaddr-connection.js';
11
+ export * from './abstract-stream-muxer.js';
12
+ export * from './abstract-stream.js';
13
+ export * from './adaptive-timeout.js';
14
+ export * from './debounce.js';
15
+ export * from './errors.js';
16
+ export * from './get-thin-waist-addresses.js';
17
+ export * from './global-unicast-ip.js';
18
+ export * from './ip-port-to-multiaddr.js';
19
+ export * from './is-async-generator.js';
20
+ export * from './is-generator.js';
21
+ export * from './is-promise.js';
22
+ export * from './length-prefixed-decoder.js';
23
+ export * from './link-local-ip.js';
24
+ export * from './merge-options.js';
25
+ export * from './mock-muxer.js';
26
+ export * from './mock-stream.js';
27
+ export * from './moving-average.js';
28
+ export * from './multiaddr-connection-pair.js';
29
+ export * from './peer-queue.js';
30
+ export * from './priority-queue.js';
31
+ export * from './private-ip.js';
32
+ export * from './rate-limiter.js';
33
+ export * from './repeating-task.js';
34
+ export * from './stream-pair.js';
35
+ export * from './stream-utils.js';
36
+ export * from './socket-writer.js';
37
+ export * from './tracked-list.js';
38
+ export * from './tracked-map.js';
7
39
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,oBAAoB,CAAA;AAClC,cAAc,sBAAsB,CAAA;AACpC,cAAc,kBAAkB,CAAA;AAChC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,oCAAoC,CAAA;AAClD,cAAc,4BAA4B,CAAA;AAC1C,cAAc,sBAAsB,CAAA;AACpC,cAAc,uBAAuB,CAAA;AACrC,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,+BAA+B,CAAA;AAC7C,cAAc,wBAAwB,CAAA;AACtC,cAAc,2BAA2B,CAAA;AACzC,cAAc,yBAAyB,CAAA;AACvC,cAAc,mBAAmB,CAAA;AACjC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,8BAA8B,CAAA;AAC5C,cAAc,oBAAoB,CAAA;AAClC,cAAc,oBAAoB,CAAA;AAClC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,qBAAqB,CAAA;AACnC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,iBAAiB,CAAA;AAC/B,cAAc,qBAAqB,CAAA;AACnC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA;AAChC,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,mBAAmB,CAAA;AACjC,cAAc,kBAAkB,CAAA"}
package/dist/src/index.js CHANGED
@@ -3,5 +3,37 @@
3
3
  *
4
4
  * This module contains utility functions used by libp2p modules.
5
5
  */
6
- export {};
6
+ export * from './filters/index.js';
7
+ export * from './multiaddr/index.js';
8
+ export * from './queue/index.js';
9
+ export * from './abstract-message-stream.js';
10
+ export * from './abstract-multiaddr-connection.js';
11
+ export * from './abstract-stream-muxer.js';
12
+ export * from './abstract-stream.js';
13
+ export * from './adaptive-timeout.js';
14
+ export * from './debounce.js';
15
+ export * from './errors.js';
16
+ export * from './get-thin-waist-addresses.js';
17
+ export * from './global-unicast-ip.js';
18
+ export * from './ip-port-to-multiaddr.js';
19
+ export * from './is-async-generator.js';
20
+ export * from './is-generator.js';
21
+ export * from './is-promise.js';
22
+ export * from './length-prefixed-decoder.js';
23
+ export * from './link-local-ip.js';
24
+ export * from './merge-options.js';
25
+ export * from './mock-muxer.js';
26
+ export * from './mock-stream.js';
27
+ export * from './moving-average.js';
28
+ export * from './multiaddr-connection-pair.js';
29
+ export * from './peer-queue.js';
30
+ export * from './priority-queue.js';
31
+ export * from './private-ip.js';
32
+ export * from './rate-limiter.js';
33
+ export * from './repeating-task.js';
34
+ export * from './stream-pair.js';
35
+ export * from './stream-utils.js';
36
+ export * from './socket-writer.js';
37
+ export * from './tracked-list.js';
38
+ export * from './tracked-map.js';
7
39
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,oBAAoB,CAAA;AAClC,cAAc,sBAAsB,CAAA;AACpC,cAAc,kBAAkB,CAAA;AAChC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,oCAAoC,CAAA;AAClD,cAAc,4BAA4B,CAAA;AAC1C,cAAc,sBAAsB,CAAA;AACpC,cAAc,uBAAuB,CAAA;AACrC,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,+BAA+B,CAAA;AAC7C,cAAc,wBAAwB,CAAA;AACtC,cAAc,2BAA2B,CAAA;AACzC,cAAc,yBAAyB,CAAA;AACvC,cAAc,mBAAmB,CAAA;AACjC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,8BAA8B,CAAA;AAC5C,cAAc,oBAAoB,CAAA;AAClC,cAAc,oBAAoB,CAAA;AAClC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,qBAAqB,CAAA;AACnC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,iBAAiB,CAAA;AAC/B,cAAc,qBAAqB,CAAA;AACnC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA;AAChC,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,mBAAmB,CAAA;AACjC,cAAc,kBAAkB,CAAA"}
@@ -0,0 +1,37 @@
1
+ import { Uint8ArrayList } from 'uint8arraylist';
2
+ export interface LengthPrefixedDecoderInit {
3
+ /**
4
+ * How large the internal buffer is allowed to grow - attempting to store more
5
+ * data than this will throw
6
+ */
7
+ maxBufferSize?: number;
8
+ /**
9
+ * Throw an error if the message that would be read from the buffer is larger
10
+ * than this value
11
+ */
12
+ maxDataLength?: number;
13
+ /**
14
+ * Read a varint from the buffer
15
+ */
16
+ lengthDecoder?(data: Uint8ArrayList | Uint8Array): number;
17
+ /**
18
+ * Return how many bytes it takes to encode the passed value
19
+ */
20
+ encodingLength?(length: number): number;
21
+ }
22
+ /**
23
+ * Decode length-prefixed data from a buffer
24
+ */
25
+ export declare class LengthPrefixedDecoder {
26
+ private readonly buffer;
27
+ private readonly maxBufferSize;
28
+ private readonly lengthDecoder;
29
+ private readonly maxDataLength;
30
+ private readonly encodingLength;
31
+ constructor(init?: LengthPrefixedDecoderInit);
32
+ /**
33
+ * Decodes length-prefixed data
34
+ */
35
+ decode(buf: Uint8Array | Uint8ArrayList): Generator<Uint8ArrayList>;
36
+ }
37
+ //# sourceMappingURL=length-prefixed-decoder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"length-prefixed-decoder.d.ts","sourceRoot":"","sources":["../../src/length-prefixed-decoder.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAM/C,MAAM,WAAW,yBAAyB;IACxC;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IAEtB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IAEtB;;OAEG;IACH,aAAa,CAAC,CAAC,IAAI,EAAE,cAAc,GAAG,UAAU,GAAG,MAAM,CAAA;IAEzD;;OAEG;IACH,cAAc,CAAC,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAA;CACxC;AAED;;GAEG;AACH,qBAAa,qBAAqB;IAChC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAgB;IACvC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAQ;IACtC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA+C;IAC7E,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAQ;IACtC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAA4B;gBAE9C,IAAI,GAAE,yBAA8B;IAQjD;;OAEG;IACD,MAAM,CAAE,GAAG,EAAE,UAAU,GAAG,cAAc,GAAG,SAAS,CAAC,cAAc,CAAC;CA4CvE"}
@@ -0,0 +1,64 @@
1
+ import { InvalidParametersError } from '@libp2p/interface';
2
+ import * as varint from 'uint8-varint';
3
+ import { Uint8ArrayList } from 'uint8arraylist';
4
+ import { InvalidMessageLengthError } from "./stream-utils.js";
5
+ const DEFAULT_MAX_BUFFER_SIZE = 1024 * 1024 * 4;
6
+ const DEFAULT_MAX_DATA_LENGTH = 1024 * 1024 * 4;
7
+ /**
8
+ * Decode length-prefixed data from a buffer
9
+ */
10
+ export class LengthPrefixedDecoder {
11
+ buffer;
12
+ maxBufferSize;
13
+ lengthDecoder;
14
+ maxDataLength;
15
+ encodingLength;
16
+ constructor(init = {}) {
17
+ this.buffer = new Uint8ArrayList();
18
+ this.maxBufferSize = init.maxBufferSize ?? DEFAULT_MAX_BUFFER_SIZE;
19
+ this.maxDataLength = init.maxDataLength ?? DEFAULT_MAX_DATA_LENGTH;
20
+ this.lengthDecoder = init.lengthDecoder ?? varint.decode;
21
+ this.encodingLength = init.encodingLength ?? varint.encodingLength;
22
+ }
23
+ /**
24
+ * Decodes length-prefixed data
25
+ */
26
+ *decode(buf) {
27
+ this.buffer.append(buf);
28
+ if (this.buffer.byteLength > this.maxBufferSize) {
29
+ throw new InvalidParametersError(`Buffer length limit exceeded - ${this.buffer.byteLength}/${this.maxBufferSize}`);
30
+ }
31
+ // Loop to consume as many bytes from the buffer as possible
32
+ // Eg: when a single chunk contains several frames
33
+ while (true) {
34
+ let dataLength;
35
+ try {
36
+ dataLength = this.lengthDecoder(this.buffer);
37
+ }
38
+ catch (err) {
39
+ if (err instanceof RangeError) {
40
+ // ignore errors where we don't have enough data to read the length
41
+ // prefix
42
+ break;
43
+ }
44
+ throw err;
45
+ }
46
+ if (dataLength < 0 || dataLength > this.maxDataLength) {
47
+ throw new InvalidMessageLengthError('Invalid message length');
48
+ }
49
+ const lengthLength = this.encodingLength(dataLength);
50
+ const chunkLength = lengthLength + dataLength;
51
+ if (this.buffer.byteLength >= chunkLength) {
52
+ const buf = this.buffer.sublist(lengthLength, chunkLength);
53
+ this.buffer.consume(chunkLength);
54
+ if (buf.byteLength > 0) {
55
+ yield buf;
56
+ }
57
+ }
58
+ else {
59
+ break;
60
+ }
61
+ }
62
+ }
63
+ }
64
+ //# sourceMappingURL=length-prefixed-decoder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"length-prefixed-decoder.js","sourceRoot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