Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit 4ff95d6

Browse files
committed
feat: create getters for peerInfo and peerBook
1 parent c964f08 commit 4ff95d6

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

examples/custom-libp2p/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ const assert = require('assert')
2121
*/
2222
const libp2pFactory = (_ipfsNode, _ipfsConfig) => {
2323
// Set convenience variables to clearly showcase some of the useful things that are available
24-
const peerInfo = _ipfsNode._peerInfo
25-
const peerBook = _ipfsNode._peerBook
24+
const peerInfo = _ipfsNode.peerInfo
25+
const peerBook = _ipfsNode.peerBook
2626
const bootstrapList = _ipfsConfig.Bootstrap
2727

2828
// Create our WebSocketStar transport and give it our PeerId, straight from the ipfs node

src/core/index.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,20 @@ class IPFS extends EventEmitter {
142142

143143
boot(this)
144144
}
145+
146+
/**
147+
* @type {PeerBook}
148+
*/
149+
get peerBook() {
150+
return this._peerInfoBook
151+
}
152+
153+
/**
154+
* @type {PeerInfo}
155+
*/
156+
get peerInfo() {
157+
return this._peerInfo
158+
}
145159
}
146160

147161
exports = module.exports = IPFS

0 commit comments

Comments
 (0)