47 lines
1.6 KiB
Markdown
Raw Normal View History

2015-12-11 20:23:03 -08:00
interface-peer-routing
2015-09-19 16:46:52 +01:00
=====================
2019-10-18 14:25:47 +02:00
**WIP: This module is not yet implemented**
2015-09-19 16:46:52 +01:00
> A test suite and interface you can use to implement a Peer Routing module for libp2p.
2015-12-11 20:23:03 -08:00
The primary goal of this module is to enable developers to pick and swap their Peer Routing module as they see fit for their libp2p installation, without having to go through shims or compatibility issues. This module and test suite were heavily inspired by abstract-blob-store and interface-stream-muxer.
2015-09-19 16:46:52 +01:00
Publishing a test suite as a module lets multiple modules all ensure compatibility since they use the same test suite.
# Modules that implement the interface
2018-02-20 10:01:51 +00:00
- [JavaScript libp2p-kad-dht](https://github.com/libp2p/js-libp2p-kad-dht)
- [JavaScript libp2p-delegated-peer-routing](https://github.com/libp2p/js-libp2p-delegated-peer-routing)
2015-09-19 16:46:52 +01:00
# Badge
2015-12-11 20:23:03 -08:00
Include this badge in your readme if you make a module that is compatible with the interface-record-store API. You can validate this by running the tests.
2015-09-19 16:46:52 +01:00
2018-02-20 10:01:51 +00:00
![](https://raw.githubusercontent.com/libp2p/interface-peer-routing/master/img/badge.png)
2015-09-19 16:46:52 +01:00
# How to use the battery of tests
## Node.js
2019-10-18 14:25:47 +02:00
TBD
2015-09-19 16:46:52 +01:00
# API
2018-02-20 10:01:51 +00:00
A valid (read: that follows this abstraction) Peer Routing module must implement the following API.
2015-09-19 16:46:52 +01:00
### findPeer
2015-09-19 16:46:52 +01:00
- `findPeer(peerId)`
2015-09-19 16:46:52 +01:00
Query the network for all multiaddresses associated with a `PeerId`.
2015-09-19 16:46:52 +01:00
**Parameters**
- [peerId](https://github.com/libp2p/js-peer-id).
2015-09-19 16:46:52 +01:00
**Returns**
It returns the [peerId](https://github.com/libp2p/js-peer-id) together with the known peers [multiaddrs](https://github.com/multiformats/js-multiaddr), as follows:
`Promise<{ id: PeerId, multiaddrs: Multiaddr[] }>`