Skip to content

Commit e66a70a

Browse files
hacdiaslidel
andcommitted
docs: start IPIP 0417
Co-authored-by: Marcin Rataj <[email protected]>
1 parent 17e46c6 commit e66a70a

File tree

2 files changed

+101
-0
lines changed

2 files changed

+101
-0
lines changed

src/ipips/ipip-0417.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
title: "IPIP-0417: Delegated Peer Routing HTTP API"
3+
date: 2023-05-29
4+
ipip: proposal
5+
editors:
6+
- name: Henrique Dias
7+
github: hacdias
8+
url: https://hacdias.com/
9+
affiliation:
10+
name: Protocol Labs
11+
url: https://protocol.ai/
12+
relatedIssues:
13+
- https://github.com/ipfs/specs/pull/410
14+
- https://github.com/ipfs/kubo/pull/9877
15+
order: 417
16+
tags: ['ipips']
17+
---
18+
19+
## Summary
20+
21+
This IPIP specifies `/routing/v1/peers/{peer-id}` HTTP API to offload peer routing onto another server.
22+
23+
## Motivation
24+
25+
The motivation of this IPIP extends the one of :cite[ipip-0337] and :cite[ipip-0379],
26+
which introduced delegated content routing and delegated naming, respectively. Now,
27+
we expand upon those basis to introduce peer routing, reducing the barrier for interaction
28+
across different systems.
29+
30+
## Detailed design
31+
32+
Add `/routing/v1/peers/{peer-id}` to the existing :cite[http-routing-v1] specification,
33+
as well as the new Peer schema.
34+
35+
## Design rationale
36+
37+
In line with the remaining Routing V1 API, this IPIP introduces a new HTTP GET
38+
endpoint that is used to retrieve peer records for a certain peer.
39+
40+
### User benefit
41+
42+
The user benefit brought by this PR is similar to the one in :cite[ipip-0379],
43+
but instead of offloading the naming process, we offload the peer discovery and
44+
routing.
45+
46+
### Compatibility
47+
48+
See the "Compatibility" section of :cite[ipip-0337].
49+
50+
### Security
51+
52+
TODO
53+
54+
### Alternatives
55+
56+
TODO
57+
58+
### Copyright
59+
60+
Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).

src/routing/http-routing-v1.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,25 @@ Response limit: 100 providers
102102

103103
Each object in the `Providers` list is a *read provider record*.
104104

105+
## Peers API
106+
107+
### `GET /routing/v1/peers/{peer-id}`
108+
109+
#### Path Parameters
110+
111+
- `peer-id` is the [Peer ID](https://github.com/libp2p/specs/blob/master/peer-ids/peer-ids.md) to fetch peer records for,
112+
represented as a CIDv1 encoded with `libp2p-key` codec.
113+
114+
#### Response Status Codes
115+
116+
- `200` (OK): the response body contains the peer record.
117+
- `404` (Not Found): must be returned if no matching records are found.
118+
- `422` (Unprocessable Entity): request does not conform to schema or semantic constraints.
119+
120+
#### Response Body
121+
122+
A [`peer` schema record](#peer).
123+
105124
## IPNS API
106125

107126
### `GET /routing/v1/ipns/{name}`
@@ -199,6 +218,28 @@ Access-Control-Allow-Origin: *
199218
Access-Control-Allow-Methods: GET, OPTIONS
200219
```
201220

221+
## Known Schemas
222+
223+
This section contains a non-exhaustive list of known schemas that MAY be supported by clients and servers.
224+
225+
### Peer
226+
227+
The `peer` schema represents an arbitrary peer.
228+
229+
```json
230+
{
231+
"Schema": "peer",
232+
"ID": "12D3K...",
233+
"Addrs": ["/ip4/..."],
234+
"Protocols": ["transport-bitswap", ...]
235+
}
236+
```
237+
238+
- `ID`: the [Peer ID](https://github.com/libp2p/specs/blob/master/peer-ids/peer-ids.md).
239+
- `Addrs`: a list of known [multiaddrs][multiaddr] for this peer. This list MAY be incomplete.
240+
- `Protocols`: a list of protocols known to be supported by this peer.
241+
- If empty, it means the server is missing protocol information, and the client should use `ID` and `Addrs` to connect to the peer and use the [libp2p identify protocol](https://github.com/libp2p/specs/tree/master/identify) to learn about supported ones.
242+
202243
## Known Transfer Protocols
203244

204245
This section contains a non-exhaustive list of known transfer protocols (by name) that may be supported by clients and servers.

0 commit comments

Comments
 (0)