@@ -22,12 +22,24 @@ import type { Multiaddr } from '@multiformats/multiaddr'
22
22
23
23
const log = logger ( 'libp2p:webrtcdirect' )
24
24
25
+ interface SimplePeerOptions {
26
+ channelConfig ?: Object ,
27
+ channelName ?: string ,
28
+ config ?: Object ,
29
+ offerOptions ?: Object ,
30
+ answerOptions ?: Object ,
31
+ sdpTransform ?: < T > ( sdp : T ) => T ,
32
+ stream ?: boolean ,
33
+ streams ?: any [ ] ,
34
+ objectMode ?: boolean
35
+ }
36
+
25
37
export interface WebRTCDirectListenerOptions extends ListenerOptions {
26
- channelOptions ?: Object
38
+ peerOptions ?: SimplePeerOptions
27
39
}
28
40
29
41
export interface WebRTCDirectDialOptions extends AbortOptions {
30
- channelOptions ?: Object
42
+ peerOptions ?: SimplePeerOptions
31
43
}
32
44
33
45
export class WebRTCDirect implements Transport < AbortOptions , ListenerOptions > {
@@ -57,11 +69,11 @@ export class WebRTCDirect implements Transport<AbortOptions, ListenerOptions> {
57
69
throw new AbortError ( )
58
70
}
59
71
60
- const channelOptions = {
72
+ const peerOptions = {
61
73
initiator : true ,
62
74
trickle : false ,
63
75
wrtc : isNode ? wrtc : undefined ,
64
- ...options ?. channelOptions
76
+ ...options ?. peerOptions
65
77
}
66
78
67
79
return new Promise ( ( resolve , reject ) => {
@@ -71,7 +83,7 @@ export class WebRTCDirect implements Transport<AbortOptions, ListenerOptions> {
71
83
const cOpts = ma . toOptions ( )
72
84
log ( 'Dialing %s:%s' , cOpts . host , cOpts . port )
73
85
74
- const channel = new SimplePeer ( channelOptions )
86
+ const channel = new SimplePeer ( peerOptions )
75
87
76
88
const onError = ( err : Error ) => {
77
89
if ( ! connected ) {
0 commit comments