@libp2p/webrtc 5.2.23-cf9aab5c8 → 5.2.24-0f07e3df5
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 +10 -20
- package/dist/index.min.js +18 -18
- package/dist/index.min.js.map +4 -4
- package/dist/src/constants.d.ts +0 -23
- package/dist/src/constants.d.ts.map +1 -1
- package/dist/src/constants.js +0 -23
- package/dist/src/constants.js.map +1 -1
- package/dist/src/index.d.ts +12 -22
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +12 -22
- package/dist/src/index.js.map +1 -1
- package/dist/src/muxer.d.ts +14 -46
- package/dist/src/muxer.d.ts.map +1 -1
- package/dist/src/muxer.js +32 -135
- package/dist/src/muxer.js.map +1 -1
- package/dist/src/private-to-private/initiate-connection.d.ts +2 -3
- package/dist/src/private-to-private/initiate-connection.d.ts.map +1 -1
- package/dist/src/private-to-private/initiate-connection.js +23 -5
- package/dist/src/private-to-private/initiate-connection.js.map +1 -1
- package/dist/src/private-to-private/signaling-stream-handler.d.ts +4 -4
- package/dist/src/private-to-private/signaling-stream-handler.d.ts.map +1 -1
- package/dist/src/private-to-private/signaling-stream-handler.js +10 -6
- package/dist/src/private-to-private/signaling-stream-handler.js.map +1 -1
- package/dist/src/private-to-private/transport.d.ts +2 -2
- package/dist/src/private-to-private/transport.d.ts.map +1 -1
- package/dist/src/private-to-private/transport.js +30 -15
- package/dist/src/private-to-private/transport.js.map +1 -1
- package/dist/src/private-to-private/util.d.ts +3 -1
- package/dist/src/private-to-private/util.d.ts.map +1 -1
- package/dist/src/private-to-private/util.js +15 -3
- package/dist/src/private-to-private/util.js.map +1 -1
- package/dist/src/private-to-public/listener.d.ts.map +1 -1
- package/dist/src/private-to-public/listener.js +21 -15
- package/dist/src/private-to-public/listener.js.map +1 -1
- package/dist/src/private-to-public/transport.d.ts.map +1 -1
- package/dist/src/private-to-public/transport.js +3 -2
- package/dist/src/private-to-public/transport.js.map +1 -1
- package/dist/src/private-to-public/utils/connect.d.ts +1 -1
- package/dist/src/private-to-public/utils/connect.d.ts.map +1 -1
- package/dist/src/private-to-public/utils/connect.js +17 -14
- package/dist/src/private-to-public/utils/connect.js.map +1 -1
- package/dist/src/private-to-public/utils/get-rtcpeerconnection.d.ts +4 -4
- package/dist/src/private-to-public/utils/get-rtcpeerconnection.d.ts.map +1 -1
- package/dist/src/private-to-public/utils/get-rtcpeerconnection.js +13 -2
- package/dist/src/private-to-public/utils/get-rtcpeerconnection.js.map +1 -1
- package/dist/src/private-to-public/utils/sdp.d.ts.map +1 -1
- package/dist/src/private-to-public/utils/sdp.js +25 -13
- package/dist/src/private-to-public/utils/sdp.js.map +1 -1
- package/dist/src/private-to-public/utils/stun-listener.js +1 -1
- package/dist/src/private-to-public/utils/stun-listener.js.map +1 -1
- package/dist/src/rtcpeerconnection-to-conn.d.ts +12 -0
- package/dist/src/rtcpeerconnection-to-conn.d.ts.map +1 -0
- package/dist/src/rtcpeerconnection-to-conn.js +43 -0
- package/dist/src/rtcpeerconnection-to-conn.js.map +1 -0
- package/dist/src/stream.d.ts +13 -26
- package/dist/src/stream.d.ts.map +1 -1
- package/dist/src/stream.js +64 -166
- package/dist/src/stream.js.map +1 -1
- package/dist/src/util.d.ts +3 -1
- package/dist/src/util.d.ts.map +1 -1
- package/dist/src/util.js +19 -0
- package/dist/src/util.js.map +1 -1
- package/dist/src/webrtc/index.d.ts +1 -1
- package/dist/src/webrtc/index.d.ts.map +1 -1
- package/dist/src/webrtc/index.js +1 -1
- package/dist/src/webrtc/index.js.map +1 -1
- package/package.json +26 -29
- package/src/constants.ts +0 -28
- package/src/index.ts +12 -22
- package/src/muxer.ts +43 -166
- package/src/private-to-private/initiate-connection.ts +30 -8
- package/src/private-to-private/signaling-stream-handler.ts +12 -9
- package/src/private-to-private/transport.ts +33 -17
- package/src/private-to-private/util.ts +21 -4
- package/src/private-to-public/listener.ts +22 -15
- package/src/private-to-public/transport.ts +3 -2
- package/src/private-to-public/utils/connect.ts +18 -15
- package/src/private-to-public/utils/get-rtcpeerconnection.ts +16 -4
- package/src/private-to-public/utils/sdp.ts +29 -13
- package/src/private-to-public/utils/stun-listener.ts +1 -1
- package/src/rtcpeerconnection-to-conn.ts +62 -0
- package/src/stream.ts +74 -194
- package/src/util.ts +22 -1
- package/src/webrtc/index.ts +1 -1
- package/dist/src/maconn.d.ts +0 -58
- package/dist/src/maconn.d.ts.map +0 -1
- package/dist/src/maconn.js +0 -56
- package/dist/src/maconn.js.map +0 -1
- package/src/maconn.ts +0 -101
package/dist/src/constants.d.ts
CHANGED
@@ -15,22 +15,10 @@ export declare const UFRAG_ALPHABET: string[];
|
|
15
15
|
* Used to detect the version of the WebRTC Direct connection protocol in use
|
16
16
|
*/
|
17
17
|
export declare const UFRAG_PREFIX = "libp2p+webrtc+v1/";
|
18
|
-
/**
|
19
|
-
* The multicodec code for webrtc-direct tuples
|
20
|
-
*/
|
21
|
-
export declare const CODEC_WEBRTC_DIRECT = 280;
|
22
|
-
/**
|
23
|
-
* The multicodec code for certhash tuples
|
24
|
-
*/
|
25
|
-
export declare const CODEC_CERTHASH = 466;
|
26
18
|
/**
|
27
19
|
* How much can be buffered to the DataChannel at once
|
28
20
|
*/
|
29
21
|
export declare const MAX_BUFFERED_AMOUNT: number;
|
30
|
-
/**
|
31
|
-
* How long time we wait for the 'bufferedamountlow' event to be emitted
|
32
|
-
*/
|
33
|
-
export declare const BUFFERED_AMOUNT_LOW_TIMEOUT: number;
|
34
22
|
/**
|
35
23
|
* Max message size that can be sent to the DataChannel. In browsers this is
|
36
24
|
* 256KiB but go-libp2p and rust-libp2p only support 16KiB at the time of
|
@@ -45,17 +33,6 @@ export declare const MAX_MESSAGE_SIZE: number;
|
|
45
33
|
* protobuf that aren't message field bytes
|
46
34
|
*/
|
47
35
|
export declare const PROTOBUF_OVERHEAD: number;
|
48
|
-
/**
|
49
|
-
* When closing streams we send a FIN then wait for the remote to
|
50
|
-
* reply with a FIN_ACK. If that does not happen within this timeout
|
51
|
-
* we close the stream anyway.
|
52
|
-
*/
|
53
|
-
export declare const FIN_ACK_TIMEOUT = 5000;
|
54
|
-
/**
|
55
|
-
* When sending data messages, if the channel is not in the "open" state, wait
|
56
|
-
* this long for the "open" event to fire.
|
57
|
-
*/
|
58
|
-
export declare const OPEN_TIMEOUT = 5000;
|
59
36
|
/**
|
60
37
|
* When closing a stream, we wait for `bufferedAmount` to become 0 before
|
61
38
|
* closing the underlying RTCDataChannel - this controls how long we wait in ms
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,UAK/B,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,cAAc,UAA+E,CAAA;AAE1G;;GAEG;AACH,eAAO,MAAM,YAAY,sBAAsB,CAAA;AAE/C;;GAEG;AACH,eAAO,MAAM,mBAAmB,
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,UAK/B,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,cAAc,UAA+E,CAAA;AAE1G;;GAEG;AACH,eAAO,MAAM,YAAY,sBAAsB,CAAA;AAE/C;;GAEG;AACH,eAAO,MAAM,mBAAmB,QAAkB,CAAA;AAElD;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,QAAY,CAAA;AAsBzC;;;GAGG;AACH,eAAO,MAAM,iBAAiB,QAA8B,CAAA;AAE5D;;;GAGG;AACH,eAAO,MAAM,0BAA0B,QAAS,CAAA;AAEhD;;GAEG;AACH,eAAO,MAAM,cAAc,YAAY,CAAA;AAEvC;;GAEG;AACH,eAAO,MAAM,kBAAkB,4BAA4B,CAAA;AAE3D;;GAEG;AACH,eAAO,MAAM,iCAAiC,sCAAsC,CAAA;AAEpF;;GAEG;AACH,eAAO,MAAM,oCAAoC,0CAA0C,CAAA;AAE3F;;GAEG;AACH,eAAO,MAAM,oCAAoC,UAAU,CAAA;AAE3D;;GAEG;AACH,eAAO,MAAM,4BAA4B,aAAgB,CAAA;AAEzD;;GAEG;AACH,eAAO,MAAM,qCAAqC,WAAa,CAAA"}
|
package/dist/src/constants.js
CHANGED
@@ -22,22 +22,10 @@ export const UFRAG_ALPHABET = Array.from('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKL
|
|
22
22
|
* Used to detect the version of the WebRTC Direct connection protocol in use
|
23
23
|
*/
|
24
24
|
export const UFRAG_PREFIX = 'libp2p+webrtc+v1/';
|
25
|
-
/**
|
26
|
-
* The multicodec code for webrtc-direct tuples
|
27
|
-
*/
|
28
|
-
export const CODEC_WEBRTC_DIRECT = 0x0118;
|
29
|
-
/**
|
30
|
-
* The multicodec code for certhash tuples
|
31
|
-
*/
|
32
|
-
export const CODEC_CERTHASH = 0x01d2;
|
33
25
|
/**
|
34
26
|
* How much can be buffered to the DataChannel at once
|
35
27
|
*/
|
36
28
|
export const MAX_BUFFERED_AMOUNT = 2 * 1024 * 1024;
|
37
|
-
/**
|
38
|
-
* How long time we wait for the 'bufferedamountlow' event to be emitted
|
39
|
-
*/
|
40
|
-
export const BUFFERED_AMOUNT_LOW_TIMEOUT = 30 * 1000;
|
41
29
|
/**
|
42
30
|
* Max message size that can be sent to the DataChannel. In browsers this is
|
43
31
|
* 256KiB but go-libp2p and rust-libp2p only support 16KiB at the time of
|
@@ -69,17 +57,6 @@ function calculateProtobufOverhead(maxMessageSize = MAX_MESSAGE_SIZE) {
|
|
69
57
|
* protobuf that aren't message field bytes
|
70
58
|
*/
|
71
59
|
export const PROTOBUF_OVERHEAD = calculateProtobufOverhead();
|
72
|
-
/**
|
73
|
-
* When closing streams we send a FIN then wait for the remote to
|
74
|
-
* reply with a FIN_ACK. If that does not happen within this timeout
|
75
|
-
* we close the stream anyway.
|
76
|
-
*/
|
77
|
-
export const FIN_ACK_TIMEOUT = 5_000;
|
78
|
-
/**
|
79
|
-
* When sending data messages, if the channel is not in the "open" state, wait
|
80
|
-
* this long for the "open" event to fire.
|
81
|
-
*/
|
82
|
-
export const OPEN_TIMEOUT = 5_000;
|
83
60
|
/**
|
84
61
|
* When closing a stream, we wait for `bufferedAmount` to become 0 before
|
85
62
|
* closing the underlying RTCDataChannel - this controls how long we wait in ms
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,mCAAmC,CAAA;AAE3D;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,8BAA8B;IAC9B,kCAAkC;IAClC,+BAA+B;IAC/B,qCAAqC;CACtC,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,CAAC,IAAI,CAAC,gEAAgE,CAAC,CAAA;AAE1G;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,mBAAmB,CAAA;AAE/C;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,mCAAmC,CAAA;AAE3D;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,8BAA8B;IAC9B,kCAAkC;IAClC,+BAA+B;IAC/B,qCAAqC;CACtC,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,CAAC,IAAI,CAAC,gEAAgE,CAAC,CAAA;AAE1G;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,mBAAmB,CAAA;AAE/C;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AM,CAAC,MAAM,4BAA4B,GAAG,aAAa,CAAA;AAEzD;;GAEG;AACH,MAAM,CAAC,MAAM,qCAAqC,GAAG,UAAU,CAAA"}
|
package/dist/src/index.d.ts
CHANGED
@@ -26,8 +26,8 @@
|
|
26
26
|
* WebRTC requires use of a relay to connect two nodes. The listener first discovers a relay server and makes a reservation, then the dialer can connect via the relayed address.
|
27
27
|
*
|
28
28
|
* ```TypeScript
|
29
|
-
* import { noise } from '@
|
30
|
-
* import { yamux } from '@
|
29
|
+
* import { noise } from '@libp2p/noise'
|
30
|
+
* import { yamux } from '@libp2p/yamux'
|
31
31
|
* import { echo } from '@libp2p/echo'
|
32
32
|
* import { circuitRelayTransport, circuitRelayServer } from '@libp2p/circuit-relay-v2'
|
33
33
|
* import { identify } from '@libp2p/identify'
|
@@ -35,7 +35,6 @@
|
|
35
35
|
* import { webSockets } from '@libp2p/websockets'
|
36
36
|
* import { WebRTC } from '@multiformats/multiaddr-matcher'
|
37
37
|
* import delay from 'delay'
|
38
|
-
* import { pipe } from 'it-pipe'
|
39
38
|
* import { createLibp2p } from 'libp2p'
|
40
39
|
* import type { Multiaddr } from '@multiformats/multiaddr'
|
41
40
|
*
|
@@ -134,15 +133,11 @@
|
|
134
133
|
* await relay.stop()
|
135
134
|
*
|
136
135
|
* // send/receive some data from the remote peer via a direct connection
|
137
|
-
*
|
138
|
-
*
|
139
|
-
*
|
140
|
-
*
|
141
|
-
*
|
142
|
-
* console.info(new TextDecoder().decode(buf.subarray()))
|
143
|
-
* }
|
144
|
-
* }
|
145
|
-
* )
|
136
|
+
* stream.send(new TextEncoder().encode('hello world'))
|
137
|
+
*
|
138
|
+
* stream.addEventListener('message', (evt) => {
|
139
|
+
* console.info(new TextDecoder().decode(evt.data.subarray()))
|
140
|
+
* })
|
146
141
|
* ```
|
147
142
|
*
|
148
143
|
* @example WebRTC Direct
|
@@ -167,7 +162,6 @@
|
|
167
162
|
* ```TypeScript
|
168
163
|
* import { createLibp2p } from 'libp2p'
|
169
164
|
* import { multiaddr } from '@multiformats/multiaddr'
|
170
|
-
* import { pipe } from 'it-pipe'
|
171
165
|
* import { fromString, toString } from 'uint8arrays'
|
172
166
|
* import { webRTCDirect } from '@libp2p/webrtc'
|
173
167
|
*
|
@@ -196,15 +190,11 @@
|
|
196
190
|
* signal: AbortSignal.timeout(10_000)
|
197
191
|
* })
|
198
192
|
*
|
199
|
-
*
|
200
|
-
*
|
201
|
-
*
|
202
|
-
*
|
203
|
-
*
|
204
|
-
* console.info(toString(buf.subarray()))
|
205
|
-
* }
|
206
|
-
* }
|
207
|
-
* )
|
193
|
+
* stream.send(new TextEncoder().encode('hello world'))
|
194
|
+
*
|
195
|
+
* stream.addEventListener('message', (evt) => {
|
196
|
+
* console.info(new TextDecoder().decode(evt.data.subarray()))
|
197
|
+
* })
|
208
198
|
* ```
|
209
199
|
*
|
210
200
|
* ## WebRTC Direct certificate hashes
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4PG;AAIH,OAAO,KAAK,EAAE,yBAAyB,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAA;AACvG,OAAO,KAAK,EAAE,yBAAyB,EAAE,+BAA+B,EAAE,MAAM,kCAAkC,CAAA;AAClH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAElD,MAAM,WAAW,kBAAkB;IACjC;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;IAEvB;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAE1B;;;;;;OAMG;IACH,6BAA6B,CAAC,EAAE,MAAM,CAAA;IAEtC;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IAErB;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IAErB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,UAAU,EAAE,MAAM,CAAA;IAElB;;OAEG;IACH,GAAG,EAAE,MAAM,CAAA;IAEX;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,YAAY,EAAE,yBAAyB,EAAE,+BAA+B,EAAE,CAAA;AAE1E,iBAAS,YAAY,CAAE,IAAI,CAAC,EAAE,yBAAyB,GAAG,CAAC,UAAU,EAAE,+BAA+B,KAAK,SAAS,CAEnH;AAED,YAAY,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,CAAA;AAE9D,iBAAS,MAAM,CAAE,IAAI,CAAC,EAAE,mBAAmB,GAAG,CAAC,UAAU,EAAE,yBAAyB,KAAK,SAAS,CAEjG;AAED,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,CAAA"}
|
package/dist/src/index.js
CHANGED
@@ -26,8 +26,8 @@
|
|
26
26
|
* WebRTC requires use of a relay to connect two nodes. The listener first discovers a relay server and makes a reservation, then the dialer can connect via the relayed address.
|
27
27
|
*
|
28
28
|
* ```TypeScript
|
29
|
-
* import { noise } from '@
|
30
|
-
* import { yamux } from '@
|
29
|
+
* import { noise } from '@libp2p/noise'
|
30
|
+
* import { yamux } from '@libp2p/yamux'
|
31
31
|
* import { echo } from '@libp2p/echo'
|
32
32
|
* import { circuitRelayTransport, circuitRelayServer } from '@libp2p/circuit-relay-v2'
|
33
33
|
* import { identify } from '@libp2p/identify'
|
@@ -35,7 +35,6 @@
|
|
35
35
|
* import { webSockets } from '@libp2p/websockets'
|
36
36
|
* import { WebRTC } from '@multiformats/multiaddr-matcher'
|
37
37
|
* import delay from 'delay'
|
38
|
-
* import { pipe } from 'it-pipe'
|
39
38
|
* import { createLibp2p } from 'libp2p'
|
40
39
|
* import type { Multiaddr } from '@multiformats/multiaddr'
|
41
40
|
*
|
@@ -134,15 +133,11 @@
|
|
134
133
|
* await relay.stop()
|
135
134
|
*
|
136
135
|
* // send/receive some data from the remote peer via a direct connection
|
137
|
-
*
|
138
|
-
*
|
139
|
-
*
|
140
|
-
*
|
141
|
-
*
|
142
|
-
* console.info(new TextDecoder().decode(buf.subarray()))
|
143
|
-
* }
|
144
|
-
* }
|
145
|
-
* )
|
136
|
+
* stream.send(new TextEncoder().encode('hello world'))
|
137
|
+
*
|
138
|
+
* stream.addEventListener('message', (evt) => {
|
139
|
+
* console.info(new TextDecoder().decode(evt.data.subarray()))
|
140
|
+
* })
|
146
141
|
* ```
|
147
142
|
*
|
148
143
|
* @example WebRTC Direct
|
@@ -167,7 +162,6 @@
|
|
167
162
|
* ```TypeScript
|
168
163
|
* import { createLibp2p } from 'libp2p'
|
169
164
|
* import { multiaddr } from '@multiformats/multiaddr'
|
170
|
-
* import { pipe } from 'it-pipe'
|
171
165
|
* import { fromString, toString } from 'uint8arrays'
|
172
166
|
* import { webRTCDirect } from '@libp2p/webrtc'
|
173
167
|
*
|
@@ -196,15 +190,11 @@
|
|
196
190
|
* signal: AbortSignal.timeout(10_000)
|
197
191
|
* })
|
198
192
|
*
|
199
|
-
*
|
200
|
-
*
|
201
|
-
*
|
202
|
-
*
|
203
|
-
*
|
204
|
-
* console.info(toString(buf.subarray()))
|
205
|
-
* }
|
206
|
-
* }
|
207
|
-
* )
|
193
|
+
* stream.send(new TextEncoder().encode('hello world'))
|
194
|
+
*
|
195
|
+
* stream.addEventListener('message', (evt) => {
|
196
|
+
* console.info(new TextDecoder().decode(evt.data.subarray()))
|
197
|
+
* })
|
208
198
|
* ```
|
209
199
|
*
|
210
200
|
* ## WebRTC Direct certificate hashes
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4PG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAA;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAA;AA+ExE,SAAS,YAAY,CAAE,IAAgC;IACrD,OAAO,CAAC,UAA2C,EAAE,EAAE,CAAC,IAAI,qBAAqB,CAAC,UAAU,EAAE,IAAI,CAAC,CAAA;AACrG,CAAC;AAID,SAAS,MAAM,CAAE,IAA0B;IACzC,OAAO,CAAC,UAAqC,EAAE,EAAE,CAAC,IAAI,eAAe,CAAC,UAAU,EAAE,IAAI,CAAC,CAAA;AACzF,CAAC;AAED,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,CAAA"}
|
package/dist/src/muxer.d.ts
CHANGED
@@ -1,8 +1,7 @@
|
|
1
|
+
import { AbstractStreamMuxer } from '@libp2p/utils';
|
2
|
+
import { WebRTCStream } from './stream.js';
|
1
3
|
import type { DataChannelOptions } from './index.js';
|
2
|
-
import type { ComponentLogger,
|
3
|
-
import type { AbortOptions } from '@multiformats/multiaddr';
|
4
|
-
import type { Source, Sink } from 'it-stream-types';
|
5
|
-
import type { Uint8ArrayList } from 'uint8arraylist';
|
4
|
+
import type { ComponentLogger, CounterGroup, StreamMuxer, StreamMuxerFactory, CreateStreamOptions, MultiaddrConnection } from '@libp2p/interface';
|
6
5
|
export interface DataChannelMuxerFactoryInit {
|
7
6
|
/**
|
8
7
|
* WebRTC Peer Connection
|
@@ -16,32 +15,27 @@ export interface DataChannelMuxerFactoryInit {
|
|
16
15
|
* Optional metrics for this data channel muxer
|
17
16
|
*/
|
18
17
|
metrics?: CounterGroup;
|
18
|
+
/**
|
19
|
+
* Options used to create data channels
|
20
|
+
*/
|
19
21
|
dataChannelOptions?: DataChannelOptions;
|
20
22
|
}
|
21
23
|
export interface DataChannelMuxerFactoryComponents {
|
22
24
|
logger: ComponentLogger;
|
23
25
|
}
|
24
|
-
interface BufferedStream {
|
25
|
-
stream: Stream;
|
26
|
-
channel: RTCDataChannel;
|
27
|
-
onEnd(err?: Error): void;
|
28
|
-
}
|
29
26
|
export declare class DataChannelMuxerFactory implements StreamMuxerFactory {
|
30
27
|
readonly protocol: string;
|
31
28
|
/**
|
32
29
|
* WebRTC Peer Connection
|
33
30
|
*/
|
34
31
|
private readonly peerConnection;
|
35
|
-
private bufferedStreams;
|
36
32
|
private readonly metrics?;
|
37
33
|
private readonly dataChannelOptions?;
|
38
|
-
|
39
|
-
|
40
|
-
constructor(components: DataChannelMuxerFactoryComponents, init: DataChannelMuxerFactoryInit);
|
41
|
-
createStreamMuxer(init?: StreamMuxerInit): StreamMuxer;
|
34
|
+
constructor(init: DataChannelMuxerFactoryInit);
|
35
|
+
createStreamMuxer(maConn: MultiaddrConnection): StreamMuxer;
|
42
36
|
}
|
43
|
-
export interface DataChannelMuxerInit extends DataChannelMuxerFactoryInit
|
44
|
-
|
37
|
+
export interface DataChannelMuxerInit extends DataChannelMuxerFactoryInit {
|
38
|
+
protocol: string;
|
45
39
|
}
|
46
40
|
export interface DataChannelMuxerComponents {
|
47
41
|
logger: ComponentLogger;
|
@@ -49,37 +43,11 @@ export interface DataChannelMuxerComponents {
|
|
49
43
|
/**
|
50
44
|
* A libp2p data channel stream muxer
|
51
45
|
*/
|
52
|
-
export declare class DataChannelMuxer implements StreamMuxer {
|
53
|
-
#private;
|
54
|
-
readonly init: DataChannelMuxerInit;
|
55
|
-
/**
|
56
|
-
* Array of streams in the data channel
|
57
|
-
*/
|
58
|
-
streams: Stream[];
|
59
|
-
protocol: string;
|
60
|
-
private readonly log;
|
46
|
+
export declare class DataChannelMuxer extends AbstractStreamMuxer<WebRTCStream> implements StreamMuxer<WebRTCStream> {
|
61
47
|
private readonly peerConnection;
|
62
48
|
private readonly dataChannelOptions;
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
/**
|
67
|
-
* Gracefully close all tracked streams and stop the muxer
|
68
|
-
*/
|
69
|
-
close(options?: AbortOptions): Promise<void>;
|
70
|
-
/**
|
71
|
-
* Abort all tracked streams and stop the muxer
|
72
|
-
*/
|
73
|
-
abort(err: Error): void;
|
74
|
-
/**
|
75
|
-
* The stream source, a no-op as the transport natively supports multiplexing
|
76
|
-
*/
|
77
|
-
source: AsyncGenerator<Uint8Array, any, unknown>;
|
78
|
-
/**
|
79
|
-
* The stream destination, a no-op as the transport natively supports multiplexing
|
80
|
-
*/
|
81
|
-
sink: Sink<Source<Uint8Array | Uint8ArrayList>, Promise<void>>;
|
82
|
-
newStream(): Stream;
|
49
|
+
constructor(maConn: MultiaddrConnection, init: DataChannelMuxerInit);
|
50
|
+
onCreateStream(options?: CreateStreamOptions): Promise<WebRTCStream>;
|
51
|
+
onData(): void;
|
83
52
|
}
|
84
|
-
export {};
|
85
53
|
//# sourceMappingURL=muxer.d.ts.map
|
package/dist/src/muxer.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"muxer.d.ts","sourceRoot":"","sources":["../../src/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CAAC;IAC1G,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAmB;IAClD,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAoB;gBAE1C,MAAM,EAAE,mBAAmB,EAAE,IAAI,EAAE,oBAAoB;IAuC9D,cAAc,CAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,YAAY,CAAC;IA2B3E,MAAM,IAAK,IAAI;CAGhB"}
|
package/dist/src/muxer.js
CHANGED
@@ -1,59 +1,26 @@
|
|
1
|
+
import { AbstractStreamMuxer } from '@libp2p/utils';
|
2
|
+
import { pEvent } from 'p-event';
|
1
3
|
import { MUXER_PROTOCOL } from './constants.js';
|
2
|
-
import { createStream } from './stream.js';
|
3
|
-
import { drainAndClose, nopSink, nopSource } from './util.js';
|
4
|
+
import { createStream, WebRTCStream } from './stream.js';
|
4
5
|
export class DataChannelMuxerFactory {
|
5
6
|
protocol;
|
6
7
|
/**
|
7
8
|
* WebRTC Peer Connection
|
8
9
|
*/
|
9
10
|
peerConnection;
|
10
|
-
bufferedStreams = [];
|
11
11
|
metrics;
|
12
12
|
dataChannelOptions;
|
13
|
-
|
14
|
-
log;
|
15
|
-
constructor(components, init) {
|
16
|
-
this.components = components;
|
13
|
+
constructor(init) {
|
17
14
|
this.peerConnection = init.peerConnection;
|
18
15
|
this.metrics = init.metrics;
|
19
16
|
this.protocol = init.protocol ?? MUXER_PROTOCOL;
|
20
17
|
this.dataChannelOptions = init.dataChannelOptions ?? {};
|
21
|
-
this.log = components.logger.forComponent('libp2p:webrtc:muxerfactory');
|
22
|
-
// store any data channels opened before upgrade has been completed
|
23
|
-
this.peerConnection.ondatachannel = ({ channel }) => {
|
24
|
-
this.log.trace('incoming early datachannel with channel id %d and label "%s"', channel.id);
|
25
|
-
// 'init' channel is only used during connection establishment
|
26
|
-
if (channel.label === 'init') {
|
27
|
-
this.log.trace('closing early init channel');
|
28
|
-
channel.close();
|
29
|
-
return;
|
30
|
-
}
|
31
|
-
// @ts-expect-error fields are set below
|
32
|
-
const bufferedStream = {};
|
33
|
-
const stream = createStream({
|
34
|
-
channel,
|
35
|
-
direction: 'inbound',
|
36
|
-
onEnd: (err) => {
|
37
|
-
bufferedStream.onEnd(err);
|
38
|
-
},
|
39
|
-
log: this.log,
|
40
|
-
...this.dataChannelOptions
|
41
|
-
});
|
42
|
-
bufferedStream.stream = stream;
|
43
|
-
bufferedStream.channel = channel;
|
44
|
-
bufferedStream.onEnd = () => {
|
45
|
-
this.bufferedStreams = this.bufferedStreams.filter(s => s.stream.id !== stream.id);
|
46
|
-
};
|
47
|
-
this.bufferedStreams.push(bufferedStream);
|
48
|
-
};
|
49
18
|
}
|
50
|
-
createStreamMuxer(
|
51
|
-
return new DataChannelMuxer(
|
52
|
-
...init,
|
19
|
+
createStreamMuxer(maConn) {
|
20
|
+
return new DataChannelMuxer(maConn, {
|
53
21
|
peerConnection: this.peerConnection,
|
54
22
|
dataChannelOptions: this.dataChannelOptions,
|
55
23
|
metrics: this.metrics,
|
56
|
-
streams: this.bufferedStreams,
|
57
24
|
protocol: this.protocol
|
58
25
|
});
|
59
26
|
}
|
@@ -61,26 +28,16 @@ export class DataChannelMuxerFactory {
|
|
61
28
|
/**
|
62
29
|
* A libp2p data channel stream muxer
|
63
30
|
*/
|
64
|
-
export class DataChannelMuxer {
|
65
|
-
init;
|
66
|
-
/**
|
67
|
-
* Array of streams in the data channel
|
68
|
-
*/
|
69
|
-
streams;
|
70
|
-
protocol;
|
71
|
-
log;
|
31
|
+
export class DataChannelMuxer extends AbstractStreamMuxer {
|
72
32
|
peerConnection;
|
73
33
|
dataChannelOptions;
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
this.logger = components.logger;
|
80
|
-
this.streams = init.streams.map(s => s.stream);
|
34
|
+
constructor(maConn, init) {
|
35
|
+
super(maConn, {
|
36
|
+
...init,
|
37
|
+
name: 'muxer'
|
38
|
+
});
|
81
39
|
this.peerConnection = init.peerConnection;
|
82
40
|
this.protocol = init.protocol ?? MUXER_PROTOCOL;
|
83
|
-
this.metrics = init.metrics;
|
84
41
|
this.dataChannelOptions = init.dataChannelOptions ?? {};
|
85
42
|
/**
|
86
43
|
* Fired when a data channel has been added to the connection has been
|
@@ -89,105 +46,45 @@ export class DataChannelMuxer {
|
|
89
46
|
* {@link https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/datachannel_event}
|
90
47
|
*/
|
91
48
|
this.peerConnection.ondatachannel = ({ channel }) => {
|
92
|
-
this.log.trace('incoming datachannel with channel id %d', channel.id);
|
49
|
+
this.log.trace('incoming %s datachannel with channel id %d and status', channel.protocol, channel.id, channel.readyState);
|
93
50
|
// 'init' channel is only used during connection establishment
|
94
51
|
if (channel.label === 'init') {
|
95
52
|
this.log.trace('closing init channel');
|
96
53
|
channel.close();
|
97
54
|
return;
|
98
55
|
}
|
99
|
-
// lib-datachannel throws if `.getId` is called on a closed channel so
|
100
|
-
// memoize it
|
101
|
-
const id = channel.id;
|
102
56
|
const stream = createStream({
|
57
|
+
...this.streamOptions,
|
58
|
+
...this.dataChannelOptions,
|
103
59
|
channel,
|
104
60
|
direction: 'inbound',
|
105
|
-
|
106
|
-
this.#onStreamEnd(stream, channel);
|
107
|
-
this.log('incoming channel %s ended', id);
|
108
|
-
},
|
109
|
-
log: this.log,
|
110
|
-
...this.dataChannelOptions
|
61
|
+
log: this.log
|
111
62
|
});
|
112
|
-
this.
|
113
|
-
this.metrics?.increment({ incoming_stream: true });
|
114
|
-
init?.onIncomingStream?.(stream);
|
63
|
+
this.onRemoteStream(stream);
|
115
64
|
};
|
116
|
-
// the DataChannelMuxer constructor is called during set up of the
|
117
|
-
// connection by the upgrader.
|
118
|
-
//
|
119
|
-
// If we invoke `init.onIncomingStream` immediately, the connection object
|
120
|
-
// will not be set up yet so add a tiny delay before letting the
|
121
|
-
// connection know about early streams
|
122
|
-
if (this.init.streams.length > 0) {
|
123
|
-
queueMicrotask(() => {
|
124
|
-
this.init.streams.forEach(bufferedStream => {
|
125
|
-
bufferedStream.onEnd = () => {
|
126
|
-
this.log('incoming early channel %s ended with state %s', bufferedStream.channel.id, bufferedStream.channel.readyState);
|
127
|
-
this.#onStreamEnd(bufferedStream.stream, bufferedStream.channel);
|
128
|
-
};
|
129
|
-
this.metrics?.increment({ incoming_stream: true });
|
130
|
-
this.init?.onIncomingStream?.(bufferedStream.stream);
|
131
|
-
});
|
132
|
-
});
|
133
|
-
}
|
134
65
|
}
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
66
|
+
async onCreateStream(options) {
|
67
|
+
// The spec says the label MUST be an empty string: https://github.com/libp2p/specs/blob/master/webrtc/README.md#rtcdatachannel-label
|
68
|
+
const channel = this.peerConnection.createDataChannel('wtf', {
|
69
|
+
// TODO: pre-negotiate stream protocol
|
70
|
+
protocol: options?.protocol
|
139
71
|
});
|
140
|
-
this.
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
* Gracefully close all tracked streams and stop the muxer
|
146
|
-
*/
|
147
|
-
async close(options) {
|
148
|
-
try {
|
149
|
-
await Promise.all(this.streams.map(async (stream) => stream.close(options)));
|
150
|
-
}
|
151
|
-
catch (err) {
|
152
|
-
this.abort(err);
|
72
|
+
this.log('open channel %d for protocol %s', channel.id, options?.protocol);
|
73
|
+
if (channel.readyState !== 'open') {
|
74
|
+
this.log('channel %d state is "%s" and not "open", waiting for "open" event before sending data', channel.id, channel.readyState);
|
75
|
+
await pEvent(channel, 'open', options);
|
76
|
+
this.log('channel %d state is now "%s", sending data', channel.id, channel.readyState);
|
153
77
|
}
|
154
|
-
}
|
155
|
-
/**
|
156
|
-
* Abort all tracked streams and stop the muxer
|
157
|
-
*/
|
158
|
-
abort(err) {
|
159
|
-
for (const stream of this.streams) {
|
160
|
-
stream.abort(err);
|
161
|
-
}
|
162
|
-
}
|
163
|
-
/**
|
164
|
-
* The stream source, a no-op as the transport natively supports multiplexing
|
165
|
-
*/
|
166
|
-
source = nopSource();
|
167
|
-
/**
|
168
|
-
* The stream destination, a no-op as the transport natively supports multiplexing
|
169
|
-
*/
|
170
|
-
sink = nopSink;
|
171
|
-
newStream() {
|
172
|
-
// The spec says the label MUST be an empty string: https://github.com/libp2p/specs/blob/master/webrtc/README.md#rtcdatachannel-label
|
173
|
-
const channel = this.peerConnection.createDataChannel('');
|
174
|
-
// lib-datachannel throws if `.getId` is called on a closed channel so
|
175
|
-
// memoize it
|
176
|
-
const id = channel.id;
|
177
|
-
this.log.trace('opened outgoing datachannel with channel id %s', id);
|
178
78
|
const stream = createStream({
|
79
|
+
...options,
|
80
|
+
...this.dataChannelOptions,
|
179
81
|
channel,
|
180
82
|
direction: 'outbound',
|
181
|
-
|
182
|
-
this.#onStreamEnd(stream, channel);
|
183
|
-
this.log('outgoing channel %s ended', id);
|
184
|
-
},
|
185
|
-
log: this.log,
|
186
|
-
...this.dataChannelOptions
|
83
|
+
log: this.log
|
187
84
|
});
|
188
|
-
this.streams.push(stream);
|
189
|
-
this.metrics?.increment({ outgoing_stream: true });
|
190
85
|
return stream;
|
191
86
|
}
|
87
|
+
onData() {
|
88
|
+
}
|
192
89
|
}
|
193
90
|
//# sourceMappingURL=muxer.js.map
|
package/dist/src/muxer.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"muxer.js","sourceRoot":"","sources":["../../src/muxer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"muxer.js","sourceRoot":"","sources":["../../src/muxer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAChC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AA8BxD,MAAM,OAAO,uBAAuB;IAClB,QAAQ,CAAQ;IAEhC;;OAEG;IACc,cA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AAG,EAAE,IAAI,CAAC,GAAG;SACd,CAAC,CAAA;QAEF,OAAO,MAAM,CAAA;IACf,CAAC;IAED,MAAM;IAEN,CAAC;CACF"}
|
@@ -2,14 +2,13 @@ import { DataChannelMuxerFactory } from '../muxer.js';
|
|
2
2
|
import { RTCPeerConnection } from '../webrtc/index.js';
|
3
3
|
import type { WebRTCDialEvents, WebRTCTransportMetrics } from './transport.js';
|
4
4
|
import type { DataChannelOptions } from '../index.js';
|
5
|
-
import type { LoggerOptions, ComponentLogger,
|
5
|
+
import type { LoggerOptions, ComponentLogger, AbortOptions } from '@libp2p/interface';
|
6
6
|
import type { ConnectionManager, TransportManager } from '@libp2p/interface-internal';
|
7
7
|
import type { Multiaddr } from '@multiformats/multiaddr';
|
8
8
|
import type { ProgressOptions } from 'progress-events';
|
9
|
-
export interface
|
9
|
+
export interface IncomingStreamOptions extends AbortOptions {
|
10
10
|
rtcConfiguration?: RTCConfiguration;
|
11
11
|
dataChannelOptions?: Partial<DataChannelOptions>;
|
12
|
-
signal: AbortSignal;
|
13
12
|
}
|
14
13
|
export interface ConnectOptions extends LoggerOptions, ProgressOptions<WebRTCDialEvents> {
|
15
14
|
rtcConfiguration?: RTCConfiguration;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"initiate-connection.d.ts","sourceRoot":"","sources":["../../../src/private-to-private/initiate-connection.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"initiate-connection.d.ts","sourceRoot":"","sources":["../../../src/private-to-private/initiate-connection.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;AACrD,OAAO,EAAE,iBAAiB,EAAyB,MAAM,oBAAoB,CAAA;AAI7E,OAAO,KAAK,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAA;AAC9E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AACrD,OAAO,KAAK,EAAE,aAAa,EAAc,eA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