@libp2p/webrtc 6.0.16 → 6.0.18-20bfcb3f9

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.
Files changed (61) hide show
  1. package/dist/index.min.js +6 -9
  2. package/dist/index.min.js.map +4 -4
  3. package/dist/src/constants.js +1 -1
  4. package/dist/src/index.d.ts +2 -2
  5. package/dist/src/index.js +2 -2
  6. package/dist/src/muxer.d.ts +2 -2
  7. package/dist/src/muxer.js +2 -2
  8. package/dist/src/private-to-private/initiate-connection.d.ts +1 -1
  9. package/dist/src/private-to-private/initiate-connection.js +3 -3
  10. package/dist/src/private-to-private/signaling-stream-handler.js +2 -2
  11. package/dist/src/private-to-private/transport.js +3 -3
  12. package/dist/src/private-to-private/util.d.ts +2 -2
  13. package/dist/src/private-to-private/util.d.ts.map +1 -1
  14. package/dist/src/private-to-private/util.js +1 -2
  15. package/dist/src/private-to-private/util.js.map +1 -1
  16. package/dist/src/private-to-public/listener.d.ts +1 -1
  17. package/dist/src/private-to-public/listener.js +3 -3
  18. package/dist/src/private-to-public/transport.browser.js +2 -2
  19. package/dist/src/private-to-public/transport.d.ts +2 -1
  20. package/dist/src/private-to-public/transport.d.ts.map +1 -1
  21. package/dist/src/private-to-public/transport.js +4 -3
  22. package/dist/src/private-to-public/transport.js.map +1 -1
  23. package/dist/src/private-to-public/utils/connect.d.ts +1 -1
  24. package/dist/src/private-to-public/utils/connect.d.ts.map +1 -1
  25. package/dist/src/private-to-public/utils/connect.js +3 -5
  26. package/dist/src/private-to-public/utils/connect.js.map +1 -1
  27. package/dist/src/private-to-public/utils/generate-certificates.d.ts +1 -0
  28. package/dist/src/private-to-public/utils/generate-certificates.d.ts.map +1 -1
  29. package/dist/src/private-to-public/utils/generate-certificates.js +1 -0
  30. package/dist/src/private-to-public/utils/generate-certificates.js.map +1 -1
  31. package/dist/src/private-to-public/utils/generate-noise-prologue.js +1 -1
  32. package/dist/src/private-to-public/utils/get-rtcpeerconnection.js +1 -1
  33. package/dist/src/rtcpeerconnection-to-conn.js +1 -1
  34. package/dist/src/rtcpeerconnection-to-conn.js.map +1 -1
  35. package/dist/src/stream.d.ts +1 -1
  36. package/dist/src/stream.d.ts.map +1 -1
  37. package/dist/src/stream.js +11 -12
  38. package/dist/src/stream.js.map +1 -1
  39. package/dist/src/util.d.ts +0 -1
  40. package/dist/src/util.d.ts.map +1 -1
  41. package/dist/src/util.js +1 -4
  42. package/dist/src/util.js.map +1 -1
  43. package/package.json +14 -13
  44. package/src/constants.ts +1 -1
  45. package/src/index.ts +4 -4
  46. package/src/muxer.ts +3 -3
  47. package/src/private-to-private/initiate-connection.ts +4 -4
  48. package/src/private-to-private/signaling-stream-handler.ts +2 -2
  49. package/src/private-to-private/transport.ts +3 -3
  50. package/src/private-to-private/util.ts +2 -3
  51. package/src/private-to-public/listener.ts +6 -6
  52. package/src/private-to-public/transport.browser.ts +2 -2
  53. package/src/private-to-public/transport.ts +4 -3
  54. package/src/private-to-public/utils/connect.ts +4 -7
  55. package/src/private-to-public/utils/generate-certificates.ts +1 -0
  56. package/src/private-to-public/utils/generate-noise-prologue.ts +1 -1
  57. package/src/private-to-public/utils/get-rtcpeerconnection.ts +1 -1
  58. package/src/rtcpeerconnection-to-conn.ts +1 -1
  59. package/src/stream.ts +12 -15
  60. package/src/util.ts +1 -5
  61. package/dist/typedoc-urls.json +0 -14
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@libp2p/webrtc",
3
- "version": "6.0.16",
3
+ "version": "6.0.18-20bfcb3f9",
4
4
  "description": "A libp2p transport using WebRTC connections",
5
5
  "license": "Apache-2.0 OR MIT",
6
6
  "homepage": "https://github.com/libp2p/js-libp2p/tree/main/packages/transport-webrtc#readme",
@@ -26,7 +26,8 @@
26
26
  "exports": {
27
27
  ".": {
28
28
  "types": "./dist/src/index.d.ts",
29
- "import": "./dist/src/index.js"
29
+ "import": "./dist/src/index.js",
30
+ "module-sync": "./dist/src/index.js"
30
31
  }
31
32
  },
32
33
  "scripts": {
@@ -45,18 +46,17 @@
45
46
  },
46
47
  "dependencies": {
47
48
  "@chainsafe/is-ip": "^2.1.0",
48
- "@libp2p/crypto": "^5.1.15",
49
- "@libp2p/interface": "^3.2.0",
50
- "@libp2p/interface-internal": "^3.1.0",
51
- "@libp2p/keychain": "^6.0.12",
52
49
  "@chainsafe/libp2p-noise": "^17.0.0",
53
- "@libp2p/peer-id": "^6.0.6",
54
- "@libp2p/utils": "^7.0.15",
50
+ "@libp2p/crypto": "5.1.17-20bfcb3f9",
51
+ "@libp2p/interface": "3.2.2-20bfcb3f9",
52
+ "@libp2p/interface-internal": "3.1.2-20bfcb3f9",
53
+ "@libp2p/keychain": "6.0.14-20bfcb3f9",
54
+ "@libp2p/peer-id": "6.0.8-20bfcb3f9",
55
+ "@libp2p/utils": "7.0.17-20bfcb3f9",
55
56
  "@multiformats/multiaddr": "^13.0.1",
56
57
  "@multiformats/multiaddr-matcher": "^3.0.1",
57
58
  "@peculiar/webcrypto": "^1.5.0",
58
- "@peculiar/x509": "^1.13.0",
59
- "detect-browser": "^5.3.0",
59
+ "@peculiar/x509": "^2.0.0",
60
60
  "get-port": "^7.1.0",
61
61
  "interface-datastore": "^9.0.1",
62
62
  "it-length-prefixed": "^10.0.1",
@@ -74,18 +74,19 @@
74
74
  "protons-runtime": "^6.0.1",
75
75
  "race-signal": "^2.0.0",
76
76
  "react-native-webrtc": "^124.0.6",
77
+ "reflect-metadata": "^0.2.2",
77
78
  "uint8-varint": "^2.0.4",
78
79
  "uint8arraylist": "^2.4.8",
79
80
  "uint8arrays": "^5.1.0"
80
81
  },
81
82
  "devDependencies": {
82
- "@libp2p/logger": "^6.2.4",
83
- "@types/sinon": "^20.0.0",
83
+ "@libp2p/logger": "6.2.6-20bfcb3f9",
84
+ "@types/sinon": "^21.0.1",
84
85
  "aegir": "^47.0.22",
85
86
  "any-signal": "^4.1.1",
86
87
  "datastore-core": "^11.0.1",
87
88
  "delay": "^7.0.0",
88
- "p-retry": "^7.0.0",
89
+ "p-retry": "^8.0.0",
89
90
  "protons": "^8.1.1",
90
91
  "sinon": "^21.0.0",
91
92
  "sinon-ts": "^2.0.0",
package/src/constants.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { encodingLength } from 'uint8-varint'
2
- import { Message } from './private-to-public/pb/message.js'
2
+ import { Message } from './private-to-public/pb/message.ts'
3
3
 
4
4
  /**
5
5
  * STUN servers help clients discover their own public IPs.
package/src/index.ts CHANGED
@@ -252,10 +252,10 @@
252
252
  * ```
253
253
  */
254
254
 
255
- import { WebRTCTransport } from './private-to-private/transport.js'
256
- import { WebRTCDirectTransport } from './private-to-public/transport.js'
257
- import type { WebRTCTransportComponents, WebRTCTransportInit } from './private-to-private/transport.js'
258
- import type { WebRTCTransportDirectInit, WebRTCDirectTransportComponents } from './private-to-public/transport.js'
255
+ import { WebRTCTransport } from './private-to-private/transport.ts'
256
+ import { WebRTCDirectTransport } from './private-to-public/transport.ts'
257
+ import type { WebRTCTransportComponents, WebRTCTransportInit } from './private-to-private/transport.ts'
258
+ import type { WebRTCTransportDirectInit, WebRTCDirectTransportComponents } from './private-to-public/transport.ts'
259
259
  import type { Transport } from '@libp2p/interface'
260
260
 
261
261
  export interface DataChannelOptions {
package/src/muxer.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { AbstractStreamMuxer } from '@libp2p/utils'
2
- import { MUXER_PROTOCOL } from './constants.js'
3
- import { createStream, WebRTCStream } from './stream.js'
4
- import type { DataChannelOptions } from './index.js'
2
+ import { MUXER_PROTOCOL } from './constants.ts'
3
+ import { createStream, WebRTCStream } from './stream.ts'
4
+ import type { DataChannelOptions } from './index.ts'
5
5
  import type { ComponentLogger, CounterGroup, StreamMuxer, StreamMuxerFactory, CreateStreamOptions, MultiaddrConnection } from '@libp2p/interface'
6
6
 
7
7
  export interface DataChannelMuxerFactoryInit {
@@ -5,10 +5,10 @@ import { SIGNALING_PROTOCOL } from '../constants.js'
5
5
  import { SDPHandshakeFailedError } from '../error.js'
6
6
  import { DataChannelMuxerFactory } from '../muxer.js'
7
7
  import { RTCPeerConnection, RTCSessionDescription } from '../webrtc/index.js'
8
- import { Message } from './pb/message.js'
9
- import { splitAddr } from './transport.js'
10
- import { readCandidatesUntilConnected } from './util.js'
11
- import type { WebRTCDialEvents, WebRTCTransportMetrics } from './transport.js'
8
+ import { Message } from './pb/message.ts'
9
+ import { splitAddr } from './transport.ts'
10
+ import { readCandidatesUntilConnected } from './util.ts'
11
+ import type { WebRTCDialEvents, WebRTCTransportMetrics } from './transport.ts'
12
12
  import type { DataChannelOptions } from '../index.js'
13
13
  import type { LoggerOptions, Connection, ComponentLogger, AbortOptions } from '@libp2p/interface'
14
14
  import type { ConnectionManager, TransportManager } from '@libp2p/interface-internal'
@@ -2,8 +2,8 @@ import { pbStream } from '@libp2p/utils'
2
2
  import { multiaddr } from '@multiformats/multiaddr'
3
3
  import { SDPHandshakeFailedError } from '../error.js'
4
4
  import { RTCSessionDescription } from '../webrtc/index.js'
5
- import { Message } from './pb/message.js'
6
- import { getRemotePeer, readCandidatesUntilConnected } from './util.js'
5
+ import { Message } from './pb/message.ts'
6
+ import { getRemotePeer, readCandidatesUntilConnected } from './util.ts'
7
7
  import type { RTCPeerConnection } from '../webrtc/index.js'
8
8
  import type { AbortOptions, Connection, Logger, PeerId, Stream } from '@libp2p/interface'
9
9
  import type { Multiaddr } from '@multiformats/multiaddr'
@@ -8,9 +8,9 @@ import { DataChannelMuxerFactory } from '../muxer.js'
8
8
  import { toMultiaddrConnection } from '../rtcpeerconnection-to-conn.ts'
9
9
  import { getRtcConfiguration } from '../util.js'
10
10
  import { RTCPeerConnection } from '../webrtc/index.js'
11
- import { initiateConnection } from './initiate-connection.js'
12
- import { WebRTCPeerListener } from './listener.js'
13
- import { handleIncomingStream } from './signaling-stream-handler.js'
11
+ import { initiateConnection } from './initiate-connection.ts'
12
+ import { WebRTCPeerListener } from './listener.ts'
13
+ import { handleIncomingStream } from './signaling-stream-handler.ts'
14
14
  import { getRemotePeer } from './util.ts'
15
15
  import type { DataChannelOptions } from '../index.js'
16
16
  import type { OutboundConnectionUpgradeEvents, CreateListenerOptions, DialTransportOptions, Transport, Listener, Upgrader, ComponentLogger, Logger, Connection, PeerId, CounterGroup, Metrics, Startable, OpenConnectionProgressEvents, Libp2pEvents, MultiaddrConnection, Stream } from '@libp2p/interface'
@@ -2,8 +2,8 @@ import { ConnectionFailedError, InvalidMessageError, InvalidMultiaddrError } fro
2
2
  import { peerIdFromString } from '@libp2p/peer-id'
3
3
  import { CustomProgressEvent } from 'progress-events'
4
4
  import { RTCIceCandidate } from '../webrtc/index.js'
5
- import { Message } from './pb/message.js'
6
- import type { WebRTCDialEvents } from './transport.js'
5
+ import { Message } from './pb/message.ts'
6
+ import type { WebRTCDialEvents } from './transport.ts'
7
7
  import type { RTCPeerConnection } from '../webrtc/index.js'
8
8
  import type { AbortOptions, LoggerOptions, PeerId, Stream } from '@libp2p/interface'
9
9
  import type { Multiaddr } from '@multiformats/multiaddr'
@@ -86,7 +86,6 @@ function resolveOnConnected (pc: RTCPeerConnection, promise: DeferredPromise<voi
86
86
  promise.resolve()
87
87
  break
88
88
  case 'failed':
89
- case 'disconnected':
90
89
  case 'closed':
91
90
  promise.reject(new ConnectionFailedError(`RTCPeerConnection connection state became "${pc.connectionState}"`))
92
91
  break
@@ -6,13 +6,13 @@ import { WebRTCDirect } from '@multiformats/multiaddr-matcher'
6
6
  import getPort from 'get-port'
7
7
  import { TypedEventEmitter, setMaxListeners } from 'main-event'
8
8
  import pWaitFor from 'p-wait-for'
9
- import { connect } from './utils/connect.js'
10
- import { createDialerRTCPeerConnection } from './utils/get-rtcpeerconnection.js'
11
- import { stunListener } from './utils/stun-listener.js'
9
+ import { connect } from './utils/connect.ts'
10
+ import { createDialerRTCPeerConnection } from './utils/get-rtcpeerconnection.ts'
11
+ import { stunListener } from './utils/stun-listener.ts'
12
12
  import type { DataChannelOptions, TransportCertificate } from '../index.js'
13
- import type { WebRTCDirectTransportCertificateEvents } from './transport.js'
14
- import type { DirectRTCPeerConnection } from './utils/get-rtcpeerconnection.js'
15
- import type { StunServer } from './utils/stun-listener.js'
13
+ import type { WebRTCDirectTransportCertificateEvents } from './transport.ts'
14
+ import type { DirectRTCPeerConnection } from './utils/get-rtcpeerconnection.ts'
15
+ import type { StunServer } from './utils/stun-listener.ts'
16
16
  import type { PeerId, ListenerEvents, Listener, Upgrader, ComponentLogger, Logger, CounterGroup, Metrics, PrivateKey } from '@libp2p/interface'
17
17
  import type { Keychain } from '@libp2p/keychain'
18
18
  import type { Multiaddr } from '@multiformats/multiaddr'
@@ -4,8 +4,8 @@ import { CODE_P2P } from '@multiformats/multiaddr'
4
4
  import { WebRTCDirect } from '@multiformats/multiaddr-matcher'
5
5
  import { UnimplementedError } from '../error.ts'
6
6
  import { genUfrag } from '../util.js'
7
- import { connect } from './utils/connect.js'
8
- import { createDialerRTCPeerConnection } from './utils/get-rtcpeerconnection.js'
7
+ import { connect } from './utils/connect.ts'
8
+ import { createDialerRTCPeerConnection } from './utils/get-rtcpeerconnection.ts'
9
9
  import type { DataChannelOptions } from '../index.js'
10
10
  import type { WebRTCDialEvents } from '../private-to-private/transport.js'
11
11
  import type { CreateListenerOptions, Transport, Listener, ComponentLogger, Logger, Connection, CounterGroup, Metrics, PeerId, DialTransportOptions, PrivateKey, Upgrader } from '@libp2p/interface'
@@ -1,3 +1,4 @@
1
+ import 'reflect-metadata'
1
2
  import { generateKeyPair, privateKeyToCryptoKeyPair } from '@libp2p/crypto/keys'
2
3
  import { InvalidParametersError, NotFoundError, NotStartedError } from '@libp2p/interface'
3
4
  import { WebRTCDirect } from '@multiformats/multiaddr-matcher'
@@ -9,9 +10,9 @@ import { sha256 } from 'multiformats/hashes/sha2'
9
10
  import { equals as uint8ArrayEquals } from 'uint8arrays/equals'
10
11
  import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
11
12
  import { DEFAULT_CERTIFICATE_DATASTORE_KEY, DEFAULT_CERTIFICATE_LIFESPAN, DEFAULT_CERTIFICATE_PRIVATE_KEY_NAME, DEFAULT_CERTIFICATE_RENEWAL_THRESHOLD } from '../constants.js'
12
- import { WebRTCDirectListener } from './listener.js'
13
- import { WebRTCDirectTransport as WebRTCDirectBrowserTransport } from './transport.browser.js'
14
- import { formatAsPem } from './utils/pem.js'
13
+ import { WebRTCDirectListener } from './listener.ts'
14
+ import { WebRTCDirectTransport as WebRTCDirectBrowserTransport } from './transport.browser.ts'
15
+ import { formatAsPem } from './utils/pem.ts'
15
16
  import type { TransportCertificate } from '../index.js'
16
17
  import type { WebRTCTransportDirectInit as WebRTCTransportDirectBrowserInit, WebRTCMetrics, WebRTCDirectTransportComponents } from './transport.browser.ts'
17
18
  import type { CreateListenerOptions, Transport, Listener, PrivateKey, Startable } from '@libp2p/interface'
@@ -4,10 +4,9 @@ import { WebRTCTransportError } from '../../error.js'
4
4
  import { DataChannelMuxerFactory } from '../../muxer.js'
5
5
  import { toMultiaddrConnection } from '../../rtcpeerconnection-to-conn.ts'
6
6
  import { createStream } from '../../stream.js'
7
- import { isFirefox } from '../../util.js'
8
- import { generateNoisePrologue } from './generate-noise-prologue.js'
9
- import * as sdp from './sdp.js'
10
- import type { DirectRTCPeerConnection } from './get-rtcpeerconnection.js'
7
+ import { generateNoisePrologue } from './generate-noise-prologue.ts'
8
+ import * as sdp from './sdp.ts'
9
+ import type { DirectRTCPeerConnection } from './get-rtcpeerconnection.ts'
11
10
  import type { DataChannelOptions } from '../../index.js'
12
11
  import type { ComponentLogger, Connection, CounterGroup, Logger, PeerId, PrivateKey, Upgrader } from '@libp2p/interface'
13
12
  import type { Multiaddr } from '@multiformats/multiaddr'
@@ -34,8 +33,6 @@ export interface ServerOptions extends ConnectOptions {
34
33
  role: 'server'
35
34
  }
36
35
 
37
- const CONNECTION_STATE_CHANGE_EVENT = isFirefox ? 'iceconnectionstatechange' : 'connectionstatechange'
38
-
39
36
  function isServer (options: ClientOptions | ServerOptions, peerConnection: any): peerConnection is DirectRTCPeerConnection {
40
37
  return options.role === 'server'
41
38
  }
@@ -135,7 +132,7 @@ export async function connect (peerConnection: RTCPeerConnection | DirectRTCPeer
135
132
  log: options.logger.forComponent('libp2p:webrtc-direct:connection')
136
133
  })
137
134
 
138
- peerConnection.addEventListener(CONNECTION_STATE_CHANGE_EVENT, () => {
135
+ peerConnection.addEventListener('connectionstatechange', () => {
139
136
  switch (peerConnection.connectionState) {
140
137
  case 'failed':
141
138
  case 'disconnected':
@@ -1,3 +1,4 @@
1
+ import 'reflect-metadata'
1
2
  import { Crypto } from '@peculiar/webcrypto'
2
3
  import * as x509 from '@peculiar/x509'
3
4
  import { base64url } from 'multiformats/bases/base64'
@@ -2,7 +2,7 @@ import * as Digest from 'multiformats/hashes/digest'
2
2
  import { sha256 } from 'multiformats/hashes/sha2'
3
3
  import { concat } from 'uint8arrays/concat'
4
4
  import { fromString as uint8arrayFromString } from 'uint8arrays/from-string'
5
- import * as sdp from './sdp.js'
5
+ import * as sdp from './sdp.ts'
6
6
  import type { Multiaddr } from '@multiformats/multiaddr'
7
7
 
8
8
  const PREFIX = uint8arrayFromString('libp2p-webrtc-noise:')
@@ -3,7 +3,7 @@ import { PeerConnection } from 'node-datachannel'
3
3
  import { RTCPeerConnection } from 'node-datachannel/polyfill'
4
4
  import { DEFAULT_ICE_SERVERS, MAX_MESSAGE_SIZE } from '../../constants.js'
5
5
  import { DataChannelMuxerFactory } from '../../muxer.ts'
6
- import { generateTransportCertificate } from './generate-certificates.js'
6
+ import { generateTransportCertificate } from './generate-certificates.ts'
7
7
  import type { DataChannelOptions, TransportCertificate } from '../../index.js'
8
8
  import type { CounterGroup } from '@libp2p/interface'
9
9
  import type { CertificateFingerprint } from 'node-datachannel'
@@ -20,7 +20,7 @@ class RTCPeerConnectionMultiaddrConnection extends AbstractMultiaddrConnection {
20
20
  this.peerConnection.onconnectionstatechange = () => {
21
21
  this.log.trace('peer connection state change %s initial state %s', this.peerConnection.connectionState, initialState)
22
22
 
23
- if (this.peerConnection.connectionState === 'disconnected' || this.peerConnection.connectionState === 'failed' || this.peerConnection.connectionState === 'closed') {
23
+ if (this.peerConnection.connectionState === 'failed' || this.peerConnection.connectionState === 'closed') {
24
24
  // nothing else to do but close the connection
25
25
  this.onTransportClosed()
26
26
 
package/src/stream.ts CHANGED
@@ -5,10 +5,9 @@ import { pushable } from 'it-pushable'
5
5
  import { pEvent } from 'p-event'
6
6
  import { raceSignal } from 'race-signal'
7
7
  import { Uint8ArrayList } from 'uint8arraylist'
8
- import { DEFAULT_FIN_ACK_TIMEOUT, MAX_BUFFERED_AMOUNT, MAX_MESSAGE_SIZE, PROTOBUF_OVERHEAD } from './constants.js'
9
- import { Message } from './private-to-public/pb/message.js'
10
- import { isFirefox } from './util.js'
11
- import type { DataChannelOptions } from './index.js'
8
+ import { DEFAULT_FIN_ACK_TIMEOUT, MAX_BUFFERED_AMOUNT, MAX_MESSAGE_SIZE, PROTOBUF_OVERHEAD } from './constants.ts'
9
+ import { Message } from './private-to-public/pb/message.ts'
10
+ import type { DataChannelOptions } from './index.ts'
12
11
  import type { AbortOptions, MessageStreamDirection, Logger } from '@libp2p/interface'
13
12
  import type { AbstractStreamInit, SendResult } from '@libp2p/utils'
14
13
  import type { Pushable } from 'it-pushable'
@@ -140,17 +139,15 @@ export class WebRTCStream extends AbstractStream {
140
139
 
141
140
  this.log.trace('sending message, channel state "%s"', this.channel.readyState)
142
141
 
143
- if (isFirefox) {
144
- // TODO: firefox can deliver small messages out of order - remove once a
145
- // browser with https://bugzilla.mozilla.org/show_bug.cgi?id=1983831 is
146
- // available in playwright-test
147
- this.channel.send(data.subarray())
148
- return
149
- }
150
-
151
- // send message without copying data
152
- for (const buf of data) {
153
- this.channel.send(buf)
142
+ try {
143
+ // send message without copying data
144
+ for (const buf of data) {
145
+ this.channel.send(buf)
146
+ }
147
+ } catch (err: any) {
148
+ // channel.send can throw synchronously if the polyfill's cached readyState is stale
149
+ this.log.error('error sending datachannel message - %e', err)
150
+ this.abort(err)
154
151
  }
155
152
  }
156
153
 
package/src/util.ts CHANGED
@@ -1,14 +1,10 @@
1
- import { detect } from 'detect-browser'
2
1
  import pDefer from 'p-defer'
3
2
  import pTimeout from 'p-timeout'
4
- import { DATA_CHANNEL_DRAIN_TIMEOUT, DEFAULT_ICE_SERVERS, UFRAG_ALPHABET, UFRAG_PREFIX } from './constants.js'
3
+ import { DATA_CHANNEL_DRAIN_TIMEOUT, DEFAULT_ICE_SERVERS, UFRAG_ALPHABET, UFRAG_PREFIX } from './constants.ts'
5
4
  import type { LoggerOptions } from '@libp2p/interface'
6
5
  import type { Duplex, Source } from 'it-stream-types'
7
6
  import type { PeerConnection } from 'node-datachannel'
8
7
 
9
- const browser = detect()
10
- export const isFirefox = ((browser != null) && browser.name === 'firefox')
11
-
12
8
  export const nopSource = async function * nop (): AsyncGenerator<Uint8Array, any, unknown> {}
13
9
 
14
10
  export const nopSink = async (_: any): Promise<void> => {}
@@ -1,14 +0,0 @@
1
- {
2
- "DataChannelOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_webrtc.DataChannelOptions.html",
3
- ".:DataChannelOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_webrtc.DataChannelOptions.html",
4
- "TransportCertificate": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_webrtc.TransportCertificate.html",
5
- ".:TransportCertificate": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_webrtc.TransportCertificate.html",
6
- "WebRTCDirectTransportComponents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_webrtc.WebRTCDirectTransportComponents.html",
7
- "WebRTCTransportComponents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_webrtc.WebRTCTransportComponents.html",
8
- "WebRTCTransportDirectInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_webrtc.WebRTCTransportDirectInit.html",
9
- "WebRTCTransportInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_webrtc.WebRTCTransportInit.html",
10
- "webRTC": "https://libp2p.github.io/js-libp2p/functions/_libp2p_webrtc.webRTC.html",
11
- ".:webRTC": "https://libp2p.github.io/js-libp2p/functions/_libp2p_webrtc.webRTC.html",
12
- "webRTCDirect": "https://libp2p.github.io/js-libp2p/functions/_libp2p_webrtc.webRTCDirect.html",
13
- ".:webRTCDirect": "https://libp2p.github.io/js-libp2p/functions/_libp2p_webrtc.webRTCDirect.html"
14
- }