mirror of
https://github.com/vacp2p/specs.git
synced 2026-01-10 07:47:59 -05:00
libp2p: minor fixes, internal section link, up-to-date repo URLs
Repositories like ``https://github.com/diasdavid/abstract-*`` are now called ``https://github.com/diasdavid/interface-*``.
This commit is contained in:
@@ -5,14 +5,14 @@
|
||||
|
||||
## 6.1 libp2p
|
||||
|
||||
libp2p, the top module that interfaces all the other modules that make a libp2p instance, must offer an interface for dialing to a peer and plugging in all of the modules (e.g. which transports) we want to support. We present libp2p interface and UX on setion 6.6, after presenting every other module interface.
|
||||
`libp2p`, the top module that interfaces all the other modules that make a `libp2p` instance, must offer an interface for dialing to a peer and plugging in all of the modules (e.g. which transports) we want to support. We present `libp2p` interface and UX on [section 6.6](#66-libp2p-interface-and-ux), after presenting every other module interface.
|
||||
|
||||
## 6.2 Peer Routing
|
||||
|
||||

|
||||
|
||||
A Peer Routing service offers a way for libp2p Node to find the PeerInfo of another Node, so that it can dial to that node. In it is most pure form, a Peer Routing module should have a interface that given a 'key', a set of PeerInfos are returned.
|
||||
See https://github.com/diasdavid/abstract-peer-routing for the interface and tests.
|
||||
A Peer Routing service offers a way for a `libp2p` Node to find the PeerInfo of another Node, so that it can dial to that node. In its most pure form, a Peer Routing module should have an interface that given a 'key', a set of PeerInfos are returned.
|
||||
See https://github.com/diasdavid/interface-peer-routing for the interface and tests.
|
||||
|
||||
## 6.3 Swarm
|
||||
|
||||
@@ -24,38 +24,37 @@ https://github.com/diasdavid/js-libp2p-swarm#usage
|
||||
|
||||

|
||||
|
||||
https://github.com/diasdavid/abstract-transport
|
||||
https://github.com/diasdavid/interface-transport
|
||||
|
||||
### 6.3.2 Connection
|
||||
|
||||

|
||||
|
||||
https://github.com/diasdavid/abstract-connection
|
||||
https://github.com/diasdavid/interface-connection
|
||||
|
||||
### 6.3.3 Stream Muxing
|
||||
|
||||

|
||||
|
||||
https://github.com/diasdavid/abstract-stream-muxer
|
||||
https://github.com/diasdavid/interface-stream-muxer
|
||||
|
||||
## 6.4 Distributed Record Store
|
||||
|
||||

|
||||
|
||||
https://github.com/diasdavid/abstract-record-store
|
||||
|
||||
https://github.com/diasdavid/interface-record-store
|
||||
|
||||
## 6.5 Peer Discovery
|
||||
|
||||
A Peer Discovery system interface should return PeerInfo objects, as it finds new peers to be considered to our Peer Routing schemes
|
||||
A Peer Discovery system interface should return PeerInfo objects, as it finds new peers to be considered by our Peer Routing schemes.
|
||||
|
||||
## 6.6 libp2p interface and UX
|
||||
|
||||
libp2p implementations should enable for it to be instantiated programatically, or to use a previous compiled lib some of the protocol decisions already made, so that the user can reuse or expand.
|
||||
`libp2p` implementations should enable for it to be instantiated programatically, or to use a previous compiled library with some of the protocol decisions already made, so that the user can reuse or expand.
|
||||
|
||||
### Constructing libp2p instance programatically
|
||||
### Constructing a libp2p instance programatically
|
||||
|
||||
Example made with JavaScript, should be mapped to other languages
|
||||
Example made with JavaScript, should be mapped to other languages:
|
||||
|
||||
```JavaScript
|
||||
var Libp2p = require('libp2p')
|
||||
@@ -72,17 +71,17 @@ node.addPeerRouting(peerRoutingInstance)
|
||||
node.addDistributedRecordStore(distributedRecordStoreInstance)
|
||||
```
|
||||
|
||||
Configuring libp2p is quite straight forward since most of the configuration comes from instantiating the several modules, one at each time.
|
||||
Configuring `libp2p` is quite straightforward since most of the configuration comes from instantiating the several modules, one at a time.
|
||||
|
||||
### Dialing and Listening for connections to/from a peer
|
||||
|
||||
Ideally, libp2p uses its own mechanisms (PeerRouting and Record Store) to find a way to dial to a given peer
|
||||
Ideally, `libp2p` uses its own mechanisms (PeerRouting and Record Store) to find a way to dial to a given peer:
|
||||
|
||||
```JavaScript
|
||||
node.dial(PeerInfo)
|
||||
```
|
||||
|
||||
To receive an incoming connection, specify one or more protocols to handle
|
||||
To receive an incoming connection, specify one or more protocols to handle:
|
||||
|
||||
```JavaScript
|
||||
node.handleProtocol('<multicodec>', function (duplexStream) {
|
||||
@@ -92,8 +91,8 @@ node.handleProtocol('<multicodec>', function (duplexStream) {
|
||||
|
||||
### Finding a peer
|
||||
|
||||
Finding a peer functionality is done through Peer Routing, so the interface is the same.
|
||||
Finding a peer is done through Peer Routing, so the interface is the same.
|
||||
|
||||
### Storing and Retrieving Records
|
||||
|
||||
Like Finding a Peer, Storing and Retrieving records is done through Record Store, so the interface is the same.
|
||||
Like Finding a peer, Storing and Retrieving records is done through Record Store, so the interface is the same.
|
||||
|
||||
@@ -57,6 +57,8 @@ This RFC is organized by chapters described on the *Table of contents* section.
|
||||
- [6.2 Peer Routing](6-interfaces.md#62-peer-routing)
|
||||
- [6.3 Swarm](6-interfaces.md#63-swarm)
|
||||
- [6.4 Distributed Record Store](6-interfaces.md#64-distributed-record-store)
|
||||
- [6.5 Peer Discovery](6-interfaces.md#65-peer-discovery)
|
||||
- [6.6 libp2p interface and UX](6-interfaces.md#66-libp2p-interface-and-ux)
|
||||
- [7 Properties](7-properties.md)
|
||||
- [7.1 Communication Model - Streams](7-properties.md#71-communication-model---streams)
|
||||
- [7.2 Ports - Constrained Entrypoints](7-properties.md#72-ports---constrained-entrypoints)
|
||||
|
||||
Reference in New Issue
Block a user