mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-07-14 16:21:34 +00:00
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
078956b310 | |||
4f44158889 | |||
3a8d51c142 | |||
f8c09db20f |
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "libp2p",
|
||||
"version": "0.3.0",
|
||||
"version": "0.3.1",
|
||||
"description": "JavaScript Skeleton for libp2p bundles",
|
||||
"main": "src/index.js",
|
||||
"scripts": {
|
||||
@ -39,6 +39,7 @@
|
||||
"pre-commit": "^1.1.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"libp2p-ping": "^0.3.0",
|
||||
"libp2p-swarm": "^0.26.3",
|
||||
"mafmt": "^2.1.2",
|
||||
"multiaddr": "^2.1.1",
|
||||
|
25
src/index.js
25
src/index.js
@ -8,6 +8,7 @@ const multiaddr = require('multiaddr')
|
||||
const mafmt = require('mafmt')
|
||||
const EE = require('events').EventEmitter
|
||||
const assert = require('assert')
|
||||
const Ping = require('libp2p-ping')
|
||||
|
||||
exports = module.exports
|
||||
|
||||
@ -70,6 +71,9 @@ class Node {
|
||||
})
|
||||
}
|
||||
|
||||
// Mount default protocols
|
||||
Ping.mount(this.swarm)
|
||||
|
||||
// Not fully implemented in js-libp2p yet
|
||||
this.routing = undefined
|
||||
this.records = undefined
|
||||
@ -123,6 +127,27 @@ class Node {
|
||||
this.swarm.close(callback)
|
||||
}
|
||||
|
||||
//
|
||||
// Ping
|
||||
//
|
||||
|
||||
// TODO
|
||||
pingById (id, callback) {
|
||||
assert(this.isOnline, OFFLINE_ERROR_MESSAGE)
|
||||
callback(new Error('not implemented yet'))
|
||||
}
|
||||
|
||||
// TODO
|
||||
pingByMultiaddr (maddr, callback) {
|
||||
assert(this.isOnline, OFFLINE_ERROR_MESSAGE)
|
||||
callback(new Error('not implemented yet'))
|
||||
}
|
||||
|
||||
pingByPeerInfo (peerInfo, callback) {
|
||||
assert(this.isOnline, OFFLINE_ERROR_MESSAGE)
|
||||
callback(null, new Ping(this.swarm, peerInfo))
|
||||
}
|
||||
|
||||
//
|
||||
// Dialing methods
|
||||
//
|
||||
|
Reference in New Issue
Block a user