@libp2p/yamux 8.0.1 → 8.0.2
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 +49 -63
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +4 -4
- package/dist/src/config.js +1 -1
- package/dist/src/constants.js +1 -1
- package/dist/src/decode.d.ts +1 -1
- package/dist/src/decode.js +2 -2
- package/dist/src/encode.d.ts +1 -1
- package/dist/src/encode.js +1 -1
- package/dist/src/index.d.ts +41 -57
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +40 -56
- package/dist/src/index.js.map +1 -1
- package/dist/src/muxer.d.ts +3 -3
- package/dist/src/muxer.js +6 -6
- 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/package.json +18 -15
- package/src/config.ts +1 -1
- package/src/constants.ts +1 -1
- package/src/decode.ts +3 -3
- package/src/encode.ts +2 -2
- package/src/index.ts +42 -58
- package/src/muxer.ts +9 -9
- package/src/stream.ts +5 -5
package/dist/src/config.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { InvalidParametersError } from '@libp2p/interface';
|
|
2
|
-
import { INITIAL_STREAM_WINDOW, MAX_STREAM_WINDOW } from
|
|
2
|
+
import { INITIAL_STREAM_WINDOW, MAX_STREAM_WINDOW } from "./constants.js";
|
|
3
3
|
export const defaultConfig = {
|
|
4
4
|
enableKeepAlive: true,
|
|
5
5
|
keepAliveInterval: 30_000,
|
package/dist/src/constants.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Protocol violation errors
|
|
2
|
-
import { BothClientsError, DecodeInvalidVersionError, InvalidFrameError, NotMatchingPingError, ReceiveWindowExceededError, StreamAlreadyExistsError, UnRequestedPingError } from
|
|
2
|
+
import { BothClientsError, DecodeInvalidVersionError, InvalidFrameError, NotMatchingPingError, ReceiveWindowExceededError, StreamAlreadyExistsError, UnRequestedPingError } from "./errors.js";
|
|
3
3
|
export const PROTOCOL_ERRORS = new Set([
|
|
4
4
|
InvalidFrameError.name,
|
|
5
5
|
UnRequestedPingError.name,
|
package/dist/src/decode.d.ts
CHANGED
package/dist/src/decode.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Uint8ArrayList } from 'uint8arraylist';
|
|
2
|
-
import { InvalidFrameError } from
|
|
3
|
-
import { FrameType, HEADER_LENGTH, YAMUX_VERSION } from
|
|
2
|
+
import { InvalidFrameError } from "./errors.js";
|
|
3
|
+
import { FrameType, HEADER_LENGTH, YAMUX_VERSION } from "./frame.js";
|
|
4
4
|
export function isDataFrame(frame) {
|
|
5
5
|
return frame.header.type === FrameType.Data && frame.data !== null;
|
|
6
6
|
}
|
package/dist/src/encode.d.ts
CHANGED
package/dist/src/encode.js
CHANGED
package/dist/src/index.d.ts
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* This module is a JavaScript implementation of [Yamux from Hashicorp](https://github.com/hashicorp/yamux/blob/master/spec.md) designed to be used with [js-libp2p](https://github.com/libp2p/js-libp2p).
|
|
5
5
|
*
|
|
6
|
+
* Formerly published as [`@chainsafe/libp2p-yamux`](https://www.npmjs.com/package/@chainsafe/libp2p-yamux).
|
|
7
|
+
*
|
|
6
8
|
* @example Configure libp2p with Yamux
|
|
7
9
|
*
|
|
8
10
|
* ```typescript
|
|
@@ -19,67 +21,49 @@
|
|
|
19
21
|
*
|
|
20
22
|
* @example Using the low-level API
|
|
21
23
|
*
|
|
22
|
-
* ```
|
|
24
|
+
* ```typescript
|
|
23
25
|
* import { yamux } from '@libp2p/yamux'
|
|
24
|
-
* import {
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* const clientMuxer = yamux(
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
* // now either side can open streams
|
|
61
|
-
* const stream0 = clientMuxer.newStream()
|
|
62
|
-
* const stream1 = serverMuxer.newStream()
|
|
63
|
-
*
|
|
64
|
-
* // Send some data to the other side
|
|
65
|
-
* const encoder = new TextEncoder()
|
|
66
|
-
* const data = [encoder.encode('hello'), encoder.encode('world')]
|
|
67
|
-
* pipe(data, stream0)
|
|
68
|
-
*
|
|
69
|
-
* // Receive data back
|
|
70
|
-
* const result = await pipe(stream0, all)
|
|
71
|
-
*
|
|
72
|
-
* // close a stream
|
|
73
|
-
* stream1.close()
|
|
74
|
-
*
|
|
75
|
-
* // close the muxer
|
|
76
|
-
* clientMuxer.close()
|
|
26
|
+
* import { multiaddrConnectionPair } from '@libp2p/utils'
|
|
27
|
+
*
|
|
28
|
+
* // a pair of connected multiaddr connections - in a real application these
|
|
29
|
+
* // would be the two ends of a network connection
|
|
30
|
+
* const [outboundConnection, inboundConnection] = multiaddrConnectionPair()
|
|
31
|
+
*
|
|
32
|
+
* const clientMuxer = yamux()().createStreamMuxer(outboundConnection)
|
|
33
|
+
* const serverMuxer = yamux()().createStreamMuxer(inboundConnection)
|
|
34
|
+
*
|
|
35
|
+
* // echo incoming data back on the server side
|
|
36
|
+
* serverMuxer.addEventListener('stream', (evt) => {
|
|
37
|
+
* const stream = evt.detail
|
|
38
|
+
*
|
|
39
|
+
* stream.addEventListener('message', (msg) => {
|
|
40
|
+
* stream.send(msg.data)
|
|
41
|
+
* })
|
|
42
|
+
* })
|
|
43
|
+
*
|
|
44
|
+
* // open a stream from the client and send some data
|
|
45
|
+
* const stream = await clientMuxer.createStream()
|
|
46
|
+
*
|
|
47
|
+
* const received = new Promise<string>((resolve) => {
|
|
48
|
+
* stream.addEventListener('message', (msg) => {
|
|
49
|
+
* resolve(new TextDecoder().decode(msg.data.subarray()))
|
|
50
|
+
* })
|
|
51
|
+
* })
|
|
52
|
+
*
|
|
53
|
+
* stream.send(new TextEncoder().encode('hello world'))
|
|
54
|
+
*
|
|
55
|
+
* console.info(await received)
|
|
56
|
+
* // -> hello world
|
|
57
|
+
*
|
|
58
|
+
* await stream.close()
|
|
59
|
+
* await clientMuxer.close()
|
|
60
|
+
* await serverMuxer.close()
|
|
77
61
|
* ```
|
|
78
62
|
*/
|
|
79
|
-
import type { YamuxMuxer, YamuxMuxerInit } from './muxer.
|
|
63
|
+
import type { YamuxMuxer, YamuxMuxerInit } from './muxer.ts';
|
|
80
64
|
import type { StreamMuxerFactory } from '@libp2p/interface';
|
|
81
|
-
export { GoAwayCode } from './frame.
|
|
82
|
-
export type { FrameHeader, FrameType } from './frame.
|
|
65
|
+
export { GoAwayCode } from './frame.ts';
|
|
66
|
+
export type { FrameHeader, FrameType } from './frame.ts';
|
|
83
67
|
export type { YamuxMuxerInit };
|
|
84
68
|
export declare function yamux(init?: YamuxMuxerInit): () => StreamMuxerFactory<YamuxMuxer>;
|
|
85
69
|
//# sourceMappingURL=index.d.ts.map
|
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
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAC5D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AACvC,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AACxD,YAAY,EAAE,cAAc,EAAE,CAAA;AAE9B,wBAAgB,KAAK,CAAE,IAAI,GAAE,cAAmB,GAAG,MAAM,kBAAkB,CAAC,UAAU,CAAC,CAEtF"}
|
package/dist/src/index.js
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* This module is a JavaScript implementation of [Yamux from Hashicorp](https://github.com/hashicorp/yamux/blob/master/spec.md) designed to be used with [js-libp2p](https://github.com/libp2p/js-libp2p).
|
|
5
5
|
*
|
|
6
|
+
* Formerly published as [`@chainsafe/libp2p-yamux`](https://www.npmjs.com/package/@chainsafe/libp2p-yamux).
|
|
7
|
+
*
|
|
6
8
|
* @example Configure libp2p with Yamux
|
|
7
9
|
*
|
|
8
10
|
* ```typescript
|
|
@@ -19,65 +21,47 @@
|
|
|
19
21
|
*
|
|
20
22
|
* @example Using the low-level API
|
|
21
23
|
*
|
|
22
|
-
* ```
|
|
24
|
+
* ```typescript
|
|
23
25
|
* import { yamux } from '@libp2p/yamux'
|
|
24
|
-
* import {
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* const clientMuxer = yamux(
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
* // now either side can open streams
|
|
61
|
-
* const stream0 = clientMuxer.newStream()
|
|
62
|
-
* const stream1 = serverMuxer.newStream()
|
|
63
|
-
*
|
|
64
|
-
* // Send some data to the other side
|
|
65
|
-
* const encoder = new TextEncoder()
|
|
66
|
-
* const data = [encoder.encode('hello'), encoder.encode('world')]
|
|
67
|
-
* pipe(data, stream0)
|
|
68
|
-
*
|
|
69
|
-
* // Receive data back
|
|
70
|
-
* const result = await pipe(stream0, all)
|
|
71
|
-
*
|
|
72
|
-
* // close a stream
|
|
73
|
-
* stream1.close()
|
|
74
|
-
*
|
|
75
|
-
* // close the muxer
|
|
76
|
-
* clientMuxer.close()
|
|
26
|
+
* import { multiaddrConnectionPair } from '@libp2p/utils'
|
|
27
|
+
*
|
|
28
|
+
* // a pair of connected multiaddr connections - in a real application these
|
|
29
|
+
* // would be the two ends of a network connection
|
|
30
|
+
* const [outboundConnection, inboundConnection] = multiaddrConnectionPair()
|
|
31
|
+
*
|
|
32
|
+
* const clientMuxer = yamux()().createStreamMuxer(outboundConnection)
|
|
33
|
+
* const serverMuxer = yamux()().createStreamMuxer(inboundConnection)
|
|
34
|
+
*
|
|
35
|
+
* // echo incoming data back on the server side
|
|
36
|
+
* serverMuxer.addEventListener('stream', (evt) => {
|
|
37
|
+
* const stream = evt.detail
|
|
38
|
+
*
|
|
39
|
+
* stream.addEventListener('message', (msg) => {
|
|
40
|
+
* stream.send(msg.data)
|
|
41
|
+
* })
|
|
42
|
+
* })
|
|
43
|
+
*
|
|
44
|
+
* // open a stream from the client and send some data
|
|
45
|
+
* const stream = await clientMuxer.createStream()
|
|
46
|
+
*
|
|
47
|
+
* const received = new Promise<string>((resolve) => {
|
|
48
|
+
* stream.addEventListener('message', (msg) => {
|
|
49
|
+
* resolve(new TextDecoder().decode(msg.data.subarray()))
|
|
50
|
+
* })
|
|
51
|
+
* })
|
|
52
|
+
*
|
|
53
|
+
* stream.send(new TextEncoder().encode('hello world'))
|
|
54
|
+
*
|
|
55
|
+
* console.info(await received)
|
|
56
|
+
* // -> hello world
|
|
57
|
+
*
|
|
58
|
+
* await stream.close()
|
|
59
|
+
* await clientMuxer.close()
|
|
60
|
+
* await serverMuxer.close()
|
|
77
61
|
* ```
|
|
78
62
|
*/
|
|
79
|
-
import { Yamux } from
|
|
80
|
-
export { GoAwayCode } from
|
|
63
|
+
import { Yamux } from "./muxer.js";
|
|
64
|
+
export { GoAwayCode } from "./frame.js";
|
|
81
65
|
export function yamux(init = {}) {
|
|
82
66
|
return () => new Yamux(init);
|
|
83
67
|
}
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAIlC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAIvC,MAAM,UAAU,KAAK,CAAE,OAAuB,EAAE;IAC9C,OAAO,GAAG,EAAE,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAA;AAC9B,CAAC"}
|
package/dist/src/muxer.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { serviceCapabilities } from '@libp2p/interface';
|
|
2
2
|
import { AbstractStreamMuxer } from '@libp2p/utils';
|
|
3
3
|
import { Uint8ArrayList } from 'uint8arraylist';
|
|
4
|
-
import { GoAwayCode } from './frame.
|
|
5
|
-
import { YamuxStream } from './stream.
|
|
6
|
-
import type { Config } from './config.
|
|
4
|
+
import { GoAwayCode } from './frame.ts';
|
|
5
|
+
import { YamuxStream } from './stream.ts';
|
|
6
|
+
import type { Config } from './config.ts';
|
|
7
7
|
import type { AbortOptions, MessageStream, StreamMuxerFactory } from '@libp2p/interface';
|
|
8
8
|
export interface YamuxMuxerInit extends Partial<Config> {
|
|
9
9
|
}
|
package/dist/src/muxer.js
CHANGED
|
@@ -2,12 +2,12 @@ import { InvalidParametersError, MuxerClosedError, TooManyOutboundProtocolStream
|
|
|
2
2
|
import { AbstractStreamMuxer, repeatingTask } from '@libp2p/utils';
|
|
3
3
|
import { raceSignal } from 'race-signal';
|
|
4
4
|
import { Uint8ArrayList } from 'uint8arraylist';
|
|
5
|
-
import { defaultConfig, verifyConfig } from
|
|
6
|
-
import { Decoder } from
|
|
7
|
-
import { encodeHeader } from
|
|
8
|
-
import { InvalidFrameError, isProtocolError, NotMatchingPingError, UnRequestedPingError } from
|
|
9
|
-
import { Flag, FrameType, GoAwayCode } from
|
|
10
|
-
import { StreamState, YamuxStream } from
|
|
5
|
+
import { defaultConfig, verifyConfig } from "./config.js";
|
|
6
|
+
import { Decoder } from "./decode.js";
|
|
7
|
+
import { encodeHeader } from "./encode.js";
|
|
8
|
+
import { InvalidFrameError, isProtocolError, NotMatchingPingError, UnRequestedPingError } from "./errors.js";
|
|
9
|
+
import { Flag, FrameType, GoAwayCode } from "./frame.js";
|
|
10
|
+
import { StreamState, YamuxStream } from "./stream.js";
|
|
11
11
|
function debugFrame(header) {
|
|
12
12
|
return {
|
|
13
13
|
type: FrameType[header.type],
|
package/dist/src/stream.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AbstractStream } from '@libp2p/utils';
|
|
2
2
|
import { Uint8ArrayList } from 'uint8arraylist';
|
|
3
3
|
import type { Frame } from './decode.ts';
|
|
4
|
-
import type { FrameHeader } from './frame.
|
|
4
|
+
import type { FrameHeader } from './frame.ts';
|
|
5
5
|
import type { AbortOptions } from '@libp2p/interface';
|
|
6
6
|
import type { AbstractStreamInit, SendResult } from '@libp2p/utils';
|
|
7
7
|
export declare enum StreamState {
|
|
@@ -48,7 +48,7 @@ export declare class YamuxStream extends AbstractStream {
|
|
|
48
48
|
/**
|
|
49
49
|
* Send a reset message to the remote muxer
|
|
50
50
|
*/
|
|
51
|
-
sendReset():
|
|
51
|
+
sendReset(): void;
|
|
52
52
|
/**
|
|
53
53
|
* Send a message to the remote muxer, informing them no more data messages
|
|
54
54
|
* will be sent by this end of the stream
|
package/dist/src/stream.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../src/stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAK/C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAC7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAEnE,oBAAY,WAAW;IACrB,IAAI,IAAA;IACJ,OAAO,IAAA;IACP,WAAW,IAAA;IACX,WAAW,IAAA;IACX,QAAQ,IAAA;IACR,MAAM,IAAA;CACP;AAED,MAAM,WAAW,eAAgB,SAAQ,kBAAkB;IACzD,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,MAAM,EAAE,WAAW,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,OAAO,CAAA;IAC9D,MAAM,IAAI,MAAM,CAAA;IAChB,uBAAuB,CAAC,EAAE,MAAM,CAAA;IAChC,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,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OAGG;IACH,gBAAgB,IAAK,IAAI;CA4C1B"}
|
package/dist/src/stream.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { AbstractStream } from '@libp2p/utils';
|
|
2
2
|
import { Uint8ArrayList } from 'uint8arraylist';
|
|
3
|
-
import { INITIAL_STREAM_WINDOW, MAX_STREAM_WINDOW } from
|
|
3
|
+
import { INITIAL_STREAM_WINDOW, MAX_STREAM_WINDOW } from "./constants.js";
|
|
4
4
|
import { isDataFrame } from "./decode.js";
|
|
5
|
-
import { InvalidFrameError, ReceiveWindowExceededError } from
|
|
6
|
-
import { Flag, FrameType, HEADER_LENGTH } from
|
|
5
|
+
import { InvalidFrameError, ReceiveWindowExceededError } from "./errors.js";
|
|
6
|
+
import { Flag, FrameType, HEADER_LENGTH } from "./frame.js";
|
|
7
7
|
export var StreamState;
|
|
8
8
|
(function (StreamState) {
|
|
9
9
|
StreamState[StreamState["Init"] = 0] = "Init";
|
|
@@ -95,7 +95,7 @@ export class YamuxStream extends AbstractStream {
|
|
|
95
95
|
/**
|
|
96
96
|
* Send a reset message to the remote muxer
|
|
97
97
|
*/
|
|
98
|
-
|
|
98
|
+
sendReset() {
|
|
99
99
|
this.sendFrame({
|
|
100
100
|
type: FrameType.WindowUpdate,
|
|
101
101
|
flag: Flag.RST,
|
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,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAE,iBAAiB,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAA;AAC3E,OAAO,EAAE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I,CAAC,kBAAkB,IAAI,IAAI,CAAC,UAAU,IAAI,KAAK,KAAK,CAAC,EAAE,CAAC;YAC9D,+BAA+B;YAC/B,OAAM;QACR,CAAC;QAED,4BAA4B;QAC5B,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,kBAAkB,CAAA;QACvD,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC,UAAU,CAAA;QAEzC,yBAAyB;QACzB,IAAI,CAAC,UAAU,GAAG,GAAG,CAAA;QAErB,qBAAqB;QACrB,IAAI,CAAC,SAAS,CAAC;YACb,IAAI,EAAE,SAAS,CAAC,YAAY;YAC5B,IAAI,EAAE,KAAK;YACX,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,MAAM,EAAE,KAAK;SACd,CAAC,CAAA;IACJ,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@libp2p/yamux",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.2",
|
|
4
4
|
"description": "Yamux stream multiplexer for libp2p",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
6
|
"homepage": "https://github.com/libp2p/js-libp2p/tree/main/packages/stream-multiplexer-yamux#readme",
|
|
@@ -49,15 +49,18 @@
|
|
|
49
49
|
"exports": {
|
|
50
50
|
".": {
|
|
51
51
|
"types": "./dist/src/index.d.ts",
|
|
52
|
-
"import": "./dist/src/index.js"
|
|
52
|
+
"import": "./dist/src/index.js",
|
|
53
|
+
"module-sync": "./dist/src/index.js"
|
|
53
54
|
},
|
|
54
55
|
"./config": {
|
|
55
56
|
"types": "./dist/src/config.d.ts",
|
|
56
|
-
"import": "./dist/src/config.js"
|
|
57
|
+
"import": "./dist/src/config.js",
|
|
58
|
+
"module-sync": "./dist/src/config.js"
|
|
57
59
|
},
|
|
58
60
|
"./stream": {
|
|
59
61
|
"types": "./dist/src/stream.d.ts",
|
|
60
|
-
"import": "./dist/src/stream.js"
|
|
62
|
+
"import": "./dist/src/stream.js",
|
|
63
|
+
"module-sync": "./dist/src/stream.js"
|
|
61
64
|
}
|
|
62
65
|
},
|
|
63
66
|
"scripts": {
|
|
@@ -65,31 +68,31 @@
|
|
|
65
68
|
"lint": "aegir lint",
|
|
66
69
|
"dep-check": "aegir dep-check",
|
|
67
70
|
"doc-check": "aegir doc-check",
|
|
68
|
-
"benchmark": "benchmark dist/test/bench/*.bench.js --timeout 400000",
|
|
69
71
|
"build": "aegir build",
|
|
72
|
+
"benchmark": "benchmark dist/test/bench/*.bench.js --timeout 400000",
|
|
70
73
|
"test": "aegir test",
|
|
71
|
-
"test:chrome": "aegir test -t browser",
|
|
74
|
+
"test:chrome": "aegir test -t browser --cov",
|
|
72
75
|
"test:chrome-webworker": "aegir test -t webworker",
|
|
73
76
|
"test:firefox": "aegir test -t browser -- --browser firefox",
|
|
74
77
|
"test:firefox-webworker": "aegir test -t webworker -- --browser firefox",
|
|
75
78
|
"test:node": "aegir test -t node --cov",
|
|
76
|
-
"test:electron-main": "aegir test -t electron-main"
|
|
77
|
-
"docs": "aegir docs"
|
|
79
|
+
"test:electron-main": "aegir test -t electron-main"
|
|
78
80
|
},
|
|
79
81
|
"dependencies": {
|
|
80
|
-
"@libp2p/interface": "^3.
|
|
81
|
-
"@libp2p/utils": "^7.
|
|
82
|
+
"@libp2p/interface": "^3.3.0",
|
|
83
|
+
"@libp2p/utils": "^7.4.1",
|
|
82
84
|
"race-signal": "^2.0.0",
|
|
83
|
-
"uint8arraylist": "^
|
|
85
|
+
"uint8arraylist": "^3.0.2"
|
|
84
86
|
},
|
|
85
87
|
"devDependencies": {
|
|
86
88
|
"@dapplion/benchmark": "^1.0.0",
|
|
87
|
-
"@libp2p/interface-compliance-tests": "^7.0.
|
|
88
|
-
"@libp2p/mplex": "^12.0.
|
|
89
|
-
"aegir": "^
|
|
89
|
+
"@libp2p/interface-compliance-tests": "^7.0.31",
|
|
90
|
+
"@libp2p/mplex": "^12.0.31",
|
|
91
|
+
"aegir": "^48.1.1",
|
|
90
92
|
"it-all": "^3.0.9",
|
|
91
93
|
"it-drain": "^3.0.10",
|
|
92
94
|
"it-pushable": "^3.2.3",
|
|
93
95
|
"p-event": "^7.0.0"
|
|
94
|
-
}
|
|
96
|
+
},
|
|
97
|
+
"sideEffects": false
|
|
95
98
|
}
|
package/src/config.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { InvalidParametersError } from '@libp2p/interface'
|
|
2
|
-
import { INITIAL_STREAM_WINDOW, MAX_STREAM_WINDOW } from './constants.
|
|
2
|
+
import { INITIAL_STREAM_WINDOW, MAX_STREAM_WINDOW } from './constants.ts'
|
|
3
3
|
import type { StreamMuxerOptions, StreamOptions } from '@libp2p/interface'
|
|
4
4
|
|
|
5
5
|
export interface YamuxStreamOptions extends StreamOptions {
|
package/src/constants.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Protocol violation errors
|
|
2
2
|
|
|
3
|
-
import { BothClientsError, DecodeInvalidVersionError, InvalidFrameError, NotMatchingPingError, ReceiveWindowExceededError, StreamAlreadyExistsError, UnRequestedPingError } from './errors.
|
|
3
|
+
import { BothClientsError, DecodeInvalidVersionError, InvalidFrameError, NotMatchingPingError, ReceiveWindowExceededError, StreamAlreadyExistsError, UnRequestedPingError } from './errors.ts'
|
|
4
4
|
|
|
5
5
|
export const PROTOCOL_ERRORS = new Set([
|
|
6
6
|
InvalidFrameError.name,
|
package/src/decode.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Uint8ArrayList } from 'uint8arraylist'
|
|
2
|
-
import { InvalidFrameError } from './errors.
|
|
3
|
-
import { FrameType, HEADER_LENGTH, YAMUX_VERSION } from './frame.
|
|
4
|
-
import type { FrameHeader } from './frame.
|
|
2
|
+
import { InvalidFrameError } from './errors.ts'
|
|
3
|
+
import { FrameType, HEADER_LENGTH, YAMUX_VERSION } from './frame.ts'
|
|
4
|
+
import type { FrameHeader } from './frame.ts'
|
|
5
5
|
|
|
6
6
|
export interface Frame {
|
|
7
7
|
header: FrameHeader
|
package/src/encode.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { HEADER_LENGTH } from './frame.
|
|
2
|
-
import type { FrameHeader } from './frame.
|
|
1
|
+
import { HEADER_LENGTH } from './frame.ts'
|
|
2
|
+
import type { FrameHeader } from './frame.ts'
|
|
3
3
|
|
|
4
4
|
export function encodeHeader (header: FrameHeader): Uint8Array {
|
|
5
5
|
const frame = new Uint8Array(HEADER_LENGTH)
|