Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

feature: p2p stream #1828

Closed
pgte opened this issue Jan 17, 2019 · 13 comments
Closed

feature: p2p stream #1828

pgte opened this issue Jan 17, 2019 · 13 comments
Assignees
Labels
kind/support A question or request for support kind/wontfix-migration-available status/ready Ready to be worked topic/libp2p Topic libp2p

Comments

@pgte
Copy link
Contributor

pgte commented Jan 17, 2019

Apparently go-ipfs now supports, in its external interface, dialing to a specific peer and protocol.
I'm not sure what are the plans for also adding this to the js-ipfs interface and implementing it.

This would be very helpful, allowing applications to use custom protocols in a standard way that would be usable across IPFS implementations.

@alanshaw
Copy link
Member

alanshaw commented Jan 18, 2019

@pgte we're working on exposing libp2p as ipfs.libp2p but is accessible as ipfs._libp2pNode right now.

I think this is really a question for @jacobheun / @vasco-santos.

@alanshaw alanshaw added kind/support A question or request for support status/ready Ready to be worked labels Jan 18, 2019
@pgte
Copy link
Contributor Author

pgte commented Jan 18, 2019 via email

@jacobheun
Copy link
Contributor

@pgte could you elaborate on what you'd like to use the interface for? We are looking at improving the libp2p interfaces and it would be helpful to better understand the use cases you need. We could look at replicating the ipfs p2p interfaces from go, but I'd like to have a better understanding of what's needed before we do that.

@pgte
Copy link
Contributor Author

pgte commented Jan 22, 2019

@jacobheun In the browser, after I discover a peer and I have the peer address(es), we need to open a custom libp2p protocol to it, which returns me a duplex stream.
Right now we're using ipfs._libp2p.dial(), but that makes this application incompatible with using the HTTP interface with either go or js-ipfs running as daemons.

Instead, we would like to be able to open and use, from the browser, a duplex stream to a specific peer and protocol. It would have to support the browser clients (websockets) and I should be able to use an embedded IPFS node without any code change.

@pgte
Copy link
Contributor Author

pgte commented Jan 22, 2019

Another perhaps interesting aspect of this:
The current go implementation of the p2p command has a native socket interface.
We would require it to run over websockets.. (see comment)

@jacobheun
Copy link
Contributor

Looking at the go p2p api, unless I am missing something, it looks like opening a stream to a specific peer and protocol for an embedded node isn't really supported. Most of the logic seems to be built around forwarding streams. It feels like a simpler approach would be:

const stream = ipfs.p2p.open(protocol, targetAddress)

@pgte
Copy link
Contributor Author

pgte commented Jan 22, 2019

I was talking about supporting this go-ipfs feature:

1__bash

Yes, that JS API would work.

@pgte
Copy link
Contributor Author

pgte commented Jan 22, 2019

(with an optional third argument for the peer address, similarly to the go-ipfs CLI)

@jacobheun
Copy link
Contributor

Ah! I'm running a recent build of go-ipfs master (0.4.19-dev) and dial is not in there. What version of go-ipfs are you running?

I think we can just stick to that existing go functionality, ipfs.p2p.streams.dial(...), to keep them the same. If dial accidentally got removed I'll create an issue in go-ipfs.

@jacobheun
Copy link
Contributor

Yeah, it was removed in ipfs/kubo#4929. @magik6k we're looking at adding the p2p streams dial command that was previously in go into js-ipfs. Is there a reason that was removed? The dial command is really convenient for js-ipfs nodes. It looks like it was removed in favor of an ssh approach.

@magik6k
Copy link
Member

magik6k commented Jan 22, 2019

There was a major refactor of this feature in 0.4.18, see https://github.com/ipfs/go-ipfs/blob/master/CHANGELOG.md#commands for more details. p2p stream dial changed name to p2p forward

@jacobheun
Copy link
Contributor

Ok, I think we may want to update the docs for the command at some point. Using the cli --help to get more information about the commands locally it isn't very clear what the command is doing, or why/when it should be used, and the description is kind of a circular definition.

@daviddias daviddias added the topic/libp2p Topic libp2p label Oct 1, 2019
@SgtPooki SgtPooki self-assigned this May 17, 2023
@SgtPooki SgtPooki moved this to 🥞 Todo in js-ipfs deprecation May 17, 2023
@SgtPooki
Copy link
Member

js-ipfs is being deprecated in favor of Helia. You can #4336 and read the migration guide.

Please feel to reopen with any comments by 2023-06-02. We will do a final pass on reopened issues afterwards (see #4336).

This issue is most likely resolved in Helia, please try it out!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/support A question or request for support kind/wontfix-migration-available status/ready Ready to be worked topic/libp2p Topic libp2p
Projects
No open projects
Status: Done
Development

No branches or pull requests

6 participants