libp2p-daemon client implementation
$ npm i @libp2p/daemon-client
The specs for the daemon are currently housed in the go implementation. You can read them at libp2p/go-libp2p-daemon
There are currently two implementations of the libp2p-daemon
:
import { createClient } from '@libp2p/daemon-client'
import { multiaddr } from '@multiformats/multiaddr'
const serverAddr = multiaddr('/ip4/127.0.0.1/tcp/1234')
const client = createClient(serverAddr)
// interact with the daemon
let identify
try {
identify = await client.identify()
} catch (err) {
// ...
}
// close the socket
await client.close()
- Getting started
close
connect
identify
listPeers
openStream
registerStream
dht.put
dht.get
dht.findPeer
dht.provide
dht.findProviders
dht.getClosestPeers
dht.getPublicKey
Licensed under either of
- Apache 2.0, (LICENSE-APACHE / http://www.apache.org/licenses/LICENSE-2.0)
- MIT (LICENSE-MIT / http://opensource.org/licenses/MIT)
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.