mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-05-12 18:57:15 +00:00
chore: merge typedefs newest updates
This commit is contained in:
commit
c4bb3faf0c
@ -24,6 +24,7 @@ const transportSymbol = Symbol.for('@libp2p/js-libp2p-circuit/circuit')
|
|||||||
* @typedef {import('multiaddr')} Multiaddr
|
* @typedef {import('multiaddr')} Multiaddr
|
||||||
* @typedef {import('libp2p-interfaces/src/connection').Connection} Connection
|
* @typedef {import('libp2p-interfaces/src/connection').Connection} Connection
|
||||||
* @typedef {import('libp2p-interfaces/src/stream-muxer/types').MuxedStream} MuxedStream
|
* @typedef {import('libp2p-interfaces/src/stream-muxer/types').MuxedStream} MuxedStream
|
||||||
|
* @typedef {import('../types').CircuitRequest} CircuitRequest
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Circuit {
|
class Circuit {
|
||||||
@ -53,6 +54,7 @@ class Circuit {
|
|||||||
* @param {MuxedStream} props.stream
|
* @param {MuxedStream} props.stream
|
||||||
*/
|
*/
|
||||||
async _onProtocol ({ connection, stream }) {
|
async _onProtocol ({ connection, stream }) {
|
||||||
|
/** @type {import('./circuit/stream-handler')<CircuitRequest>} */
|
||||||
const streamHandler = new StreamHandler({ stream })
|
const streamHandler = new StreamHandler({ stream })
|
||||||
const request = await streamHandler.read()
|
const request = await streamHandler.read()
|
||||||
|
|
||||||
|
@ -394,7 +394,7 @@ class Libp2p extends EventEmitter {
|
|||||||
*
|
*
|
||||||
* @async
|
* @async
|
||||||
* @param {PeerId|Multiaddr|string} peer - The peer to dial
|
* @param {PeerId|Multiaddr|string} peer - The peer to dial
|
||||||
* @param {null|string[]|string} protocols
|
* @param {string[]|string} protocols
|
||||||
* @param {object} [options]
|
* @param {object} [options]
|
||||||
* @param {AbortSignal} [options.signal]
|
* @param {AbortSignal} [options.signal]
|
||||||
* @returns {Promise<Connection|*>}
|
* @returns {Promise<Connection|*>}
|
||||||
|
@ -65,10 +65,14 @@ class PeerRecord {
|
|||||||
/**
|
/**
|
||||||
* Returns true if `this` record equals the `other`.
|
* Returns true if `this` record equals the `other`.
|
||||||
*
|
*
|
||||||
* @param {PeerRecord} other
|
* @param {unknown} other
|
||||||
* @returns {other is Record}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
equals (other) {
|
equals (other) {
|
||||||
|
if (!(other instanceof PeerRecord)) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
// Validate PeerId
|
// Validate PeerId
|
||||||
if (!this.peerId.equals(other.peerId)) {
|
if (!this.peerId.equals(other.peerId)) {
|
||||||
return false
|
return false
|
||||||
|
Loading…
x
Reference in New Issue
Block a user