@libp2p/multistream-select 6.0.29 → 7.0.0-049bfa0fa
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/dist/index.min.js +9 -13
- package/dist/index.min.js.map +4 -4
- package/dist/src/handle.d.ts +3 -3
- package/dist/src/handle.d.ts.map +1 -1
- package/dist/src/handle.js +21 -20
- package/dist/src/handle.js.map +1 -1
- package/dist/src/index.d.ts +3 -8
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/multistream.d.ts +3 -17
- package/dist/src/multistream.d.ts.map +1 -1
- package/dist/src/multistream.js +5 -24
- package/dist/src/multistream.js.map +1 -1
- package/dist/src/select.d.ts +3 -10
- package/dist/src/select.d.ts.map +1 -1
- package/dist/src/select.js +34 -237
- package/dist/src/select.js.map +1 -1
- package/package.json +7 -12
- package/src/handle.ts +25 -22
- package/src/index.ts +3 -9
- package/src/multistream.ts +7 -32
- package/src/select.ts +39 -299
- package/dist/typedoc-urls.json +0 -10
package/dist/src/handle.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { MultistreamSelectInit
|
|
2
|
-
import type {
|
|
1
|
+
import type { MultistreamSelectInit } from './index.js';
|
|
2
|
+
import type { MultiaddrConnection, MessageStream } from '@libp2p/interface';
|
|
3
3
|
/**
|
|
4
4
|
* Handle multistream protocol selections for the given list of protocols.
|
|
5
5
|
*
|
|
@@ -46,5 +46,5 @@ import type { Duplex } from 'it-stream-types';
|
|
|
46
46
|
* })
|
|
47
47
|
* ```
|
|
48
48
|
*/
|
|
49
|
-
export declare function handle<Stream extends
|
|
49
|
+
export declare function handle<Stream extends MessageStream = MultiaddrConnection>(stream: Stream, protocols: string | string[], options?: MultistreamSelectInit): Promise<string>;
|
|
50
50
|
//# sourceMappingURL=handle.d.ts.map
|
package/dist/src/handle.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handle.d.ts","sourceRoot":"","sources":["../../src/handle.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,qBAAqB,EAAE,
|
|
1
|
+
{"version":3,"file":"handle.d.ts","sourceRoot":"","sources":["../../src/handle.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AACvD,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAE3E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,wBAAsB,MAAM,CAAE,MAAM,SAAS,aAAa,GAAG,mBAAmB,EAAG,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,OAAO,GAAE,qBAA0B,GAAG,OAAO,CAAC,MAAM,CAAC,CAkDrL"}
|
package/dist/src/handle.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { lpStream } from '@libp2p/utils';
|
|
1
2
|
import { encode } from 'it-length-prefixed';
|
|
2
|
-
import { lpStream } from 'it-length-prefixed-stream';
|
|
3
3
|
import { Uint8ArrayList } from 'uint8arraylist';
|
|
4
4
|
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string';
|
|
5
5
|
import { MAX_PROTOCOL_LENGTH, PROTOCOL_ID } from './constants.js';
|
|
6
|
-
import
|
|
6
|
+
import { readString } from './multistream.js';
|
|
7
7
|
/**
|
|
8
8
|
* Handle multistream protocol selections for the given list of protocols.
|
|
9
9
|
*
|
|
@@ -50,41 +50,42 @@ import * as multistream from './multistream.js';
|
|
|
50
50
|
* })
|
|
51
51
|
* ```
|
|
52
52
|
*/
|
|
53
|
-
export async function handle(stream, protocols, options) {
|
|
53
|
+
export async function handle(stream, protocols, options = {}) {
|
|
54
54
|
protocols = Array.isArray(protocols) ? protocols : [protocols];
|
|
55
|
-
|
|
55
|
+
const log = stream.log.newScope('mss:handle');
|
|
56
56
|
const lp = lpStream(stream, {
|
|
57
57
|
...options,
|
|
58
58
|
maxDataLength: MAX_PROTOCOL_LENGTH,
|
|
59
59
|
maxLengthLength: 2 // 2 bytes is enough to length-prefix MAX_PROTOCOL_LENGTH
|
|
60
60
|
});
|
|
61
61
|
while (true) {
|
|
62
|
-
|
|
63
|
-
const protocol = await
|
|
64
|
-
|
|
62
|
+
log.trace('reading incoming string');
|
|
63
|
+
const protocol = await readString(lp, options);
|
|
64
|
+
log.trace('read "%s"', protocol);
|
|
65
65
|
if (protocol === PROTOCOL_ID) {
|
|
66
|
-
|
|
67
|
-
await
|
|
68
|
-
|
|
66
|
+
log.trace('respond with "%s" for "%s"', PROTOCOL_ID, protocol);
|
|
67
|
+
await lp.write(uint8ArrayFromString(`${PROTOCOL_ID}\n`), options);
|
|
68
|
+
log.trace('responded with "%s" for "%s"', PROTOCOL_ID, protocol);
|
|
69
69
|
continue;
|
|
70
70
|
}
|
|
71
71
|
if (protocols.includes(protocol)) {
|
|
72
|
-
|
|
73
|
-
await
|
|
74
|
-
|
|
75
|
-
|
|
72
|
+
log.trace('respond with "%s" for "%s"', protocol, protocol);
|
|
73
|
+
await lp.write(uint8ArrayFromString(`${protocol}\n`), options);
|
|
74
|
+
log.trace('responded with "%s" for "%s"', protocol, protocol);
|
|
75
|
+
lp.unwrap();
|
|
76
|
+
return protocol;
|
|
76
77
|
}
|
|
77
78
|
if (protocol === 'ls') {
|
|
78
79
|
// <varint-msg-len><varint-proto-name-len><proto-name>\n<varint-proto-name-len><proto-name>\n\n
|
|
79
80
|
const protos = new Uint8ArrayList(...protocols.map(p => encode.single(uint8ArrayFromString(`${p}\n`))), uint8ArrayFromString('\n'));
|
|
80
|
-
|
|
81
|
-
await
|
|
82
|
-
|
|
81
|
+
log.trace('respond with "%s" for %s', protocols, protocol);
|
|
82
|
+
await lp.write(protos, options);
|
|
83
|
+
log.trace('responded with "%s" for %s', protocols, protocol);
|
|
83
84
|
continue;
|
|
84
85
|
}
|
|
85
|
-
|
|
86
|
-
await
|
|
87
|
-
|
|
86
|
+
log.trace('respond with "na" for "%s"', protocol);
|
|
87
|
+
await lp.write(uint8ArrayFromString('na\n'), options);
|
|
88
|
+
log('responded with "na" for "%s"', protocol);
|
|
88
89
|
}
|
|
89
90
|
}
|
|
90
91
|
//# sourceMappingURL=handle.js.map
|
package/dist/src/handle.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handle.js","sourceRoot":"","sources":["../../src/handle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"handle.js","sourceRoot":"","sources":["../../src/handle.ts"],"names":[],"mappings":"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"}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -20,14 +20,10 @@
|
|
|
20
20
|
* ```
|
|
21
21
|
*/
|
|
22
22
|
import { PROTOCOL_ID } from './constants.js';
|
|
23
|
-
import type { AbortOptions
|
|
24
|
-
import type { LengthPrefixedStreamOpts } from '
|
|
23
|
+
import type { AbortOptions } from '@libp2p/interface';
|
|
24
|
+
import type { LengthPrefixedStreamOpts } from '@libp2p/utils';
|
|
25
25
|
export { PROTOCOL_ID };
|
|
26
|
-
export interface
|
|
27
|
-
stream: Stream;
|
|
28
|
-
protocol: string;
|
|
29
|
-
}
|
|
30
|
-
export interface MultistreamSelectInit extends AbortOptions, LoggerOptions, Partial<LengthPrefixedStreamOpts> {
|
|
26
|
+
export interface MultistreamSelectInit extends AbortOptions, Partial<LengthPrefixedStreamOpts> {
|
|
31
27
|
/**
|
|
32
28
|
* When false, and only a single protocol is being negotiated, use optimistic
|
|
33
29
|
* select to send both the protocol name and the first data buffer in the
|
|
@@ -38,6 +34,5 @@ export interface MultistreamSelectInit extends AbortOptions, LoggerOptions, Part
|
|
|
38
34
|
negotiateFully?: boolean;
|
|
39
35
|
}
|
|
40
36
|
export { select } from './select.js';
|
|
41
|
-
export type { SelectStream } from './select.js';
|
|
42
37
|
export { handle } from './handle.js';
|
|
43
38
|
//# 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;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAA;AAE7D,OAAO,EAAE,WAAW,EAAE,CAAA;AAEtB,MAAM,WAAW,qBAAsB,SAAQ,YAAY,EAAE,OAAO,CAAC,wBAAwB,CAAC;IAC5F;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB;AAED,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA"}
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAI5C,OAAO,EAAE,WAAW,EAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAI5C,OAAO,EAAE,WAAW,EAAE,CAAA;AAatB,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA"}
|
|
@@ -1,21 +1,7 @@
|
|
|
1
|
-
import type { AbortOptions
|
|
2
|
-
import type { LengthPrefixedStream } from '
|
|
3
|
-
import type { Duplex, Source } from 'it-stream-types';
|
|
4
|
-
import type { Uint8ArrayList } from 'uint8arraylist';
|
|
5
|
-
/**
|
|
6
|
-
* `write` encodes and writes a single buffer
|
|
7
|
-
*/
|
|
8
|
-
export declare function write(writer: LengthPrefixedStream<Duplex<AsyncGenerator<Uint8Array | Uint8ArrayList>, Source<Uint8Array>>>, buffer: Uint8Array | Uint8ArrayList, options?: AbortOptions): Promise<void>;
|
|
9
|
-
/**
|
|
10
|
-
* `writeAll` behaves like `write`, except it encodes an array of items as a single write
|
|
11
|
-
*/
|
|
12
|
-
export declare function writeAll(writer: LengthPrefixedStream<Duplex<AsyncGenerator<Uint8Array | Uint8ArrayList>, Source<Uint8Array>>>, buffers: Uint8Array[], options?: AbortOptions): Promise<void>;
|
|
13
|
-
/**
|
|
14
|
-
* Read a length-prefixed buffer from the passed stream, stripping the final newline character
|
|
15
|
-
*/
|
|
16
|
-
export declare function read(reader: LengthPrefixedStream<Duplex<AsyncGenerator<Uint8Array | Uint8ArrayList>, Source<Uint8Array>>>, options: AbortOptions & LoggerOptions): Promise<Uint8ArrayList>;
|
|
1
|
+
import type { AbortOptions } from '@libp2p/interface';
|
|
2
|
+
import type { LengthPrefixedStream } from '@libp2p/utils';
|
|
17
3
|
/**
|
|
18
4
|
* Read a length-prefixed string from the passed stream, stripping the final newline character
|
|
19
5
|
*/
|
|
20
|
-
export declare function readString(reader: LengthPrefixedStream<
|
|
6
|
+
export declare function readString(reader: LengthPrefixedStream<any>, options?: AbortOptions): Promise<string>;
|
|
21
7
|
//# sourceMappingURL=multistream.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multistream.d.ts","sourceRoot":"","sources":["../../src/multistream.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"multistream.d.ts","sourceRoot":"","sources":["../../src/multistream.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAA;AAIzD;;GAEG;AACH,wBAAsB,UAAU,CAAE,MAAM,EAAE,oBAAoB,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CAS5G"}
|
package/dist/src/multistream.js
CHANGED
|
@@ -3,33 +3,14 @@ import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string';
|
|
|
3
3
|
import { toString as uint8ArrayToString } from 'uint8arrays/to-string';
|
|
4
4
|
const NewLine = uint8ArrayFromString('\n');
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
export async function write(writer, buffer, options) {
|
|
9
|
-
await writer.write(buffer, options);
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* `writeAll` behaves like `write`, except it encodes an array of items as a single write
|
|
13
|
-
*/
|
|
14
|
-
export async function writeAll(writer, buffers, options) {
|
|
15
|
-
await writer.writeV(buffers, options);
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Read a length-prefixed buffer from the passed stream, stripping the final newline character
|
|
6
|
+
* Read a length-prefixed string from the passed stream, stripping the final newline character
|
|
19
7
|
*/
|
|
20
|
-
export async function
|
|
8
|
+
export async function readString(reader, options) {
|
|
21
9
|
const buf = await reader.read(options);
|
|
22
|
-
|
|
23
|
-
|
|
10
|
+
const arr = buf.subarray();
|
|
11
|
+
if (arr.byteLength === 0 || arr[arr.length - 1] !== NewLine[0]) {
|
|
24
12
|
throw new InvalidMessageError('Missing newline');
|
|
25
13
|
}
|
|
26
|
-
return
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Read a length-prefixed string from the passed stream, stripping the final newline character
|
|
30
|
-
*/
|
|
31
|
-
export async function readString(reader, options) {
|
|
32
|
-
const buf = await read(reader, options);
|
|
33
|
-
return uint8ArrayToString(buf.subarray());
|
|
14
|
+
return uint8ArrayToString(arr).trimEnd();
|
|
34
15
|
}
|
|
35
16
|
//# sourceMappingURL=multistream.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multistream.js","sourceRoot":"","sources":["../../src/multistream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AACvD,OAAO,EAAE,UAAU,IAAI,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAC5E,OAAO,EAAE,QAAQ,IAAI,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"multistream.js","sourceRoot":"","sources":["../../src/multistream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AACvD,OAAO,EAAE,UAAU,IAAI,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAC5E,OAAO,EAAE,QAAQ,IAAI,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAItE,MAAM,OAAO,GAAG,oBAAoB,CAAC,IAAI,CAAC,CAAA;AAE1C;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAE,MAAiC,EAAE,OAAsB;IACzF,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IACtC,MAAM,GAAG,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAA;IAE1B,IAAI,GAAG,CAAC,UAAU,KAAK,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/D,MAAM,IAAI,mBAAmB,CAAC,iBAAiB,CAAC,CAAA;IAClD,CAAC;IAED,OAAO,kBAAkB,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,CAAA;AAC1C,CAAC"}
|
package/dist/src/select.d.ts
CHANGED
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
import type { MultistreamSelectInit
|
|
2
|
-
import type {
|
|
3
|
-
import type { Duplex } from 'it-stream-types';
|
|
4
|
-
export interface SelectStream extends Duplex<any, any, any> {
|
|
5
|
-
readStatus?: string;
|
|
6
|
-
closeWrite?(options?: AbortOptions): Promise<void>;
|
|
7
|
-
closeRead?(options?: AbortOptions): Promise<void>;
|
|
8
|
-
close?(options?: AbortOptions): Promise<void>;
|
|
9
|
-
}
|
|
1
|
+
import type { MultistreamSelectInit } from './index.js';
|
|
2
|
+
import type { MessageStream } from '@libp2p/interface';
|
|
10
3
|
/**
|
|
11
4
|
* Negotiate a protocol to use from a list of protocols.
|
|
12
5
|
*
|
|
@@ -50,5 +43,5 @@ export interface SelectStream extends Duplex<any, any, any> {
|
|
|
50
43
|
* // }
|
|
51
44
|
* ```
|
|
52
45
|
*/
|
|
53
|
-
export declare function select<Stream extends
|
|
46
|
+
export declare function select<Stream extends MessageStream>(stream: Stream, protocols: string | string[], options?: MultistreamSelectInit): Promise<string>;
|
|
54
47
|
//# sourceMappingURL=select.d.ts.map
|
package/dist/src/select.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../src/select.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../src/select.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,wBAAsB,MAAM,CAAE,MAAM,SAAS,aAAa,EAAG,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,OAAO,GAAE,qBAA0B,GAAG,OAAO,CAAC,MAAM,CAAC,CAoD/J"}
|
package/dist/src/select.js
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import { UnsupportedProtocolError } from '@libp2p/interface';
|
|
2
|
-
import { lpStream } from '
|
|
3
|
-
import pDefer from 'p-defer';
|
|
4
|
-
import { raceSignal } from 'race-signal';
|
|
5
|
-
import * as varint from 'uint8-varint';
|
|
6
|
-
import { Uint8ArrayList } from 'uint8arraylist';
|
|
2
|
+
import { lpStream } from '@libp2p/utils';
|
|
7
3
|
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string';
|
|
8
4
|
import { MAX_PROTOCOL_LENGTH } from './constants.js';
|
|
9
|
-
import
|
|
5
|
+
import { readString } from './multistream.js';
|
|
10
6
|
import { PROTOCOL_ID } from './index.js';
|
|
11
7
|
/**
|
|
12
8
|
* Negotiate a protocol to use from a list of protocols.
|
|
@@ -51,247 +47,48 @@ import { PROTOCOL_ID } from './index.js';
|
|
|
51
47
|
* // }
|
|
52
48
|
* ```
|
|
53
49
|
*/
|
|
54
|
-
export async function select(stream, protocols, options) {
|
|
50
|
+
export async function select(stream, protocols, options = {}) {
|
|
55
51
|
protocols = Array.isArray(protocols) ? [...protocols] : [protocols];
|
|
56
|
-
if (protocols.length ===
|
|
57
|
-
return optimisticSelect(stream, protocols[0], options);
|
|
58
|
-
}
|
|
59
|
-
const lp = lpStream(stream, {
|
|
60
|
-
...options,
|
|
61
|
-
maxDataLength: MAX_PROTOCOL_LENGTH
|
|
62
|
-
});
|
|
63
|
-
const protocol = protocols.shift();
|
|
64
|
-
if (protocol == null) {
|
|
52
|
+
if (protocols.length === 0) {
|
|
65
53
|
throw new Error('At least one protocol must be specified');
|
|
66
54
|
}
|
|
67
|
-
|
|
68
|
-
const
|
|
69
|
-
const p2 = uint8ArrayFromString(`${protocol}\n`);
|
|
70
|
-
await multistream.writeAll(lp, [p1, p2], options);
|
|
71
|
-
options.log.trace('select: reading multistream-select header');
|
|
72
|
-
let response = await multistream.readString(lp, options);
|
|
73
|
-
options.log.trace('select: read "%s"', response);
|
|
74
|
-
// Read the protocol response if we got the protocolId in return
|
|
75
|
-
if (response === PROTOCOL_ID) {
|
|
76
|
-
options.log.trace('select: reading protocol response');
|
|
77
|
-
response = await multistream.readString(lp, options);
|
|
78
|
-
options.log.trace('select: read "%s"', response);
|
|
79
|
-
}
|
|
80
|
-
// We're done
|
|
81
|
-
if (response === protocol) {
|
|
82
|
-
return { stream: lp.unwrap(), protocol };
|
|
83
|
-
}
|
|
84
|
-
// We haven't gotten a valid ack, try the other protocols
|
|
85
|
-
for (const protocol of protocols) {
|
|
86
|
-
options.log.trace('select: write "%s"', protocol);
|
|
87
|
-
await multistream.write(lp, uint8ArrayFromString(`${protocol}\n`), options);
|
|
88
|
-
options.log.trace('select: reading protocol response');
|
|
89
|
-
const response = await multistream.readString(lp, options);
|
|
90
|
-
options.log.trace('select: read "%s" for "%s"', response, protocol);
|
|
91
|
-
if (response === protocol) {
|
|
92
|
-
return { stream: lp.unwrap(), protocol };
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
throw new UnsupportedProtocolError('protocol selection failed');
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Optimistically negotiates a protocol.
|
|
99
|
-
*
|
|
100
|
-
* It *does not* block writes waiting for the other end to respond. Instead, it
|
|
101
|
-
* simply assumes the negotiation went successfully and starts writing data.
|
|
102
|
-
*
|
|
103
|
-
* Use when it is known that the receiver supports the desired protocol.
|
|
104
|
-
*/
|
|
105
|
-
function optimisticSelect(stream, protocol, options) {
|
|
106
|
-
const originalSink = stream.sink.bind(stream);
|
|
107
|
-
const originalSource = stream.source;
|
|
108
|
-
let negotiated = false;
|
|
109
|
-
let negotiating = false;
|
|
110
|
-
const doneNegotiating = pDefer();
|
|
111
|
-
let sentProtocol = false;
|
|
112
|
-
let sendingProtocol = false;
|
|
113
|
-
const doneSendingProtocol = pDefer();
|
|
114
|
-
let readProtocol = false;
|
|
115
|
-
let readingProtocol = false;
|
|
116
|
-
const doneReadingProtocol = pDefer();
|
|
117
|
-
const lp = lpStream({
|
|
118
|
-
sink: originalSink,
|
|
119
|
-
source: originalSource
|
|
120
|
-
}, {
|
|
55
|
+
const log = stream.log.newScope('mss:select');
|
|
56
|
+
const lp = lpStream(stream, {
|
|
121
57
|
...options,
|
|
122
58
|
maxDataLength: MAX_PROTOCOL_LENGTH
|
|
123
59
|
});
|
|
124
|
-
|
|
125
|
-
const
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
uint8ArrayFromString(`${PROTOCOL_ID}\n`), varint.encode(protocolString.length), uint8ArrayFromString(protocolString), buf).subarray();
|
|
141
|
-
options.log.trace('optimistic: wrote ["%s", "%s", data(%d)] in sink', PROTOCOL_ID, protocol, buf.byteLength);
|
|
142
|
-
sentProtocol = true;
|
|
143
|
-
sendingProtocol = false;
|
|
144
|
-
doneSendingProtocol.resolve();
|
|
145
|
-
// read the negotiation response but don't block more sending
|
|
146
|
-
negotiate()
|
|
147
|
-
.catch(err => {
|
|
148
|
-
options.log.error('could not finish optimistic protocol negotiation of %s', protocol, err);
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
else {
|
|
152
|
-
yield buf;
|
|
153
|
-
}
|
|
154
|
-
sentData = true;
|
|
155
|
-
}
|
|
156
|
-
// special case - the source passed to the sink has ended but we didn't
|
|
157
|
-
// negotiated the protocol yet so do it now
|
|
158
|
-
if (!sentData) {
|
|
159
|
-
await negotiate();
|
|
160
|
-
}
|
|
161
|
-
}());
|
|
162
|
-
};
|
|
163
|
-
async function negotiate() {
|
|
164
|
-
if (negotiating) {
|
|
165
|
-
options.log.trace('optimistic: already negotiating %s stream', protocol);
|
|
166
|
-
await doneNegotiating.promise;
|
|
167
|
-
return;
|
|
168
|
-
}
|
|
169
|
-
negotiating = true;
|
|
170
|
-
try {
|
|
171
|
-
// we haven't sent the protocol yet, send it now
|
|
172
|
-
if (!sentProtocol) {
|
|
173
|
-
options.log.trace('optimistic: doing send protocol for %s stream', protocol);
|
|
174
|
-
await doSendProtocol();
|
|
175
|
-
}
|
|
176
|
-
// if we haven't read the protocol response yet, do it now
|
|
177
|
-
if (!readProtocol) {
|
|
178
|
-
options.log.trace('optimistic: doing read protocol for %s stream', protocol);
|
|
179
|
-
await doReadProtocol();
|
|
60
|
+
for (let i = 0; i < protocols.length; i++) {
|
|
61
|
+
const protocol = protocols[i];
|
|
62
|
+
let response;
|
|
63
|
+
if (i === 0) {
|
|
64
|
+
// Write the multistream-select header along with the first protocol
|
|
65
|
+
log.trace('write ["%s", "%s"]', PROTOCOL_ID, protocol);
|
|
66
|
+
const p1 = uint8ArrayFromString(`${PROTOCOL_ID}\n`);
|
|
67
|
+
const p2 = uint8ArrayFromString(`${protocol}\n`);
|
|
68
|
+
await lp.writeV([p1, p2], options);
|
|
69
|
+
log.trace('reading multistream-select header');
|
|
70
|
+
response = await readString(lp, options);
|
|
71
|
+
log.trace('read "%s"', response);
|
|
72
|
+
// Read the protocol response if we got the protocolId in return
|
|
73
|
+
if (response !== PROTOCOL_ID) {
|
|
74
|
+
log.error('did not read multistream-select header from response');
|
|
75
|
+
break;
|
|
180
76
|
}
|
|
181
77
|
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
78
|
+
else {
|
|
79
|
+
// We haven't gotten a valid ack, try the other protocols
|
|
80
|
+
log.trace('write "%s"', protocol);
|
|
81
|
+
await lp.write(uint8ArrayFromString(`${protocol}\n`), options);
|
|
186
82
|
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
try {
|
|
195
|
-
options.log.trace('optimistic: write ["%s", "%s", data] in source', PROTOCOL_ID, protocol);
|
|
196
|
-
await lp.writeV([
|
|
197
|
-
uint8ArrayFromString(`${PROTOCOL_ID}\n`),
|
|
198
|
-
uint8ArrayFromString(`${protocol}\n`)
|
|
199
|
-
]);
|
|
200
|
-
options.log.trace('optimistic: wrote ["%s", "%s", data] in source', PROTOCOL_ID, protocol);
|
|
201
|
-
}
|
|
202
|
-
finally {
|
|
203
|
-
sentProtocol = true;
|
|
204
|
-
sendingProtocol = false;
|
|
205
|
-
doneSendingProtocol.resolve();
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
async function doReadProtocol() {
|
|
209
|
-
if (readingProtocol) {
|
|
210
|
-
await doneReadingProtocol.promise;
|
|
211
|
-
return;
|
|
212
|
-
}
|
|
213
|
-
readingProtocol = true;
|
|
214
|
-
try {
|
|
215
|
-
options.log.trace('optimistic: reading multistream select header');
|
|
216
|
-
let response = await multistream.readString(lp, options);
|
|
217
|
-
options.log.trace('optimistic: read multistream select header "%s"', response);
|
|
218
|
-
if (response === PROTOCOL_ID) {
|
|
219
|
-
response = await multistream.readString(lp, options);
|
|
220
|
-
}
|
|
221
|
-
options.log.trace('optimistic: read protocol "%s", expecting "%s"', response, protocol);
|
|
222
|
-
if (response !== protocol) {
|
|
223
|
-
throw new UnsupportedProtocolError('protocol selection failed');
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
finally {
|
|
227
|
-
readProtocol = true;
|
|
228
|
-
readingProtocol = false;
|
|
229
|
-
doneReadingProtocol.resolve();
|
|
83
|
+
log.trace('reading protocol response');
|
|
84
|
+
response = await readString(lp, options);
|
|
85
|
+
log.trace('read "%s"', response);
|
|
86
|
+
if (response === protocol) {
|
|
87
|
+
log.trace('selected "%s" after negotiation', response);
|
|
88
|
+
lp.unwrap();
|
|
89
|
+
return protocol;
|
|
230
90
|
}
|
|
231
91
|
}
|
|
232
|
-
|
|
233
|
-
// make sure we've done protocol negotiation before we read stream data
|
|
234
|
-
await negotiate();
|
|
235
|
-
options.log.trace('optimistic: reading data from "%s" stream', protocol);
|
|
236
|
-
yield* lp.unwrap().source;
|
|
237
|
-
})();
|
|
238
|
-
if (stream.closeRead != null) {
|
|
239
|
-
const originalCloseRead = stream.closeRead.bind(stream);
|
|
240
|
-
stream.closeRead = async (opts) => {
|
|
241
|
-
// we need to read & write to negotiate the protocol so ensure we've done
|
|
242
|
-
// this before closing the readable end of the stream
|
|
243
|
-
if (!negotiated) {
|
|
244
|
-
await negotiate().catch(err => {
|
|
245
|
-
options.log.error('could not negotiate protocol before close read', err);
|
|
246
|
-
});
|
|
247
|
-
}
|
|
248
|
-
// protocol has been negotiated, ok to close the readable end
|
|
249
|
-
await originalCloseRead(opts);
|
|
250
|
-
};
|
|
251
|
-
}
|
|
252
|
-
if (stream.closeWrite != null) {
|
|
253
|
-
const originalCloseWrite = stream.closeWrite.bind(stream);
|
|
254
|
-
stream.closeWrite = async (opts) => {
|
|
255
|
-
// we need to read & write to negotiate the protocol so ensure we've done
|
|
256
|
-
// this before closing the writable end of the stream
|
|
257
|
-
if (!negotiated) {
|
|
258
|
-
await negotiate().catch(err => {
|
|
259
|
-
options.log.error('could not negotiate protocol before close write', err);
|
|
260
|
-
});
|
|
261
|
-
}
|
|
262
|
-
// protocol has been negotiated, ok to close the writable end
|
|
263
|
-
await originalCloseWrite(opts);
|
|
264
|
-
};
|
|
265
|
-
}
|
|
266
|
-
if (stream.close != null) {
|
|
267
|
-
const originalClose = stream.close.bind(stream);
|
|
268
|
-
stream.close = async (opts) => {
|
|
269
|
-
// if we are in the process of negotiation, let it finish before closing
|
|
270
|
-
// because we may have unsent early data
|
|
271
|
-
const tasks = [];
|
|
272
|
-
if (sendingProtocol) {
|
|
273
|
-
tasks.push(doneSendingProtocol.promise);
|
|
274
|
-
}
|
|
275
|
-
if (readingProtocol) {
|
|
276
|
-
tasks.push(doneReadingProtocol.promise);
|
|
277
|
-
}
|
|
278
|
-
if (tasks.length > 0) {
|
|
279
|
-
// let the in-flight protocol negotiation finish gracefully
|
|
280
|
-
await raceSignal(Promise.all(tasks), opts?.signal);
|
|
281
|
-
}
|
|
282
|
-
else {
|
|
283
|
-
// no protocol negotiation attempt has occurred so don't start one
|
|
284
|
-
negotiated = true;
|
|
285
|
-
negotiating = false;
|
|
286
|
-
doneNegotiating.resolve();
|
|
287
|
-
}
|
|
288
|
-
// protocol has been negotiated, ok to close the writable end
|
|
289
|
-
await originalClose(opts);
|
|
290
|
-
};
|
|
291
|
-
}
|
|
292
|
-
return {
|
|
293
|
-
stream,
|
|
294
|
-
protocol
|
|
295
|
-
};
|
|
92
|
+
throw new UnsupportedProtocolError(`Protocol selection failed - could not negotiate ${protocols}`);
|
|
296
93
|
}
|
|
297
94
|
//# sourceMappingURL=select.js.map
|
package/dist/src/select.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.js","sourceRoot":"","sources":["../../src/select.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAA;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"select.js","sourceRoot":"","sources":["../../src/select.ts"],"names":[],"mappings":"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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@libp2p/multistream-select",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0-049bfa0fa",
|
|
4
4
|
"description": "JavaScript implementation of multistream-select",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
6
|
"homepage": "https://github.com/libp2p/js-libp2p/tree/main/packages/multistream-select#readme",
|
|
@@ -51,24 +51,19 @@
|
|
|
51
51
|
"test:electron-main": "aegir test -t electron-main"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@libp2p/interface": "
|
|
54
|
+
"@libp2p/interface": "3.0.0-049bfa0fa",
|
|
55
|
+
"@libp2p/utils": "7.0.0-049bfa0fa",
|
|
55
56
|
"it-length-prefixed": "^10.0.1",
|
|
56
|
-
"it-length-prefixed-stream": "^2.0.2",
|
|
57
|
-
"it-stream-types": "^2.0.2",
|
|
58
|
-
"p-defer": "^4.0.1",
|
|
59
|
-
"race-signal": "^1.1.3",
|
|
60
|
-
"uint8-varint": "^2.0.4",
|
|
61
57
|
"uint8arraylist": "^2.4.8",
|
|
62
58
|
"uint8arrays": "^5.1.0"
|
|
63
59
|
},
|
|
64
60
|
"devDependencies": {
|
|
65
|
-
"
|
|
66
|
-
"aegir": "^47.0.14",
|
|
61
|
+
"aegir": "^47.0.22",
|
|
67
62
|
"iso-random-stream": "^2.0.2",
|
|
68
|
-
"it-all": "^3.0.
|
|
69
|
-
"it-drain": "^3.0.
|
|
70
|
-
"it-pair": "^2.0.6",
|
|
63
|
+
"it-all": "^3.0.9",
|
|
64
|
+
"it-drain": "^3.0.10",
|
|
71
65
|
"it-pipe": "^3.0.1",
|
|
66
|
+
"p-event": "^6.0.1",
|
|
72
67
|
"p-timeout": "^6.1.4"
|
|
73
68
|
},
|
|
74
69
|
"sideEffects": false
|