This repository was archived by the owner on Jun 26, 2023. It is now read-only.
File tree 1 file changed +42
-0
lines changed
packages/interface-libp2p/src
1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -84,6 +84,35 @@ export interface LookupFunction {
84
84
( key : string ) : Promise < Uint8Array | null >
85
85
}
86
86
87
+ export type PendingDialStatus = 'queued' | 'active' | 'error' | 'success'
88
+
89
+ /**
90
+ * An item in the dial queue
91
+ */
92
+ export interface PendingDial {
93
+ /**
94
+ * A unique identifier for this dial
95
+ */
96
+ id : string
97
+
98
+ /**
99
+ * The current status of the dial
100
+ */
101
+ status : PendingDialStatus
102
+
103
+ /**
104
+ * If known, this is the peer id that libp2p expects to be dialling
105
+ */
106
+ peerId ?: PeerId
107
+
108
+ /**
109
+ * The list of multiaddrs that will be dialled. The returned connection will
110
+ * use the first address that succeeds, all other dials part of this pending
111
+ * dial will be cancelled.
112
+ */
113
+ multiaddrs : Multiaddr [ ]
114
+ }
115
+
87
116
/**
88
117
* Libp2p nodes implement this interface.
89
118
*/
@@ -323,6 +352,19 @@ export interface Libp2p extends Startable, EventEmitter<Libp2pEvents> {
323
352
*/
324
353
getConnections : ( peerId ?: PeerId ) => Connection [ ]
325
354
355
+ /**
356
+ * Return the list of dials currently in progress or queued to start
357
+ *
358
+ * @example
359
+ *
360
+ * ```js
361
+ * for (const pendingDial of libp2p.getDialQueue()) {
362
+ * console.log(pendingDial)
363
+ * }
364
+ * ```
365
+ */
366
+ getDialQueue : ( ) => PendingDial [ ]
367
+
326
368
/**
327
369
* Return a list of all peers we currently have a connection open to
328
370
*/
You can’t perform that action at this time.
0 commit comments