Skip to content

Commit ec8ea54

Browse files
committed
feat(ipip): added routing v1 routers parameter IPIP
1 parent 7435f5f commit ec8ea54

File tree

2 files changed

+80
-1
lines changed

2 files changed

+80
-1
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# IPIP-0388: Routing v1 Multiple Routers
2+
3+
<!-- IPIP number should match its pull request number. After you open a PR,
4+
please update title and include an abbreviated title in the filename too:
5+
`0000-draft-title-abbrev.md`. -->
6+
7+
- Start Date: 2023-03-20
8+
- Related Issues:
9+
- (add links here)
10+
11+
## Summary
12+
13+
Adding support for querying individual routers to a single Routing v1 HTTP endpoint.
14+
15+
## Motivation
16+
17+
At the moment there is no way for a Routing v1 client to ask for a specific routing backend to be used nor for a Routing v1 endpoint to signal what routing backends they support. When Routing v1 is used as a proxy for one or more routing systems (e.g. IPFS Public DHT, IPNI, mainlineDHT, ...) clients may want to be able to judge a given endpoint's suitability to be a proxy for that routing system.
18+
19+
For instance if all-the-routers.alice.tld is very good at proxying IPNI requests but bad at proxying IPFS Public DHT requests, but dht-proxy.bob.tld is good at proxying IPFS Public DHT requests. In this scenario clients wanting good responses would have to ask both Alice and Bob to do DHT lookups for them even though Alice's DHT lookups are unneccessary because Bob is doing them. Similarly, clients could evaluate the best endpoint to request responses from since they can now do comparisons between largely equivalent routing systems. Additionally, this allows clients to discover the data sources behind Routing v1 endpoints without as much out of band information.
20+
21+
## Detailed design
22+
23+
AKA Solution Proposal
24+
25+
The proposal is to:
26+
1. Add a `?routing=<list-of-routers>` optional parameter to `GET /routing/v1/providers/{CID}` that indicates which routing systems to use
27+
2. Add an `OPTIONS /routing/v1/providers` endpoint which when queried may respond with a `SUPPORTED_ROUTERS` header key, with the value as the comma separated list of the routing systems supported
28+
29+
## Design rationale
30+
31+
The rationale fleshes out the specification by describing what motivated
32+
the design and why particular design decisions were made.
33+
34+
Provide evidence of rough consensus and working code within the community,
35+
and discuss important objections or concerns raised during discussion.
36+
37+
### User benefit
38+
39+
End users will be able to query endpoints that provide proxies for multiple routing systems (e.g. cid.contact/routing/v1) and get back DHT, IPNI or both depending on what they need.
40+
41+
For users that are running a DHT client locally they can dynamically evaluate if cid.contact's DHT proxy is either good enough that they can conserve their local resources by reducing how they use their client. Similarly, if they discover that their local DHT results are better than cid.contact's DHT proxy then they can ease the burden on cid.contact by only requesting IPNI results and doing the DHT lookups themselves.
42+
43+
### Compatibility
44+
45+
This should not effect existing clients or servers
46+
47+
### Security
48+
49+
Mostly not applicable. However, clients should not expect proxies to give 1:1 mappings with the underlying systems if they are too expensive and should consider that when evaluating the performance of individual endpoints.
50+
51+
### Alternatives
52+
53+
- Having clients fetch from multiple sources which may have overlapping data -> lots of work on servers and extra processing work for clients
54+
- Having clients fetch from a single source with the best data -> is not friendly to the introduction of new services and may result in less data being retrieved
55+
- Having servers restrict to one endpoint per router (e.g. dht.alice.tld and ipni.alice.tld or alice.tld/dht/routing/v1 and alice.tld/ipni/routing/v1) -> also doable, but discoverability of new router types would require other semantics (e.g. an OPTIONS request to alice.tld/routing/v1)
56+
- Having `OPTIONS` on `/routing/v1` instead of `/routing/v1/providers` -> also good, perhaps a better choice. given that not every router will support every request type there's a tradeoff around how low level you put the `OPTIONS`. In theory both could be supported.
57+
- Having `OPTIONS` on `/routing/v1/providers/{CID}` in the event the CID tells you some information about which providers to use (e.g. for non-BitTorrent codecs don't use mainline DHT) -> also doable. Unclear if this would be useful in practice since sometimes the codec information will get lost (e.g. replaced with the raw/0x55 codec).
58+
59+
### Copyright
60+
61+
Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).

routing/ROUTING_V1_HTTP.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Specifications for some transfer protocols are provided in the "Transfer Protoco
6464

6565
## API
6666

67-
### `GET /routing/v1/providers/{CID}`
67+
### `GET /routing/v1/providers/{CID}[?routers=<list-of-routers>]`
6868

6969
#### Response codes
7070

@@ -90,6 +90,18 @@ Response limit: 100 providers
9090

9191
Each object in the `Providers` list is a *read provider record*.
9292

93+
#### List of Routers
94+
95+
A list of routers that should be consulted for responses. The specification imposes no constraints on the order by which the results are returned. Implementers are free to return results as they are found.
96+
97+
If none are provided the backend may decide which ones to use. For a list of known routers see below.
98+
99+
To select all routers use `?routers=*`. To determine the list of available routers see the `OPTIONS` API below
100+
101+
### `OPTIONS /routing/v1/providers`
102+
103+
If supported the server should include a `SUPPORTED_ROUTERS` header key, with the value as the comma separated list of the routing systems supported.
104+
93105
## Pagination
94106

95107
This API does not support pagination, but optional pagination can be added in a backwards-compatible spec update.
@@ -173,3 +185,9 @@ Specification: [ipfs/go-graphsync/blob/main/docs/architecture.md](https://github
173185
- `PieceCID`: the CID of the [piece](https://spec.filecoin.io/systems/filecoin_files/piece/#section-systems.filecoin_files.piece) within which the data is stored
174186
- `VerifiedDeal`: whether the deal corresponding to the data is verified
175187
- `FastRetrieval`: whether the provider claims there is an unsealed copy of the data available for fast retrieval
188+
189+
## Known Routers
190+
191+
This section contains a non-exhaustive list of known routers that may be supported by clients and servers.
192+
193+
- "ipfs-public-dht" - The IPFS Public DHT corresponding to the libp2p protocol ID `/ipfs/kad/1.0.0`

0 commit comments

Comments
 (0)