@libp2p/webrtc 5.2.3-6f8cfeafb → 5.2.3-90cca822b
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 +4 -4
- package/dist/src/constants.d.ts +0 -4
- package/dist/src/constants.d.ts.map +1 -1
- package/dist/src/constants.js +0 -4
- package/dist/src/constants.js.map +1 -1
- package/dist/src/private-to-private/transport.d.ts +1 -1
- package/dist/src/private-to-private/transport.d.ts.map +1 -1
- package/dist/src/private-to-private/transport.js +14 -6
- package/dist/src/private-to-private/transport.js.map +1 -1
- package/dist/src/private-to-public/listener.d.ts +2 -0
- package/dist/src/private-to-public/listener.d.ts.map +1 -1
- package/dist/src/private-to-public/listener.js +18 -7
- package/dist/src/private-to-public/listener.js.map +1 -1
- package/dist/src/private-to-public/transport.d.ts +2 -1
- package/dist/src/private-to-public/transport.d.ts.map +1 -1
- package/dist/src/private-to-public/transport.js +3 -3
- package/dist/src/private-to-public/transport.js.map +1 -1
- package/package.json +8 -8
- package/src/constants.ts +0 -4
- package/src/private-to-private/transport.ts +15 -6
- package/src/private-to-public/listener.ts +23 -8
- package/src/private-to-public/transport.ts +6 -4
@@ -2,14 +2,13 @@ import { serviceCapabilities, transportSymbol } from '@libp2p/interface'
|
|
2
2
|
import { peerIdFromString } from '@libp2p/peer-id'
|
3
3
|
import { WebRTCDirect } from '@multiformats/multiaddr-matcher'
|
4
4
|
import { raceSignal } from 'race-signal'
|
5
|
-
import { HANDSHAKE_TIMEOUT_MS } from '../constants.js'
|
6
5
|
import { genUfrag } from '../util.js'
|
7
6
|
import { WebRTCDirectListener } from './listener.js'
|
8
7
|
import { connect } from './utils/connect.js'
|
9
8
|
import { createDialerRTCPeerConnection } from './utils/get-rtcpeerconnection.js'
|
10
9
|
import type { DataChannelOptions, TransportCertificate } from '../index.js'
|
11
10
|
import type { WebRTCDialEvents } from '../private-to-private/transport.js'
|
12
|
-
import type { CreateListenerOptions, Transport, Listener, ComponentLogger, Logger, Connection, CounterGroup, Metrics, PeerId, DialTransportOptions, PrivateKey } from '@libp2p/interface'
|
11
|
+
import type { CreateListenerOptions, Transport, Listener, ComponentLogger, Logger, Connection, CounterGroup, Metrics, PeerId, DialTransportOptions, PrivateKey, Upgrader } from '@libp2p/interface'
|
13
12
|
import type { TransportManager } from '@libp2p/interface-internal'
|
14
13
|
import type { Multiaddr } from '@multiformats/multiaddr'
|
15
14
|
|
@@ -22,6 +21,7 @@ export interface WebRTCDirectTransportComponents {
|
|
22
21
|
metrics?: Metrics
|
23
22
|
logger: ComponentLogger
|
24
23
|
transportManager: TransportManager
|
24
|
+
upgrader: Upgrader
|
25
25
|
}
|
26
26
|
|
27
27
|
export interface WebRTCMetrics {
|
@@ -72,7 +72,6 @@ export class WebRTCDirectTransport implements Transport {
|
|
72
72
|
* Dial a given multiaddr
|
73
73
|
*/
|
74
74
|
async dial (ma: Multiaddr, options: DialTransportOptions<WebRTCDialEvents>): Promise<Connection> {
|
75
|
-
options?.signal?.throwIfAborted()
|
76
75
|
const rawConn = await this._connect(ma, options)
|
77
76
|
this.log('dialing address: %a', ma)
|
78
77
|
return rawConn
|
@@ -106,6 +105,9 @@ export class WebRTCDirectTransport implements Transport {
|
|
106
105
|
* Connect to a peer using a multiaddr
|
107
106
|
*/
|
108
107
|
async _connect (ma: Multiaddr, options: DialTransportOptions<WebRTCDialEvents>): Promise<Connection> {
|
108
|
+
// do not create RTCPeerConnection if the signal has already been aborted
|
109
|
+
options.signal.throwIfAborted()
|
110
|
+
|
109
111
|
let theirPeerId: PeerId | undefined
|
110
112
|
const remotePeerString = ma.getPeerId()
|
111
113
|
if (remotePeerString != null) {
|
@@ -124,7 +126,7 @@ export class WebRTCDirectTransport implements Transport {
|
|
124
126
|
logger: this.components.logger,
|
125
127
|
metrics: this.components.metrics,
|
126
128
|
events: this.metrics?.dialerEvents,
|
127
|
-
signal: options.signal
|
129
|
+
signal: options.signal,
|
128
130
|
remoteAddr: ma,
|
129
131
|
dataChannel: this.init.dataChannel,
|
130
132
|
upgrader: options.upgrader,
|