diff --git a/packages/libp2p-daemon-client/README.md b/packages/libp2p-daemon-client/README.md index 1cd8fcec..07d9a01e 100644 --- a/packages/libp2p-daemon-client/README.md +++ b/packages/libp2p-daemon-client/README.md @@ -1,5 +1,4 @@ -libp2p-daemon client JavaScript implementation -====== +# libp2p-daemon client JavaScript implementation [![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](https://protocol.ai/) [![](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/) @@ -8,18 +7,16 @@ libp2p-daemon client JavaScript implementation > A Javascript client to interact with a standalone deployment of a libp2p host, running in its own OS process. Essentially, this client allows to communicate with other peers, interact with the DHT, participate in pubsub, etc. no matter the language they are implemented with. -## Lead Maintainer +## Table of Contents -[Vasco Santos](https://github.com/vasco-santos) - -## Table of Contents - -* [Specs](#specs) -* [Install](#install) -* [Usage](#usage) -* [API](#api) -* [Contribute](#contribute) -* [License](#license) +- [Specs](#specs) +- [Install](#install) +- [Usage](#usage) + - [Run a daemon process](#run-a-daemon-process) + - [Interact with the daemon process using the client](#interact-with-the-daemon-process-using-the-client) +- [API](#api) +- [Contribute](#contribute) +- [License](#license) ## Specs @@ -27,7 +24,7 @@ The specs for the daemon are currently housed in the go implementation. You can ## Install -`npm install libp2p-daemon-client` +`npm install @libp2p/daemon-client` ## Usage @@ -41,10 +38,11 @@ There are currently two implementations of the `libp2p-daemon`: ### Interact with the daemon process using the client ```js -const Client = require('libp2p-daemon-client') +import { createClient } from '@libp2p/daemon-client' +import { Multiaddr } from '@multiformats/multiaddr' -const defaultSock = '/tmp/p2pd.sock' -const client = new Client(defaultSock) +const serverAddr = new Multiaddr('/ip4/127.0.0.1/tcp/1234') +const client = createClient(serverAddr) // interact with the daemon let identify @@ -81,4 +79,4 @@ This module is actively under development. Please check out the issues and submi ## License -MIT © Protocol Labs \ No newline at end of file +[Apache-2.0](LICENSE-APACHE) or [MIT](LICENSE-MIT) © Protocol Labs diff --git a/packages/libp2p-daemon-protocol/README.md b/packages/libp2p-daemon-protocol/README.md index e1763326..919fd067 100644 --- a/packages/libp2p-daemon-protocol/README.md +++ b/packages/libp2p-daemon-protocol/README.md @@ -1,4 +1,4 @@ -# js-libp2p-daemon-protocol +# js-libp2p-daemon-protocol @@ -6,6 +6,12 @@ > Contains the protobuf definitions of the communication protocol for libp2p daemons +## Table of contents + +- [Install](#install) +- [Contribute](#contribute) +- [License](#license) + ## Install ``` @@ -18,7 +24,4 @@ This module is actively under development. Please check out the issues and submi ## License -Licensed under either of - - * Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / http://www.apache.org/licenses/LICENSE-2.0) - * MIT ([LICENSE-MIT](LICENSE-MIT) / http://opensource.org/licenses/MIT) +[Apache-2.0](LICENSE-APACHE) or [MIT](LICENSE-MIT) © Protocol Labs diff --git a/packages/libp2p-daemon-server/README.md b/packages/libp2p-daemon-server/README.md index b54b5445..79a2354c 100644 --- a/packages/libp2p-daemon-server/README.md +++ b/packages/libp2p-daemon-server/README.md @@ -1,16 +1,18 @@ -libp2p-daemon JavaScript implementation -====== +# libp2p-daemon JavaScript implementation - > A standalone deployment of a libp2p host, running in its own OS process and installing a set of virtual endpoints to enable co-local applications to: communicate with peers, handle protocols, interact with the DHT, participate in pubsub, etc. no matter the language they are developed in, nor whether a native libp2p implementation exists in that language. -## Lead Maintainer +## Table of contents -[Jacob Heun](https://github.com/jacobheun) +- [Specs](#specs) +- [Install](#install) +- [Usage](#usage) +- [Contribute](#contribute) +- [License](#license) ## Specs @@ -19,19 +21,23 @@ The specs for the daemon are currently housed in the go implementation. You can ## Install ``` -npm i -g libp2p-daemon +npm i -g @libp2p/daemon-server ``` ## Usage -For a full list of options, you can run help `jsp2pd --help`. -Running the defaults, `jsp2pd`, will start the daemon and bind it to a local unix socket path. -Daemon clients will be able to communicate with the daemon over that unix socket. +```js +import { createServer } from '@libp2p/daemon-server' +import { createLibp2p } from 'libp2p' -As an alternative, you can use this daemon with a different version of libp2p as the one specified in `package.json`. You just need to define its path through an environment variable as follows: +const libp2p = await createLibp2p({ + // .. config +}) -```sh -export LIBP2P_JS=./../../js-libp2p/src/index.js +const multiaddr = new Multiaddr('/ip4/0.0.0.0/tcp/0') + +const server = await createServer(multiaddr, libp2p) +await server.start() ``` ## Contribute @@ -40,4 +46,4 @@ This module is actively under development. Please check out the issues and submi ## License -MIT © Protocol Labs +[Apache-2.0](LICENSE-APACHE) or [MIT](LICENSE-MIT) © Protocol Labs diff --git a/packages/libp2p-daemon/README.md b/packages/libp2p-daemon/README.md index b54b5445..ef0841de 100644 --- a/packages/libp2p-daemon/README.md +++ b/packages/libp2p-daemon/README.md @@ -1,16 +1,18 @@ -libp2p-daemon JavaScript implementation -====== +# libp2p-daemon JavaScript implementation - -> A standalone deployment of a libp2p host, running in its own OS process and installing a set of virtual endpoints to enable co-local applications to: communicate with peers, handle protocols, interact with the DHT, participate in pubsub, etc. no matter the language they are developed in, nor whether a native libp2p implementation exists in that language. +> A standalone deployment of a libp2p host, running in its own OS process and installing a set of virtual endpoints to enable co-local applications to: communicate with peers, handle protocols, interact with the DHT, participate in pubsub, etc. no matter the language they are developed in, nor whether a native libp2p implementation exists -## Lead Maintainer +## Table of contents -[Jacob Heun](https://github.com/jacobheun) +- [Specs](#specs) +- [Install](#install) +- [Usage](#usage) +- [Contribute](#contribute) +- [License](#license) ## Specs @@ -19,19 +21,23 @@ The specs for the daemon are currently housed in the go implementation. You can ## Install ``` -npm i -g libp2p-daemon +npm i -g @libp2p/daemon ``` ## Usage +```console +$ jsp2pd --help +``` + For a full list of options, you can run help `jsp2pd --help`. Running the defaults, `jsp2pd`, will start the daemon and bind it to a local unix socket path. Daemon clients will be able to communicate with the daemon over that unix socket. As an alternative, you can use this daemon with a different version of libp2p as the one specified in `package.json`. You just need to define its path through an environment variable as follows: -```sh -export LIBP2P_JS=./../../js-libp2p/src/index.js +```console +$ LIBP2P_JS=/path/to/js-libp2p/src/index.js jsp2pd ``` ## Contribute @@ -40,4 +46,4 @@ This module is actively under development. Please check out the issues and submi ## License -MIT © Protocol Labs +[Apache-2.0](LICENSE-APACHE) or [MIT](LICENSE-MIT) © Protocol Labs