@libp2p/webrtc 2.0.9 → 2.0.10-2e561fe9
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 +7 -2
- package/dist/index.min.js +16 -16
- package/dist/src/error.d.ts +2 -2
- package/dist/src/error.d.ts.map +1 -1
- package/dist/src/error.js +1 -1
- package/dist/src/error.js.map +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/maconn.d.ts +2 -2
- package/dist/src/muxer.d.ts +3 -3
- package/dist/src/private-to-private/handler.d.ts +3 -3
- package/dist/src/private-to-private/handler.d.ts.map +1 -1
- package/dist/src/private-to-private/listener.d.ts +4 -3
- package/dist/src/private-to-private/listener.d.ts.map +1 -1
- package/dist/src/private-to-private/listener.js +1 -1
- package/dist/src/private-to-private/listener.js.map +1 -1
- package/dist/src/private-to-private/transport.d.ts +6 -5
- package/dist/src/private-to-private/transport.d.ts.map +1 -1
- package/dist/src/private-to-private/transport.js +10 -2
- package/dist/src/private-to-private/transport.js.map +1 -1
- package/dist/src/private-to-public/options.d.ts +1 -1
- package/dist/src/private-to-public/transport.d.ts +4 -4
- package/dist/src/private-to-public/transport.d.ts.map +1 -1
- package/dist/src/private-to-public/transport.js +1 -1
- package/dist/src/private-to-public/transport.js.map +1 -1
- package/dist/src/stream.d.ts +2 -2
- package/dist/src/stream.d.ts.map +1 -1
- package/dist/src/stream.js +2 -2
- package/dist/src/stream.js.map +1 -1
- package/package.json +25 -119
- package/src/error.ts +2 -2
- package/src/index.ts +1 -1
- package/src/maconn.ts +2 -2
- package/src/muxer.ts +3 -3
- package/src/private-to-private/handler.ts +3 -3
- package/src/private-to-private/listener.ts +4 -3
- package/src/private-to-private/transport.ts +13 -6
- package/src/private-to-public/options.ts +1 -1
- package/src/private-to-public/transport.ts +4 -4
- package/src/stream.ts +3 -3
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { EventEmitter } from '@libp2p/
|
|
1
|
+
import { EventEmitter } from '@libp2p/interface/events'
|
|
2
2
|
import { Circuit } from '@multiformats/mafmt'
|
|
3
|
-
import type { PeerId } from '@libp2p/interface
|
|
4
|
-
import type { ListenerEvents, Listener
|
|
3
|
+
import type { PeerId } from '@libp2p/interface/peer-id'
|
|
4
|
+
import type { ListenerEvents, Listener } from '@libp2p/interface/transport'
|
|
5
|
+
import type { TransportManager } from '@libp2p/interface-internal/transport-manager'
|
|
5
6
|
import type { Multiaddr } from '@multiformats/multiaddr'
|
|
6
7
|
|
|
7
8
|
export interface ListenerOptions {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { CodeError } from '@libp2p/interface/errors'
|
|
2
|
+
import { type CreateListenerOptions, type DialOptions, symbol, type Transport, type Listener, type Upgrader } from '@libp2p/interface/transport'
|
|
3
3
|
import { logger } from '@libp2p/logger'
|
|
4
4
|
import { peerIdFromString } from '@libp2p/peer-id'
|
|
5
5
|
import { multiaddr, type Multiaddr, protocols } from '@multiformats/multiaddr'
|
|
@@ -8,10 +8,11 @@ import { WebRTCMultiaddrConnection } from '../maconn.js'
|
|
|
8
8
|
import { initiateConnection, handleIncomingStream } from './handler.js'
|
|
9
9
|
import { WebRTCPeerListener } from './listener.js'
|
|
10
10
|
import type { DataChannelOpts } from '../stream.js'
|
|
11
|
-
import type { Connection } from '@libp2p/interface
|
|
12
|
-
import type { PeerId } from '@libp2p/interface
|
|
13
|
-
import type {
|
|
14
|
-
import type {
|
|
11
|
+
import type { Connection } from '@libp2p/interface/connection'
|
|
12
|
+
import type { PeerId } from '@libp2p/interface/peer-id'
|
|
13
|
+
import type { Startable } from '@libp2p/interface/startable'
|
|
14
|
+
import type { IncomingStreamData, Registrar } from '@libp2p/interface-internal/registrar'
|
|
15
|
+
import type { TransportManager } from '@libp2p/interface-internal/transport-manager'
|
|
15
16
|
|
|
16
17
|
const log = logger('libp2p:webrtc:peer')
|
|
17
18
|
|
|
@@ -119,6 +120,9 @@ export class WebRTCTransport implements Transport, Startable {
|
|
|
119
120
|
// reset the stream in case of any error
|
|
120
121
|
signalingStream.reset()
|
|
121
122
|
throw err
|
|
123
|
+
} finally {
|
|
124
|
+
// Close the signaling connection
|
|
125
|
+
await connection.close()
|
|
122
126
|
}
|
|
123
127
|
}
|
|
124
128
|
|
|
@@ -143,6 +147,9 @@ export class WebRTCTransport implements Transport, Startable {
|
|
|
143
147
|
} catch (err) {
|
|
144
148
|
stream.reset()
|
|
145
149
|
throw err
|
|
150
|
+
} finally {
|
|
151
|
+
// Close the signaling connection
|
|
152
|
+
await connection.close()
|
|
146
153
|
}
|
|
147
154
|
}
|
|
148
155
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CreateListenerOptions, DialOptions } from '@libp2p/interface
|
|
1
|
+
import type { CreateListenerOptions, DialOptions } from '@libp2p/interface/transport'
|
|
2
2
|
|
|
3
3
|
export interface WebRTCListenerOptions extends CreateListenerOptions {}
|
|
4
4
|
export interface WebRTCDialOptions extends DialOptions {}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { noise as Noise } from '@chainsafe/libp2p-noise'
|
|
2
|
-
import { type CreateListenerOptions,
|
|
2
|
+
import { type CreateListenerOptions, symbol, type Transport, type Listener } from '@libp2p/interface/transport'
|
|
3
3
|
import { logger } from '@libp2p/logger'
|
|
4
4
|
import * as p from '@libp2p/peer-id'
|
|
5
5
|
import { protocols } from '@multiformats/multiaddr'
|
|
@@ -15,9 +15,9 @@ import * as sdp from './sdp.js'
|
|
|
15
15
|
import { genUfrag } from './util.js'
|
|
16
16
|
import type { WebRTCDialOptions } from './options.js'
|
|
17
17
|
import type { DataChannelOpts } from '../stream.js'
|
|
18
|
-
import type { Connection } from '@libp2p/interface
|
|
19
|
-
import type { CounterGroup, Metrics } from '@libp2p/interface
|
|
20
|
-
import type { PeerId } from '@libp2p/interface
|
|
18
|
+
import type { Connection } from '@libp2p/interface/connection'
|
|
19
|
+
import type { CounterGroup, Metrics } from '@libp2p/interface/metrics'
|
|
20
|
+
import type { PeerId } from '@libp2p/interface/peer-id'
|
|
21
21
|
import type { Multiaddr } from '@multiformats/multiaddr'
|
|
22
22
|
|
|
23
23
|
const log = logger('libp2p:webrtc:transport')
|
package/src/stream.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { CodeError } from '@libp2p/interface/errors'
|
|
2
|
+
import { AbstractStream, type AbstractStreamInit } from '@libp2p/interface/stream-muxer/stream'
|
|
3
3
|
import { logger } from '@libp2p/logger'
|
|
4
4
|
import * as lengthPrefixed from 'it-length-prefixed'
|
|
5
5
|
import { type Pushable, pushable } from 'it-pushable'
|
|
6
6
|
import { pEvent, TimeoutError } from 'p-event'
|
|
7
7
|
import { Uint8ArrayList } from 'uint8arraylist'
|
|
8
8
|
import { Message } from './pb/message.js'
|
|
9
|
-
import type { Direction, Stream } from '@libp2p/interface
|
|
9
|
+
import type { Direction, Stream } from '@libp2p/interface/connection'
|
|
10
10
|
|
|
11
11
|
const log = logger('libp2p:webrtc:stream')
|
|
12
12
|
|