@libp2p/webrtc 6.0.32 → 6.0.33-183116ba0
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 +22 -1
- package/dist/index.min.js +9 -9
- package/dist/index.min.js.map +4 -4
- package/dist/src/constants.d.ts +2 -1
- package/dist/src/constants.d.ts.map +1 -1
- package/dist/src/constants.js +2 -1
- package/dist/src/constants.js.map +1 -1
- package/dist/src/index.d.ts +22 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +22 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/private-to-public/listener.d.ts.map +1 -1
- package/dist/src/private-to-public/listener.js +9 -7
- package/dist/src/private-to-public/listener.js.map +1 -1
- package/dist/src/private-to-public/transport.browser.d.ts +9 -0
- package/dist/src/private-to-public/transport.browser.d.ts.map +1 -1
- package/dist/src/private-to-public/transport.browser.js +33 -5
- package/dist/src/private-to-public/transport.browser.js.map +1 -1
- package/dist/src/private-to-public/utils/connect.d.ts +16 -0
- package/dist/src/private-to-public/utils/connect.d.ts.map +1 -1
- package/dist/src/private-to-public/utils/connect.js +77 -16
- package/dist/src/private-to-public/utils/connect.js.map +1 -1
- package/dist/src/private-to-public/utils/get-rtcpeerconnection.d.ts +4 -1
- package/dist/src/private-to-public/utils/get-rtcpeerconnection.d.ts.map +1 -1
- package/dist/src/private-to-public/utils/get-rtcpeerconnection.js +18 -11
- package/dist/src/private-to-public/utils/get-rtcpeerconnection.js.map +1 -1
- package/dist/src/private-to-public/utils/sdp.d.ts +3 -1
- package/dist/src/private-to-public/utils/sdp.d.ts.map +1 -1
- package/dist/src/private-to-public/utils/sdp.js +16 -2
- package/dist/src/private-to-public/utils/sdp.js.map +1 -1
- package/dist/src/private-to-public/utils/stun-listener.browser.d.ts +9 -0
- package/dist/src/private-to-public/utils/stun-listener.browser.d.ts.map +1 -0
- package/dist/src/private-to-public/utils/stun-listener.browser.js +6 -0
- package/dist/src/private-to-public/utils/stun-listener.browser.js.map +1 -0
- package/dist/src/private-to-public/utils/stun-listener.d.ts +2 -4
- package/dist/src/private-to-public/utils/stun-listener.d.ts.map +1 -1
- package/dist/src/private-to-public/utils/stun-listener.js +8 -2
- package/dist/src/private-to-public/utils/stun-listener.js.map +1 -1
- package/dist/src/private-to-public/utils/stun.d.ts +34 -0
- package/dist/src/private-to-public/utils/stun.d.ts.map +1 -0
- package/dist/src/private-to-public/utils/stun.js +107 -0
- package/dist/src/private-to-public/utils/stun.js.map +1 -0
- package/dist/src/util.d.ts +3 -5
- package/dist/src/util.d.ts.map +1 -1
- package/dist/src/util.js +3 -24
- package/dist/src/util.js.map +1 -1
- package/dist/src/webrtc/node-datachannel.browser.d.ts +7 -0
- package/dist/src/webrtc/node-datachannel.browser.d.ts.map +1 -0
- package/dist/src/webrtc/node-datachannel.browser.js +16 -0
- package/dist/src/webrtc/node-datachannel.browser.js.map +1 -0
- package/package.json +13 -10
- package/src/constants.ts +2 -1
- package/src/index.ts +22 -1
- package/src/private-to-public/listener.ts +9 -7
- package/src/private-to-public/transport.browser.ts +48 -5
- package/src/private-to-public/utils/connect.ts +112 -17
- package/src/private-to-public/utils/get-rtcpeerconnection.ts +20 -11
- package/src/private-to-public/utils/sdp.ts +21 -2
- package/src/private-to-public/utils/stun-listener.browser.ts +14 -0
- package/src/private-to-public/utils/stun-listener.ts +9 -7
- package/src/private-to-public/utils/stun.ts +128 -0
- package/src/util.ts +5 -32
- package/src/webrtc/node-datachannel.browser.ts +17 -0
- package/dist/typedoc-urls.json +0 -14
package/README.md
CHANGED
|
@@ -38,7 +38,7 @@ A third party is usually necessary to carry out this handshake, forwarding messa
|
|
|
38
38
|
|
|
39
39
|
The WebRTC transport uses libp2p [Circuit Relay](https://libp2p.io/docs/circuit-relay/)s to forward SDP messages. Once a direct connection is formed the relay plays no further part in the exchange.
|
|
40
40
|
|
|
41
|
-
WebRTC Direct
|
|
41
|
+
WebRTC Direct skips the handshake step, instead encoding enough information in the connection request that the responder can derive what would have been in the handshake messages and so requires no third parties to establish a connection. Version 1 of the protocol does this with a technique known as [SDP munging](https://webrtchacks.com/not-a-guide-to-sdp-munging/); version 2 avoids munging, which browsers are removing support for. See WebRTC Direct versions below.
|
|
42
42
|
|
|
43
43
|
A WebRTC Direct multiaddr also includes a certhash of the target peer - this is used to allow opening a connection to the remote, which would otherwise be denied due to use of a self-signed certificate.
|
|
44
44
|
|
|
@@ -220,6 +220,27 @@ stream.addEventListener('message', (evt) => {
|
|
|
220
220
|
})
|
|
221
221
|
```
|
|
222
222
|
|
|
223
|
+
## WebRTC Direct versions
|
|
224
|
+
|
|
225
|
+
There are two versions of the WebRTC Direct connection flow. Both use the
|
|
226
|
+
same `/webrtc-direct` multiaddr and certificate hash; they differ in how the
|
|
227
|
+
client's ICE credentials reach the server.
|
|
228
|
+
|
|
229
|
+
Version 1 munges the client's SDP offer so that the server can predict the
|
|
230
|
+
client's ICE credentials. Browsers are removing the ability to do this, so
|
|
231
|
+
v1 will stop working for browser clients.
|
|
232
|
+
|
|
233
|
+
Version 2 leaves the local SDP offer untouched and instead carries the
|
|
234
|
+
client's ICE password in the ICE username fragment of the synthetic server
|
|
235
|
+
answer, where the server reads it back from the incoming STUN request.
|
|
236
|
+
|
|
237
|
+
No configuration is needed for either version. Listeners accept both on the
|
|
238
|
+
same port and select the version from the incoming username fragment prefix.
|
|
239
|
+
The first dial tries v1 and, if the runtime does not apply the munged ICE
|
|
240
|
+
credentials, continues as v2; later dials then start at v2. The
|
|
241
|
+
`dialerVersion` option skips this and forces one version, for example `2`
|
|
242
|
+
for a server known to support it (go-libp2p does from v0.49.0).
|
|
243
|
+
|
|
223
244
|
## WebRTC Direct certificate hashes
|
|
224
245
|
|
|
225
246
|
WebRTC Direct listeners publish the hash of their TLS certificate as part of
|