-
Notifications
You must be signed in to change notification settings - Fork 281
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
P2P Circuit Addressing #72
Comments
This is a bit of a rabbit hole, but I'm glad this conversation is starting 👍 In general I agree that To me, it always meant that this peer is able to accept relayed connections - but afaik, that isn't documented anywhere and its very arbitrary at best. Moreover, a number of questions pop up immediately, such as - which addresses (transports) does this peer listen on, all of them ( As far as the js implementation goes, we should be fine, I made sure that |
So, there are two questions here:
The second one basically says "just use some circuit". IMO, this is only useful on the CLI where a user may want to be able to specify "please use a relay". That's not possible on go right now but should be. The first one is the question at hand. Basically, I see the the transport part as telling libp2p to:
So,
Concisely, |
Agreed to all you said in your second comment @Stebalien -- everything that comes before the last Let's collect the places where this matters, e.g. |
As the author of the hack in go-ipfs-addr, I concur. Let's be consistent. |
My preliminary hackery is here: libp2p/go-libp2p-circuit#48 The original reason for having the The PR doesn't quite work yet. |
Notice:
If we were to listen on a specific relay, we'd get:
With the changes proposed here, we'd now list:
Regardless, nether |
|
These three are ready for CR:
Then need to bubble the changes up to go-ipfs. |
You can also try this out in go-ipfs by doing |
Also, can we finally add |
I'm already way deep into this rabbit hole, that will have to happen another time :) A simple update to go-ipfs-config brought me here and I need to finally wrap that up. |
I've worked through the update, but unfortunately there are more unrelated changes neccessary: ipfs/kubo#5553 Help very welcome 🚁 |
So what's our compatibility story? |
Seems the shim should be unnecessary and the dialer will still work though (by looking at the code). |
We used to have to do this as these addresses had `/ipfs/QmId` appended at the *transport* layer. However, we were able to remove this with the transport refactor so we can now remove this check. fixes libp2p/specs#72 License: MIT Signed-off-by: Steven Allen <steven@stebalien.com>
Currently in go-libp2p, when we encounter a p2p circuit multiaddr we treat the entire multiaddr as part of the transport (including the
/ipfs/QmId
part).Basically, we considered
/p2p-circuit/ipfs/QmId
to be short for/p2p-circuit/ipfs/QmId/ipfs/QmId
(where the first is the target for the circuit relay and the second is the peer) which would resolve to/p2p-circuit/ip4/.../tcp/.../ipfs/QmId
. However, according to the p2p-circuit multiaddr definition, this is incorrect; the/p2p-circuit/
multiaddr takes no arguments.We did this because we (used to) only pass the "transport" part to the transport. We didn't pass the peer ID.
However, now that we've refactored go transports, we do pass in the peer ID.
After reconsidering, I realized that treating
/p2p-circuit/
as the full transport is probably more correct. For example, when we encounter/ipfs/QmId
by itself in the swarm, we don't say that the "transport" part is,/ipfs/QmId
, we say that no transport-level address has been specified and we look it up. In this case, the/p2p-circuit/
transport has been (completely) specified but the transport of the connection after the the circuit part has not (it's not/ipfs/QmId
).I bring this up because:
go-libp2p-peerstore.InfoFromP2pAddr
. At the very least, we need to be consistent.Proposed solution: Stop doing this. That is, treat
/p2p-circuit/
as a full transport address (like/ip4/xxx/tcp/yyy
). This will simplify a bunch of code and remove a nasty hack.Downside: We have to be careful not to break published PeerInfo records. That is, if an old go-ipfs node (not sure about js) sees:
It won't be able to use this p2p circuit address.
Note: removing the hack in go-ipfs-addr won't introduce this problem as long as the go-libp2p-circuit transport continues to return the full
/p2p-circuit/ipfs/QmId
addresses.@dryajov how does js-libp2p handle this? If I give js-libp2p an address of the form
/p2p-circuit/ipfs/QmId
, what kind ofPeerInfo
struct would I get back out?The text was updated successfully, but these errors were encountered: