mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-07-11 14:51:34 +00:00
Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
078956b310 | |||
4f44158889 | |||
3a8d51c142 | |||
f8c09db20f | |||
ee801c9be2 | |||
03349d7caf | |||
0c87dbc8f3 |
@ -41,7 +41,7 @@ To sum up, libp2p is a "network stack" -- a protocol suite -- that cleanly separ
|
|||||||
|
|
||||||
With its modular nature, libp2p can be found being used in different projects with different sets of features, while perserving the same top level API. `js-libp2p` is only a skelleton and should not be installed directly, if you are looking for a prebundled libp2p stack, please check:
|
With its modular nature, libp2p can be found being used in different projects with different sets of features, while perserving the same top level API. `js-libp2p` is only a skelleton and should not be installed directly, if you are looking for a prebundled libp2p stack, please check:
|
||||||
|
|
||||||
- [libp2p-ipfs](https://github.com/ipfs/js-libp2p-ipfs) - The libp2p build used by js-ipfs when run in Node.js
|
- [libp2p-ipfs-nodejs](https://github.com/ipfs/js-libp2p-ipfs-nodejs) - The libp2p build used by js-ipfs when run in Node.js
|
||||||
- [libp2p-ipfs-browser](https://github.com/ipfs/js-libp2p-ipfs-browser) - The libp2p build used by js-ipfs when run in a Browser (that supports WebRTC)
|
- [libp2p-ipfs-browser](https://github.com/ipfs/js-libp2p-ipfs-browser) - The libp2p build used by js-ipfs when run in a Browser (that supports WebRTC)
|
||||||
|
|
||||||
If you have developed a libp2p bundle, please consider submitting it to this list so that it can be found easily by the users of libp2p.
|
If you have developed a libp2p bundle, please consider submitting it to this list so that it can be found easily by the users of libp2p.
|
||||||
@ -81,7 +81,7 @@ Defined by [interface-libp2p](https://github.com/libp2p/interface-libp2p)
|
|||||||
| Package | Version | Dependencies | DevDependencies |
|
| Package | Version | Dependencies | DevDependencies |
|
||||||
|---------|---------|--------------|-----------------|
|
|---------|---------|--------------|-----------------|
|
||||||
| **Bundles** |
|
| **Bundles** |
|
||||||
| [`libp2p-ipfs`](//github.com/ipfs/js-libp2p-ipfs) | [](//github.com/ipfs/js-libp2p-ipfs/releases) | [](https://david-dm.org/ipfs/js-libp2p-ipfs) | [](https://david-dm.org/ipfs/js-libp2p-ipfs?type=dev) |
|
| [`libp2p-ipfs-nodejs`](//github.com/ipfs/js-libp2p-ipfs-nodejs) | [](//github.com/ipfs/js-libp2p-ipfs-nodejs/releases) | [](https://david-dm.org/ipfs/js-libp2p-ipfs-nodejs) | [](https://david-dm.org/ipfs/js-libp2p-ipfs-nodejs?type=dev) |
|
||||||
| [`libp2p-ipfs-browser`](//github.com/ipfs/js-libp2p-ipfs-browser) | [](//github.com/ipfs/js-libp2p-ipfs-browser/releases) | [](https://david-dm.org/ipfs/js-libp2p-ipfs-browser) | [](https://david-dm.org/ipfs/js-libp2p-ipfs-browser?type=dev) |
|
| [`libp2p-ipfs-browser`](//github.com/ipfs/js-libp2p-ipfs-browser) | [](//github.com/ipfs/js-libp2p-ipfs-browser/releases) | [](https://david-dm.org/ipfs/js-libp2p-ipfs-browser) | [](https://david-dm.org/ipfs/js-libp2p-ipfs-browser?type=dev) |
|
||||||
| **Transports** |
|
| **Transports** |
|
||||||
| [`libp2p-utp`](//github.com/libp2p/js-libp2p-utp) | [](//github.com/libp2p/js-libp2p-utp/releases) | [](https://david-dm.org/libp2p/js-libp2p-utp) | [](https://david-dm.org/libp2p/js-libp2p-utp?type=dev) |
|
| [`libp2p-utp`](//github.com/libp2p/js-libp2p-utp) | [](//github.com/libp2p/js-libp2p-utp/releases) | [](https://david-dm.org/libp2p/js-libp2p-utp) | [](https://david-dm.org/libp2p/js-libp2p-utp?type=dev) |
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "libp2p",
|
"name": "libp2p",
|
||||||
"version": "0.2.1",
|
"version": "0.3.1",
|
||||||
"description": "JavaScript Skeleton for libp2p bundles",
|
"description": "JavaScript Skeleton for libp2p bundles",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@ -39,6 +39,7 @@
|
|||||||
"pre-commit": "^1.1.1"
|
"pre-commit": "^1.1.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"libp2p-ping": "^0.3.0",
|
||||||
"libp2p-swarm": "^0.26.3",
|
"libp2p-swarm": "^0.26.3",
|
||||||
"mafmt": "^2.1.2",
|
"mafmt": "^2.1.2",
|
||||||
"multiaddr": "^2.1.1",
|
"multiaddr": "^2.1.1",
|
||||||
|
29
src/index.js
29
src/index.js
@ -8,6 +8,7 @@ const multiaddr = require('multiaddr')
|
|||||||
const mafmt = require('mafmt')
|
const mafmt = require('mafmt')
|
||||||
const EE = require('events').EventEmitter
|
const EE = require('events').EventEmitter
|
||||||
const assert = require('assert')
|
const assert = require('assert')
|
||||||
|
const Ping = require('libp2p-ping')
|
||||||
|
|
||||||
exports = module.exports
|
exports = module.exports
|
||||||
|
|
||||||
@ -70,6 +71,9 @@ class Node {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Mount default protocols
|
||||||
|
Ping.mount(this.swarm)
|
||||||
|
|
||||||
// Not fully implemented in js-libp2p yet
|
// Not fully implemented in js-libp2p yet
|
||||||
this.routing = undefined
|
this.routing = undefined
|
||||||
this.records = undefined
|
this.records = undefined
|
||||||
@ -123,6 +127,27 @@ class Node {
|
|||||||
this.swarm.close(callback)
|
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
|
// Dialing methods
|
||||||
//
|
//
|
||||||
@ -247,6 +272,4 @@ class Node {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = Node
|
||||||
Node: Node
|
|
||||||
}
|
|
||||||
|
Reference in New Issue
Block a user