@libp2p/webtransport 3.1.10 → 4.0.0-7682861f9
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 +1 -5
- package/dist/index.min.js +9 -9
- package/dist/src/index.d.ts +2 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +27 -21
- package/dist/src/index.js.map +1 -1
- package/dist/src/stream.d.ts +2 -2
- package/dist/src/stream.d.ts.map +1 -1
- package/dist/src/stream.js +4 -4
- package/dist/src/stream.js.map +1 -1
- package/dist/src/utils/parse-multiaddr.d.ts +1 -1
- package/dist/src/utils/parse-multiaddr.d.ts.map +1 -1
- package/dist/src/utils/parse-multiaddr.js +1 -1
- package/dist/src/utils/parse-multiaddr.js.map +1 -1
- package/package.json +14 -26
- package/src/index.ts +45 -27
- package/src/stream.ts +5 -7
- package/src/utils/parse-multiaddr.ts +2 -2
- package/dist/typedoc-urls.json +0 -10
package/dist/src/index.d.ts
CHANGED
|
@@ -20,15 +20,14 @@
|
|
|
20
20
|
* })
|
|
21
21
|
* ```
|
|
22
22
|
*/
|
|
23
|
-
import {
|
|
24
|
-
import type { CounterGroup, Metrics } from '@libp2p/interface/metrics';
|
|
25
|
-
import type { PeerId } from '@libp2p/interface/peer-id';
|
|
23
|
+
import type { ComponentLogger, CounterGroup, Metrics, PeerId, Transport } from '@libp2p/interface';
|
|
26
24
|
export interface WebTransportInit {
|
|
27
25
|
maxInboundStreams?: number;
|
|
28
26
|
}
|
|
29
27
|
export interface WebTransportComponents {
|
|
30
28
|
peerId: PeerId;
|
|
31
29
|
metrics?: Metrics;
|
|
30
|
+
logger: ComponentLogger;
|
|
32
31
|
}
|
|
33
32
|
export interface WebTransportMetrics {
|
|
34
33
|
dialerEvents: CounterGroup;
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AASH,OAAO,KAAK,EAAE,eAAe,EAAmD,YAAY,EAAE,OAAO,EAAE,MAAM,EAAoD,SAAS,EAAgD,MAAM,mBAAmB,CAAA;AAUnP,MAAM,WAAW,gBAAgB;IAC/B,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B;AAED,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,MAAM,EAAE,eAAe,CAAA;CACxB;AAED,MAAM,WAAW,mBAAmB;IAClC,YAAY,EAAE,YAAY,CAAA;CAC3B;AAqUD,wBAAgB,YAAY,CAAE,IAAI,GAAE,gBAAqB,GAAG,CAAC,UAAU,EAAE,sBAAsB,KAAK,SAAS,CAE5G"}
|
package/dist/src/index.js
CHANGED
|
@@ -21,20 +21,19 @@
|
|
|
21
21
|
* ```
|
|
22
22
|
*/
|
|
23
23
|
import { noise } from '@chainsafe/libp2p-noise';
|
|
24
|
-
import {
|
|
25
|
-
import { logger } from '@libp2p/logger';
|
|
26
|
-
import {} from '@multiformats/multiaddr';
|
|
24
|
+
import { transportSymbol } from '@libp2p/interface';
|
|
27
25
|
import { WebTransport as WebTransportMatcher } from '@multiformats/multiaddr-matcher';
|
|
28
26
|
import { webtransportBiDiStreamToStream } from './stream.js';
|
|
29
27
|
import { inertDuplex } from './utils/inert-duplex.js';
|
|
30
28
|
import { isSubset } from './utils/is-subset.js';
|
|
31
29
|
import { parseMultiaddr } from './utils/parse-multiaddr.js';
|
|
32
|
-
const log = logger('libp2p:webtransport');
|
|
33
30
|
class WebTransportTransport {
|
|
31
|
+
log;
|
|
34
32
|
components;
|
|
35
33
|
config;
|
|
36
34
|
metrics;
|
|
37
35
|
constructor(components, init = {}) {
|
|
36
|
+
this.log = components.logger.forComponent('libp2p:webtransport');
|
|
38
37
|
this.components = components;
|
|
39
38
|
this.config = {
|
|
40
39
|
maxInboundStreams: init.maxInboundStreams ?? 1000
|
|
@@ -49,10 +48,10 @@ class WebTransportTransport {
|
|
|
49
48
|
}
|
|
50
49
|
}
|
|
51
50
|
[Symbol.toStringTag] = '@libp2p/webtransport';
|
|
52
|
-
[
|
|
51
|
+
[transportSymbol] = true;
|
|
53
52
|
async dial(ma, options) {
|
|
54
53
|
options?.signal?.throwIfAborted();
|
|
55
|
-
log('dialing %s', ma);
|
|
54
|
+
this.log('dialing %s', ma);
|
|
56
55
|
const localPeer = this.components.peerId;
|
|
57
56
|
if (localPeer === undefined) {
|
|
58
57
|
throw new Error('Need a local peerid');
|
|
@@ -89,7 +88,7 @@ class WebTransportTransport {
|
|
|
89
88
|
wt.close();
|
|
90
89
|
}
|
|
91
90
|
catch (err) {
|
|
92
|
-
log.error('error closing wt session', err);
|
|
91
|
+
this.log.error('error closing wt session', err);
|
|
93
92
|
}
|
|
94
93
|
finally {
|
|
95
94
|
// This is how we specify the connection is closed and shouldn't be used.
|
|
@@ -119,7 +118,7 @@ class WebTransportTransport {
|
|
|
119
118
|
this.metrics?.dialerEvents.increment({ ready: true });
|
|
120
119
|
// this promise resolves/throws when the session is closed
|
|
121
120
|
wt.closed.catch((err) => {
|
|
122
|
-
log.error('error on remote wt session close', err);
|
|
121
|
+
this.log.error('error on remote wt session close', err);
|
|
123
122
|
})
|
|
124
123
|
.finally(() => {
|
|
125
124
|
cleanUpWTSession('remote_close');
|
|
@@ -130,17 +129,18 @@ class WebTransportTransport {
|
|
|
130
129
|
this.metrics?.dialerEvents.increment({ open: true });
|
|
131
130
|
maConn = {
|
|
132
131
|
close: async () => {
|
|
133
|
-
log('Closing webtransport');
|
|
132
|
+
this.log('Closing webtransport');
|
|
134
133
|
cleanUpWTSession('close');
|
|
135
134
|
},
|
|
136
135
|
abort: (err) => {
|
|
137
|
-
log('aborting webtransport due to passed err', err);
|
|
136
|
+
this.log('aborting webtransport due to passed err', err);
|
|
138
137
|
cleanUpWTSession('abort');
|
|
139
138
|
},
|
|
140
139
|
remoteAddr: ma,
|
|
141
140
|
timeline: {
|
|
142
141
|
open: Date.now()
|
|
143
142
|
},
|
|
143
|
+
log: this.components.logger.forComponent('libp2p:webtransport:maconn'),
|
|
144
144
|
// This connection is never used directly since webtransport supports native streams.
|
|
145
145
|
...inertDuplex()
|
|
146
146
|
};
|
|
@@ -148,7 +148,7 @@ class WebTransportTransport {
|
|
|
148
148
|
return await options.upgrader.upgradeOutbound(maConn, { skipEncryption: true, muxerFactory: this.webtransportMuxer(wt), skipProtection: true });
|
|
149
149
|
}
|
|
150
150
|
catch (err) {
|
|
151
|
-
log.error('caught wt session err', err);
|
|
151
|
+
this.log.error('caught wt session err', err);
|
|
152
152
|
if (authenticated) {
|
|
153
153
|
cleanUpWTSession('upgrade_error');
|
|
154
154
|
}
|
|
@@ -185,7 +185,12 @@ class WebTransportTransport {
|
|
|
185
185
|
})(),
|
|
186
186
|
sink: async function (source) {
|
|
187
187
|
for await (const chunk of source) {
|
|
188
|
-
|
|
188
|
+
if (chunk instanceof Uint8Array) {
|
|
189
|
+
await writer.write(chunk);
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
await writer.write(chunk.subarray());
|
|
193
|
+
}
|
|
189
194
|
}
|
|
190
195
|
}
|
|
191
196
|
};
|
|
@@ -193,10 +198,10 @@ class WebTransportTransport {
|
|
|
193
198
|
const { remoteExtensions } = await n.secureOutbound(localPeer, duplex, remotePeer);
|
|
194
199
|
// We're done with this authentication stream
|
|
195
200
|
writer.close().catch((err) => {
|
|
196
|
-
log.error(`Failed to close authentication stream writer: ${err.message}`);
|
|
201
|
+
this.log.error(`Failed to close authentication stream writer: ${err.message}`);
|
|
197
202
|
});
|
|
198
203
|
reader.cancel().catch((err) => {
|
|
199
|
-
log.error(`Failed to close authentication stream reader: ${err.message}`);
|
|
204
|
+
this.log.error(`Failed to close authentication stream reader: ${err.message}`);
|
|
200
205
|
});
|
|
201
206
|
// Verify the certhashes we used when dialing are a subset of the certhashes relayed by the remote peer
|
|
202
207
|
if (!isSubset(remoteExtensions?.webtransportCerthashes ?? [], certhashes.map(ch => ch.bytes))) {
|
|
@@ -207,6 +212,7 @@ class WebTransportTransport {
|
|
|
207
212
|
webtransportMuxer(wt) {
|
|
208
213
|
let streamIDCounter = 0;
|
|
209
214
|
const config = this.config;
|
|
215
|
+
const self = this;
|
|
210
216
|
return {
|
|
211
217
|
protocol: 'webtransport',
|
|
212
218
|
createStreamMuxer: (init) => {
|
|
@@ -227,27 +233,27 @@ class WebTransportTransport {
|
|
|
227
233
|
if (activeStreams.length >= config.maxInboundStreams) {
|
|
228
234
|
// We've reached our limit, close this stream.
|
|
229
235
|
wtStream.writable.close().catch((err) => {
|
|
230
|
-
log.error(`Failed to close inbound stream that crossed our maxInboundStream limit: ${err.message}`);
|
|
236
|
+
self.log.error(`Failed to close inbound stream that crossed our maxInboundStream limit: ${err.message}`);
|
|
231
237
|
});
|
|
232
238
|
wtStream.readable.cancel().catch((err) => {
|
|
233
|
-
log.error(`Failed to close inbound stream that crossed our maxInboundStream limit: ${err.message}`);
|
|
239
|
+
self.log.error(`Failed to close inbound stream that crossed our maxInboundStream limit: ${err.message}`);
|
|
234
240
|
});
|
|
235
241
|
}
|
|
236
242
|
else {
|
|
237
|
-
const stream = await webtransportBiDiStreamToStream(wtStream, String(streamIDCounter++), 'inbound', activeStreams, init?.onStreamEnd);
|
|
243
|
+
const stream = await webtransportBiDiStreamToStream(wtStream, String(streamIDCounter++), 'inbound', activeStreams, init?.onStreamEnd, self.components.logger);
|
|
238
244
|
activeStreams.push(stream);
|
|
239
245
|
init?.onIncomingStream?.(stream);
|
|
240
246
|
}
|
|
241
247
|
}
|
|
242
248
|
})().catch(() => {
|
|
243
|
-
log.error('WebTransport failed to receive incoming stream');
|
|
249
|
+
this.log.error('WebTransport failed to receive incoming stream');
|
|
244
250
|
});
|
|
245
251
|
const muxer = {
|
|
246
252
|
protocol: 'webtransport',
|
|
247
253
|
streams: activeStreams,
|
|
248
254
|
newStream: async (name) => {
|
|
249
255
|
const wtStream = await wt.createBidirectionalStream();
|
|
250
|
-
const stream = await webtransportBiDiStreamToStream(wtStream, String(streamIDCounter++), init?.direction ?? 'outbound', activeStreams, init?.onStreamEnd);
|
|
256
|
+
const stream = await webtransportBiDiStreamToStream(wtStream, String(streamIDCounter++), init?.direction ?? 'outbound', activeStreams, init?.onStreamEnd, self.components.logger);
|
|
251
257
|
activeStreams.push(stream);
|
|
252
258
|
return stream;
|
|
253
259
|
},
|
|
@@ -255,11 +261,11 @@ class WebTransportTransport {
|
|
|
255
261
|
* Close or abort all tracked streams and stop the muxer
|
|
256
262
|
*/
|
|
257
263
|
close: async (options) => {
|
|
258
|
-
log('Closing webtransport muxer');
|
|
264
|
+
this.log('Closing webtransport muxer');
|
|
259
265
|
await Promise.all(activeStreams.map(async (s) => s.close(options)));
|
|
260
266
|
},
|
|
261
267
|
abort: (err) => {
|
|
262
|
-
log('Aborting webtransport muxer with err:', err);
|
|
268
|
+
this.log('Aborting webtransport muxer with err:', err);
|
|
263
269
|
for (const stream of activeStreams) {
|
|
264
270
|
stream.abort(err);
|
|
265
271
|
}
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAC/C,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OA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B,CAAA;gBAED,OAAO,KAAK,CAAA;YACd,CAAC;SACF,CAAA;IACH,CAAC;IAED,cAAc,CAAE,OAA8B;QAC5C,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAA;IAClF,CAAC;IAED;;OAEG;IACH,MAAM,CAAE,UAAuB;QAC7B,OAAO,UAAU,CAAC,MAAM,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAA;IAC1D,CAAC;CACF;AAED,MAAM,UAAU,YAAY,CAAE,OAAyB,EAAE;IACvD,OAAO,CAAC,UAAkC,EAAE,EAAE,CAAC,IAAI,qBAAqB,CAAC,UAAU,EAAE,IAAI,CAAC,CAAA;AAC5F,CAAC"}
|
package/dist/src/stream.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { Direction, Stream } from '@libp2p/interface
|
|
2
|
-
export declare function webtransportBiDiStreamToStream(bidiStream: WebTransportBidirectionalStream, streamId: string, direction: Direction, activeStreams: Stream[], onStreamEnd: undefined | ((s: Stream) => void)): Promise<Stream>;
|
|
1
|
+
import type { ComponentLogger, Direction, Stream } from '@libp2p/interface';
|
|
2
|
+
export declare function webtransportBiDiStreamToStream(bidiStream: WebTransportBidirectionalStream, streamId: string, direction: Direction, activeStreams: Stream[], onStreamEnd: undefined | ((s: Stream) => void), logger: ComponentLogger): Promise<Stream>;
|
|
3
3
|
//# sourceMappingURL=stream.d.ts.map
|
package/dist/src/stream.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../src/stream.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../src/stream.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAgB,eAAe,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAGzF,wBAAsB,8BAA8B,CAAE,UAAU,EAAE,+BAA+B,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,EAAE,EAAE,WAAW,EAAE,SAAS,GAAG,CAAC,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC,EAAE,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC,CAmL5P"}
|
package/dist/src/stream.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { logger } from '@libp2p/logger';
|
|
2
1
|
import { Uint8ArrayList } from 'uint8arraylist';
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
export async function webtransportBiDiStreamToStream(bidiStream, streamId, direction, activeStreams, onStreamEnd, logger) {
|
|
3
|
+
const log = logger.forComponent(`libp2p:webtransport:stream:${direction}:${streamId}`);
|
|
5
4
|
const writer = bidiStream.writable.getWriter();
|
|
6
5
|
const reader = bidiStream.readable.getReader();
|
|
7
6
|
await writer.ready;
|
|
@@ -154,7 +153,8 @@ export async function webtransportBiDiStreamToStream(bidiStream, streamId, direc
|
|
|
154
153
|
this.writeStatus = 'closed';
|
|
155
154
|
await stream.closeWrite();
|
|
156
155
|
}
|
|
157
|
-
}
|
|
156
|
+
},
|
|
157
|
+
log
|
|
158
158
|
};
|
|
159
159
|
return stream;
|
|
160
160
|
}
|
package/dist/src/stream.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream.js","sourceRoot":"","sources":["../../src/stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"stream.js","sourceRoot":"","sources":["../../src/stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAI/C,MAAM,CAAC,KAAK,UAAU,8BAA8B,CAAE,UAA2C,EAAE,QAAgB,EAAE,SAAoB,EAAE,aAAuB,EAAE,WAA8C,EAAE,MAAuB;IACzO,MAAM,GAAG,GAAG,MAAM,CAAC,YAAY,CAAC,8BAA8B,SAAS,IAA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,QAAQ,GAAG,IAAI,CAAA;YACf,IAAI,CAAC;gBACH,IAAI,CAAC,WAAW,GAAG,SAAS,CAAA;gBAE5B,IAAI,KAAK,EAAE,MAAM,MAAM,IAAI,MAAM,EAAE,CAAC;oBAClC,IAAI,MAAM,YAAY,UAAU,EAAE,CAAC;wBACjC,MAAM,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;oBAC5B,CAAC;yBAAM,CAAC;wBACN,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;4BACzB,MAAM,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;wBACzB,CAAC;oBACH,CAAC;gBACH,CAAC;gBAED,IAAI,CAAC,WAAW,GAAG,MAAM,CAAA;YAC3B,CAAC;oBAAS,CAAC;gBACT,IAAI,CAAC,QAAQ,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;gBACrC,IAAI,CAAC,WAAW,GAAG,QAAQ,CAAA;gBAE3B,MAAM,MAAM,CAAC,UAAU,EAAE,CAAA;YAC3B,CAAC;QACH,CAAC;QACD,GAAG;KACJ,CAAA;IAED,OAAO,MAAM,CAAA;AACf,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Multiaddr } from '@multiformats/multiaddr';
|
|
2
|
-
import type { PeerId } from '@libp2p/interface
|
|
2
|
+
import type { PeerId } from '@libp2p/interface';
|
|
3
3
|
import type { MultihashDigest } from 'multiformats/hashes/interface';
|
|
4
4
|
export interface ParsedMultiaddr {
|
|
5
5
|
url: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-multiaddr.d.ts","sourceRoot":"","sources":["../../../src/utils/parse-multiaddr.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAa,MAAM,yBAAyB,CAAA;AAGnE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"parse-multiaddr.d.ts","sourceRoot":"","sources":["../../../src/utils/parse-multiaddr.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAa,MAAM,yBAAyB,CAAA;AAGnE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AASpE,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAA;IACX,UAAU,EAAE,eAAe,EAAE,CAAA;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,wBAAgB,cAAc,CAAE,EAAE,EAAE,SAAS,GAAG,eAAe,CAoC9D"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CodeError } from '@libp2p/interface
|
|
1
|
+
import { CodeError } from '@libp2p/interface';
|
|
2
2
|
import { peerIdFromString } from '@libp2p/peer-id';
|
|
3
3
|
import { protocols } from '@multiformats/multiaddr';
|
|
4
4
|
import { WebTransport } from '@multiformats/multiaddr-matcher';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-multiaddr.js","sourceRoot":"","sources":["../../../src/utils/parse-multiaddr.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"parse-multiaddr.js","sourceRoot":"","sources":["../../../src/utils/parse-multiaddr.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,EAAkB,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AAC9D,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAInD,sDAAsD;AACtD,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG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pB,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,EAAE,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAC7C;;;;;;;WAOG;QACH,IAAI,GAAG,IAAI,IAAI,GAAG,CAAA;IACpB,CAAC;IAED,OAAO;QACL,kCAAkC;QAClC,GAAG,EAAE,WAAW,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE;QACnC,UAAU;QACV,UAAU;KACX,CAAA;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@libp2p/webtransport",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-7682861f9",
|
|
4
4
|
"description": "JavaScript implementation of the WebTransport module that libp2p uses and that implements the interface-transport spec",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
|
-
"homepage": "https://github.com/libp2p/js-libp2p/tree/
|
|
6
|
+
"homepage": "https://github.com/libp2p/js-libp2p/tree/main/packages/transport-webtransport#readme",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "git+https://github.com/libp2p/js-libp2p.git"
|
|
@@ -11,27 +11,15 @@
|
|
|
11
11
|
"bugs": {
|
|
12
12
|
"url": "https://github.com/libp2p/js-libp2p/issues"
|
|
13
13
|
},
|
|
14
|
+
"publishConfig": {
|
|
15
|
+
"access": "public",
|
|
16
|
+
"provenance": true
|
|
17
|
+
},
|
|
14
18
|
"keywords": [
|
|
15
19
|
"IPFS"
|
|
16
20
|
],
|
|
17
21
|
"type": "module",
|
|
18
22
|
"types": "./dist/src/index.d.ts",
|
|
19
|
-
"typesVersions": {
|
|
20
|
-
"*": {
|
|
21
|
-
"*": [
|
|
22
|
-
"*",
|
|
23
|
-
"dist/*",
|
|
24
|
-
"dist/src/*",
|
|
25
|
-
"dist/src/*/index"
|
|
26
|
-
],
|
|
27
|
-
"src/*": [
|
|
28
|
-
"*",
|
|
29
|
-
"dist/*",
|
|
30
|
-
"dist/src/*",
|
|
31
|
-
"dist/src/*/index"
|
|
32
|
-
]
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
23
|
"files": [
|
|
36
24
|
"src",
|
|
37
25
|
"dist",
|
|
@@ -62,20 +50,20 @@
|
|
|
62
50
|
},
|
|
63
51
|
"dependencies": {
|
|
64
52
|
"@chainsafe/libp2p-noise": "^13.0.0",
|
|
65
|
-
"@libp2p/interface": "
|
|
66
|
-
"@libp2p/
|
|
67
|
-
"@
|
|
68
|
-
"@multiformats/multiaddr": "^
|
|
69
|
-
"@multiformats/multiaddr-matcher": "^1.0.1",
|
|
53
|
+
"@libp2p/interface": "1.0.0-7682861f9",
|
|
54
|
+
"@libp2p/peer-id": "4.0.0-7682861f9",
|
|
55
|
+
"@multiformats/multiaddr": "^12.1.10",
|
|
56
|
+
"@multiformats/multiaddr-matcher": "^1.1.0",
|
|
70
57
|
"it-stream-types": "^2.0.1",
|
|
71
|
-
"multiformats": "^12.
|
|
58
|
+
"multiformats": "^12.1.3",
|
|
72
59
|
"uint8arraylist": "^2.4.3",
|
|
73
60
|
"uint8arrays": "^4.0.6"
|
|
74
61
|
},
|
|
75
62
|
"devDependencies": {
|
|
76
|
-
"@libp2p/
|
|
63
|
+
"@libp2p/logger": "4.0.0-7682861f9",
|
|
64
|
+
"@libp2p/peer-id-factory": "3.0.9-7682861f9",
|
|
77
65
|
"aegir": "^41.0.2",
|
|
78
|
-
"libp2p": "
|
|
66
|
+
"libp2p": "1.0.0-7682861f9",
|
|
79
67
|
"p-defer": "^4.0.0"
|
|
80
68
|
},
|
|
81
69
|
"browser": {
|
package/src/index.ts
CHANGED
|
@@ -22,27 +22,22 @@
|
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
24
|
import { noise } from '@chainsafe/libp2p-noise'
|
|
25
|
-
import {
|
|
26
|
-
import { logger } from '@libp2p/logger'
|
|
27
|
-
import { type Multiaddr, type AbortOptions } from '@multiformats/multiaddr'
|
|
25
|
+
import { transportSymbol } from '@libp2p/interface'
|
|
28
26
|
import { WebTransport as WebTransportMatcher } from '@multiformats/multiaddr-matcher'
|
|
29
27
|
import { webtransportBiDiStreamToStream } from './stream.js'
|
|
30
28
|
import { inertDuplex } from './utils/inert-duplex.js'
|
|
31
29
|
import { isSubset } from './utils/is-subset.js'
|
|
32
30
|
import { parseMultiaddr } from './utils/parse-multiaddr.js'
|
|
33
|
-
import type { Connection, MultiaddrConnection, Stream } from '@libp2p/interface
|
|
34
|
-
import type {
|
|
35
|
-
import type { PeerId } from '@libp2p/interface/peer-id'
|
|
36
|
-
import type { StreamMuxerFactory, StreamMuxerInit, StreamMuxer } from '@libp2p/interface/stream-muxer'
|
|
31
|
+
import type { ComponentLogger, Logger, Connection, MultiaddrConnection, Stream, CounterGroup, Metrics, PeerId, StreamMuxerFactory, StreamMuxerInit, StreamMuxer, Transport, CreateListenerOptions, DialOptions, Listener } from '@libp2p/interface'
|
|
32
|
+
import type { Multiaddr, AbortOptions } from '@multiformats/multiaddr'
|
|
37
33
|
import type { Source } from 'it-stream-types'
|
|
38
34
|
import type { MultihashDigest } from 'multiformats/hashes/interface'
|
|
35
|
+
import type { Uint8ArrayList } from 'uint8arraylist'
|
|
39
36
|
|
|
40
37
|
interface WebTransportSessionCleanup {
|
|
41
38
|
(metric: string): void
|
|
42
39
|
}
|
|
43
40
|
|
|
44
|
-
const log = logger('libp2p:webtransport')
|
|
45
|
-
|
|
46
41
|
export interface WebTransportInit {
|
|
47
42
|
maxInboundStreams?: number
|
|
48
43
|
}
|
|
@@ -50,6 +45,7 @@ export interface WebTransportInit {
|
|
|
50
45
|
export interface WebTransportComponents {
|
|
51
46
|
peerId: PeerId
|
|
52
47
|
metrics?: Metrics
|
|
48
|
+
logger: ComponentLogger
|
|
53
49
|
}
|
|
54
50
|
|
|
55
51
|
export interface WebTransportMetrics {
|
|
@@ -57,11 +53,13 @@ export interface WebTransportMetrics {
|
|
|
57
53
|
}
|
|
58
54
|
|
|
59
55
|
class WebTransportTransport implements Transport {
|
|
56
|
+
private readonly log: Logger
|
|
60
57
|
private readonly components: WebTransportComponents
|
|
61
58
|
private readonly config: Required<WebTransportInit>
|
|
62
59
|
private readonly metrics?: WebTransportMetrics
|
|
63
60
|
|
|
64
61
|
constructor (components: WebTransportComponents, init: WebTransportInit = {}) {
|
|
62
|
+
this.log = components.logger.forComponent('libp2p:webtransport')
|
|
65
63
|
this.components = components
|
|
66
64
|
this.config = {
|
|
67
65
|
maxInboundStreams: init.maxInboundStreams ?? 1000
|
|
@@ -79,12 +77,12 @@ class WebTransportTransport implements Transport {
|
|
|
79
77
|
|
|
80
78
|
readonly [Symbol.toStringTag] = '@libp2p/webtransport'
|
|
81
79
|
|
|
82
|
-
readonly [
|
|
80
|
+
readonly [transportSymbol] = true
|
|
83
81
|
|
|
84
82
|
async dial (ma: Multiaddr, options: DialOptions): Promise<Connection> {
|
|
85
83
|
options?.signal?.throwIfAborted()
|
|
86
84
|
|
|
87
|
-
log('dialing %s', ma)
|
|
85
|
+
this.log('dialing %s', ma)
|
|
88
86
|
const localPeer = this.components.peerId
|
|
89
87
|
if (localPeer === undefined) {
|
|
90
88
|
throw new Error('Need a local peerid')
|
|
@@ -131,7 +129,7 @@ class WebTransportTransport implements Transport {
|
|
|
131
129
|
this.metrics?.dialerEvents.increment({ [metric]: true })
|
|
132
130
|
wt.close()
|
|
133
131
|
} catch (err) {
|
|
134
|
-
log.error('error closing wt session', err)
|
|
132
|
+
this.log.error('error closing wt session', err)
|
|
135
133
|
} finally {
|
|
136
134
|
// This is how we specify the connection is closed and shouldn't be used.
|
|
137
135
|
if (maConn != null) {
|
|
@@ -164,7 +162,7 @@ class WebTransportTransport implements Transport {
|
|
|
164
162
|
|
|
165
163
|
// this promise resolves/throws when the session is closed
|
|
166
164
|
wt.closed.catch((err: Error) => {
|
|
167
|
-
log.error('error on remote wt session close', err)
|
|
165
|
+
this.log.error('error on remote wt session close', err)
|
|
168
166
|
})
|
|
169
167
|
.finally(() => {
|
|
170
168
|
cleanUpWTSession('remote_close')
|
|
@@ -178,17 +176,18 @@ class WebTransportTransport implements Transport {
|
|
|
178
176
|
|
|
179
177
|
maConn = {
|
|
180
178
|
close: async () => {
|
|
181
|
-
log('Closing webtransport')
|
|
179
|
+
this.log('Closing webtransport')
|
|
182
180
|
cleanUpWTSession('close')
|
|
183
181
|
},
|
|
184
182
|
abort: (err: Error) => {
|
|
185
|
-
log('aborting webtransport due to passed err', err)
|
|
183
|
+
this.log('aborting webtransport due to passed err', err)
|
|
186
184
|
cleanUpWTSession('abort')
|
|
187
185
|
},
|
|
188
186
|
remoteAddr: ma,
|
|
189
187
|
timeline: {
|
|
190
188
|
open: Date.now()
|
|
191
189
|
},
|
|
190
|
+
log: this.components.logger.forComponent('libp2p:webtransport:maconn'),
|
|
192
191
|
// This connection is never used directly since webtransport supports native streams.
|
|
193
192
|
...inertDuplex()
|
|
194
193
|
}
|
|
@@ -197,7 +196,7 @@ class WebTransportTransport implements Transport {
|
|
|
197
196
|
|
|
198
197
|
return await options.upgrader.upgradeOutbound(maConn, { skipEncryption: true, muxerFactory: this.webtransportMuxer(wt), skipProtection: true })
|
|
199
198
|
} catch (err: any) {
|
|
200
|
-
log.error('caught wt session err', err)
|
|
199
|
+
this.log.error('caught wt session err', err)
|
|
201
200
|
|
|
202
201
|
if (authenticated) {
|
|
203
202
|
cleanUpWTSession('upgrade_error')
|
|
@@ -235,9 +234,13 @@ class WebTransportTransport implements Transport {
|
|
|
235
234
|
}
|
|
236
235
|
}
|
|
237
236
|
})(),
|
|
238
|
-
sink: async function (source: Source<Uint8Array>) {
|
|
237
|
+
sink: async function (source: Source<Uint8Array | Uint8ArrayList>) {
|
|
239
238
|
for await (const chunk of source) {
|
|
240
|
-
|
|
239
|
+
if (chunk instanceof Uint8Array) {
|
|
240
|
+
await writer.write(chunk)
|
|
241
|
+
} else {
|
|
242
|
+
await writer.write(chunk.subarray())
|
|
243
|
+
}
|
|
241
244
|
}
|
|
242
245
|
}
|
|
243
246
|
}
|
|
@@ -248,11 +251,11 @@ class WebTransportTransport implements Transport {
|
|
|
248
251
|
|
|
249
252
|
// We're done with this authentication stream
|
|
250
253
|
writer.close().catch((err: Error) => {
|
|
251
|
-
log.error(`Failed to close authentication stream writer: ${err.message}`)
|
|
254
|
+
this.log.error(`Failed to close authentication stream writer: ${err.message}`)
|
|
252
255
|
})
|
|
253
256
|
|
|
254
257
|
reader.cancel().catch((err: Error) => {
|
|
255
|
-
log.error(`Failed to close authentication stream reader: ${err.message}`)
|
|
258
|
+
this.log.error(`Failed to close authentication stream reader: ${err.message}`)
|
|
256
259
|
})
|
|
257
260
|
|
|
258
261
|
// Verify the certhashes we used when dialing are a subset of the certhashes relayed by the remote peer
|
|
@@ -266,6 +269,7 @@ class WebTransportTransport implements Transport {
|
|
|
266
269
|
webtransportMuxer (wt: WebTransport): StreamMuxerFactory {
|
|
267
270
|
let streamIDCounter = 0
|
|
268
271
|
const config = this.config
|
|
272
|
+
const self = this
|
|
269
273
|
return {
|
|
270
274
|
protocol: 'webtransport',
|
|
271
275
|
createStreamMuxer: (init?: StreamMuxerInit): StreamMuxer => {
|
|
@@ -292,19 +296,26 @@ class WebTransportTransport implements Transport {
|
|
|
292
296
|
if (activeStreams.length >= config.maxInboundStreams) {
|
|
293
297
|
// We've reached our limit, close this stream.
|
|
294
298
|
wtStream.writable.close().catch((err: Error) => {
|
|
295
|
-
log.error(`Failed to close inbound stream that crossed our maxInboundStream limit: ${err.message}`)
|
|
299
|
+
self.log.error(`Failed to close inbound stream that crossed our maxInboundStream limit: ${err.message}`)
|
|
296
300
|
})
|
|
297
301
|
wtStream.readable.cancel().catch((err: Error) => {
|
|
298
|
-
log.error(`Failed to close inbound stream that crossed our maxInboundStream limit: ${err.message}`)
|
|
302
|
+
self.log.error(`Failed to close inbound stream that crossed our maxInboundStream limit: ${err.message}`)
|
|
299
303
|
})
|
|
300
304
|
} else {
|
|
301
|
-
const stream = await webtransportBiDiStreamToStream(
|
|
305
|
+
const stream = await webtransportBiDiStreamToStream(
|
|
306
|
+
wtStream,
|
|
307
|
+
String(streamIDCounter++),
|
|
308
|
+
'inbound',
|
|
309
|
+
activeStreams,
|
|
310
|
+
init?.onStreamEnd,
|
|
311
|
+
self.components.logger
|
|
312
|
+
)
|
|
302
313
|
activeStreams.push(stream)
|
|
303
314
|
init?.onIncomingStream?.(stream)
|
|
304
315
|
}
|
|
305
316
|
}
|
|
306
317
|
})().catch(() => {
|
|
307
|
-
log.error('WebTransport failed to receive incoming stream')
|
|
318
|
+
this.log.error('WebTransport failed to receive incoming stream')
|
|
308
319
|
})
|
|
309
320
|
|
|
310
321
|
const muxer: StreamMuxer = {
|
|
@@ -313,7 +324,14 @@ class WebTransportTransport implements Transport {
|
|
|
313
324
|
newStream: async (name?: string): Promise<Stream> => {
|
|
314
325
|
const wtStream = await wt.createBidirectionalStream()
|
|
315
326
|
|
|
316
|
-
const stream = await webtransportBiDiStreamToStream(
|
|
327
|
+
const stream = await webtransportBiDiStreamToStream(
|
|
328
|
+
wtStream,
|
|
329
|
+
String(streamIDCounter++),
|
|
330
|
+
init?.direction ?? 'outbound',
|
|
331
|
+
activeStreams,
|
|
332
|
+
init?.onStreamEnd,
|
|
333
|
+
self.components.logger
|
|
334
|
+
)
|
|
317
335
|
activeStreams.push(stream)
|
|
318
336
|
|
|
319
337
|
return stream
|
|
@@ -323,14 +341,14 @@ class WebTransportTransport implements Transport {
|
|
|
323
341
|
* Close or abort all tracked streams and stop the muxer
|
|
324
342
|
*/
|
|
325
343
|
close: async (options?: AbortOptions) => {
|
|
326
|
-
log('Closing webtransport muxer')
|
|
344
|
+
this.log('Closing webtransport muxer')
|
|
327
345
|
|
|
328
346
|
await Promise.all(
|
|
329
347
|
activeStreams.map(async s => s.close(options))
|
|
330
348
|
)
|
|
331
349
|
},
|
|
332
350
|
abort: (err: Error) => {
|
|
333
|
-
log('Aborting webtransport muxer with err:', err)
|
|
351
|
+
this.log('Aborting webtransport muxer with err:', err)
|
|
334
352
|
|
|
335
353
|
for (const stream of activeStreams) {
|
|
336
354
|
stream.abort(err)
|