Skip to content

Commit

Permalink
chore: update docs (#91)
Browse files Browse the repository at this point in the history
Update docs with new install instructions etc.

Fixes #83
  • Loading branch information
achingbrain authored May 25, 2022
1 parent 01e2a7b commit 5b072ff
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 46 deletions.
34 changes: 16 additions & 18 deletions packages/libp2p-daemon-client/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
libp2p-daemon client JavaScript implementation
======
# libp2p-daemon client JavaScript implementation <!-- omit in toc -->

[![](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/)
Expand All @@ -8,26 +7,24 @@ 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 <!-- omit in toc -->

[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

The specs for the daemon are currently housed in the go implementation. You can read them at [libp2p/go-libp2p-daemon](https://github.com/libp2p/go-libp2p-daemon/blob/master/specs/README.md)

## Install

`npm install libp2p-daemon-client`
`npm install @libp2p/daemon-client`

## Usage

Expand All @@ -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
Expand Down Expand Up @@ -81,4 +79,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
13 changes: 8 additions & 5 deletions packages/libp2p-daemon-protocol/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
# js-libp2p-daemon-protocol
# js-libp2p-daemon-protocol <!-- omit in toc -->

<a href="http://libp2p.io/"><img src="https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square" /></a>
<a href="http://webchat.freenode.net/?channels=%23libp2p"><img src="https://img.shields.io/badge/freenode-%23libp2p-yellow.svg?style=flat-square" /></a>
<a href="https://discuss.libp2p.io"><img src="https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg" /></a>

> Contains the protobuf definitions of the communication protocol for libp2p daemons
## Table of contents <!-- omit in toc -->

- [Install](#install)
- [Contribute](#contribute)
- [License](#license)

## Install

```
Expand All @@ -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
32 changes: 19 additions & 13 deletions packages/libp2p-daemon-server/README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
libp2p-daemon JavaScript implementation
======
# libp2p-daemon JavaScript implementation <!-- omit in toc -->

<a href="http://libp2p.io/"><img src="https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square" /></a>
<a href="http://webchat.freenode.net/?channels=%23libp2p"><img src="https://img.shields.io/badge/freenode-%23libp2p-yellow.svg?style=flat-square" /></a>
<a href="https://discuss.libp2p.io"><img src="https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg" /></a>
<a href="https://waffle.io/libp2p/libp2p"><img src="https://img.shields.io/badge/pm-waffle-yellow.svg?style=flat-square" /></a>

> 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 <!-- omit in toc -->

[Jacob Heun](https://github.com/jacobheun)
- [Specs](#specs)
- [Install](#install)
- [Usage](#usage)
- [Contribute](#contribute)
- [License](#license)

## Specs

Expand All @@ -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
Expand All @@ -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
26 changes: 16 additions & 10 deletions packages/libp2p-daemon/README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
libp2p-daemon JavaScript implementation
======
# libp2p-daemon JavaScript implementation <!-- omit in toc -->

<a href="http://libp2p.io/"><img src="https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square" /></a>
<a href="http://webchat.freenode.net/?channels=%23libp2p"><img src="https://img.shields.io/badge/freenode-%23libp2p-yellow.svg?style=flat-square" /></a>
<a href="https://discuss.libp2p.io"><img src="https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg" /></a>
<a href="https://waffle.io/libp2p/libp2p"><img src="https://img.shields.io/badge/pm-waffle-yellow.svg?style=flat-square" /></a>

> 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 <!-- omit in toc -->

[Jacob Heun](https://github.com/jacobheun)
- [Specs](#specs)
- [Install](#install)
- [Usage](#usage)
- [Contribute](#contribute)
- [License](#license)

## Specs

Expand All @@ -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
Expand All @@ -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

0 comments on commit 5b072ff

Please sign in to comment.