ipfs / specs

Technical specifications for the IPFS protocol stack
https://specs.ipfs.tech
1.15k stars 231 forks source link

[Feature Request]: Add IPFS Loopback Functionality #475

Open emendir opened 3 weeks ago

emendir commented 3 weeks ago

TL;DR

Description

Some IPFS commands/RPCs, when provided with the IPFS peer ID of the local node instead of that of another, result in error messages, whereas others don't produce an error but don't work.

Of course it's debatable whether supporting interacting with localhost is sensible at all.

Here are my main arguments for introducing such features:

Known Examples:

Here are the two kubo commands which I am aware of that do not support interacting with the local node. There may be many other commands that I am not aware of that have the same problem. We should get a comprehensive list of them.

Ping

MY_PEER_ID=$(ipfs id -f="<id>")
ipfs ping $MY_PEER_ID

This produces the following error message: Error: error: can't ping self

LibP2P Stream Mounting:

MY_PEER_ID=$(ipfs id -f="<id>")
ipfs p2p forward /x/loopback-test /ip4/127.0.0.1/tcp/7890 /p2p/$MY_PEER_ID

This command exits normally, and the entry is listed correctly when running ipfs p2p ls.

However, it doesn't work.

Loopback Address

While we're talking about loopback functionality, if we decide to implement loopback functionality to those IPFS commands/RPCs that don't support it but could, it is worth considering whether we should also introduce a dedicated loopback address, similar to the way IP has the localhost name or 127.0.0.0/8 address space as loopback addresses.

Here are some ideas, feel free to come up with other cooler suggestions:

Stebalien commented 2 weeks ago

Discussed long ago at https://github.com/libp2p/go-libp2p/issues/328. But you should really close this and open a discussion at https://discuss.ipfs.tech/ as it's unlikely that anyone will engage here.