Skip to content

Easy-to-implement gateway-less IPFS URLs #192

@anguslees

Description

@anguslees

(I am new to IPFS contribution and have no idea which repo/forum I should use for this. Please move as appropriate.)

Problem: I want to point all my tools/configs at content stored in IPFS because IPFS is awesome. It is not feasible (now, or perhaps ever) to add a full dhtclient node implementation to every tool, particularly across every programming language.

Non-solution: I can use HTTP gateway URLs, but then my configs are not portable across sites. I want to use my gateway at my site (because caching is important for large content), but that gateway host doesn't make sense for other sites.

Implication: I think we need to start using "real" (gateway-less) IPFS URLs (ipfs:/...) now for portability, and invent a trivial-to-implement "client" that can fetch IPFS content using libraries that are already commonly available in programming languages. Importantly, it should be feasible to propose adding this trivial-to-implement client to every tool that wants to fetch content.

Note that once we have this, we can evolve the actual client implementations over time without changing the high-level IPFS semantics exposed to users.

Proposal: I think the only "trivial" solution available right now is converting IPFS URLs to HTTP(S) gateway URLs, and then reuse existing ubiquitous HTTP(S) libraries. I propose we define a semi-standard way to "discover" the local IPFS gateway, and then implementations can just do a trivial URL string manipulation to switch ipfs:/path to $gateway/path (with some protection against "../" attacks).

Concrete proposal:

  1. Declare a semi-standard IPFS_GATEWAY environment variable to specify the HTTP(S) URL prefix.
  2. Fallback to a _ipfs-gateway._tcp DNS-SD TXT lookup for easy site-wide configuration (controversial).
  3. Fallback to https://ipfs.io/ (controversial?).
  4. Fetch content over regular HTTP(S) from the gateway. In particular, we're trusting the discovery result, gateway implementation, and gateway<->client communication to offload content/checksum verification.
  5. Start proposing patches to various non-IPFS projects that take advantage of the above to add support for ipfs:/ URLs.
  6. Profit. (Actually, continue to iterate on the internals of the above when/if "more native" approaches become available - eg long-lived golang programs could embed a full dhtclient node)

At the moment I have only considered read-only workloads (this is the vast majority of my personal use-cases), but the above should extend to write as well - assuming the gateway allows uploads.

Thoughts? I have a specific tool I would like to add this to, and was hoping to get some consensus on the approach before starting on code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions