IPIP-0484: Opt-in Filtering in Routing V1 HTTP API

Related Issues
ipfs/ipfs-check/issues/70
ipfs/boxo/pull/678
History
Commit History
Feedback
GitHub ipfs/specs (inspect source, open issue)

1. Summary

Add opt-in support for filtering specific network transports and/or transfer protocols to the Delegated Routing v1 HTTP endpoints via HTTP GET parameters.

2. Motivation

IPFS aims to allow ubiquitous data exchange across different runtimes and platforms. One of the most challenging aspects of this goal is the diversity of network conditions and capabilities across different environments. Web browsers have a very limited network stack, and most web browsers do not support the full range of network transport protocols that are commonly used in other IPFS implementations.

The Delegated Routing v1 API empowers resource constrained clients like web browsers by significantly reducing the number of network connections necessary to fetch content addressed data directly from provider peers.

However, there are many cases where most of the results from the Delegated Routing v1 API are not actionable by clients, because the client does not support either the network transport protocol or the transfer protocol of the provider.

For instance, web browsers are limited to a specific set of network transport protocols, namely HTTPS, Secure WebSockets, WebTransport (emerging), and WebRTC. Consequently, providing information about providers that exclusively support TCP and/or UDP is not beneficial for browser-based clients, as they are unable to utilize such connections.

Moreover, Helia, the most actively maintained browser IPFS implementation, supports block retrieval by CID with Bitswap and Trustless Gateways, but does not support Graphsync.

This means that returning providers that only support raw TCP, raw UDP/QUIC, or Graphsync from the Delegated Routing API is not useful for browser clients, and results in unnecessary network traffic for browser clients.

3. Note on terminology

The term "transport" is overloaded in the IPFS ecosystem.

In the context of this IPIP, we refer to the network layer transport protocol, e.g. TCP, QUIC, WebTransport, as "network transport protocol" to avoid ambiguity.

"Transfer protocol" refers to data transfer protocols, i.e. content-addressed block retrieval protocols, e.g. Bitswap, Graphsync, HTTP.

4. Detailed design

4.1 Network Address Filtering

The proposed change is to add a ?filter-addrs parameter to the GET /routing/v1/providers/{cid} and GET /routing/v1/peers/{peer-id} endpoints of [http-routing-v1]:

4.2 IPFS Protocol Filtering

The proposed change is to add a ?filter-protocols parameter to the GET /routing/v1/providers/{cid} and GET /routing/v1/peers/{peer-id} endpoints of [http-routing-v1]:

Even though some of existing IPFS transfer protocol names start with transport, e.g. transport-bitswap, transport-graphsync-filecoinv1, and transport-ipfs-gateway-http, they should not to be confused with the network transport protocols used in peer addresses, which are filtered using the filter-addrs parameter.

5. Design rationale

5.1 User benefit

By filtering out providers that do not support the desired network transport protocol and/or transfer protocol, the client can reduce the traffic necessary in order to fetch the data.

Moreover, it makes it much easier to determine whether there are any browser-usable providers for a given CID, which is a common use case for clients.

5.2 Compatibility

This should not effect existing clients or servers.

The default behavior when ?filter-addrs and ?filter-protocols is not passed is left unspecified, this IPIP is limited to opt-in behavior.

A. References

[http-routing-v1]
Delegated Routing V1 HTTP API. Gus Eggert; Masih H. Derkani; Henrique Dias; Marcin Rataj; Daniel Norman. 2024-10-29. URL: https://specs.ipfs.tech/routing/http-routing-v1/
[rfc2119]
Key words for use in RFCs to Indicate Requirement Levels. S. Bradner. IETF. March 1997. Best Current Practice. URL: https://www.rfc-editor.org/rfc/rfc2119

B. Acknowledgments

Editor
Daniel Norman (Shipyard) GitHub