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

Sockets for communication between peers #290

Closed
thelesbianguy opened this issue Mar 29, 2018 · 4 comments
Closed

Sockets for communication between peers #290

thelesbianguy opened this issue Mar 29, 2018 · 4 comments

Comments

@thelesbianguy
Copy link

Sockets for communication between peers

@Stebalien
Copy link
Member

You mean between external applications (using IPFS)? We actually support this, checkout the ipfs p2p command.

@Stebalien
Copy link
Member

Stebalien commented Mar 29, 2018

Fair enough: https://github.com/ipfs/go-ipfs/blob/master/docs/experimental-features.md#ipfs-p2p ("More documentation" is literally listed as a todo...).

As that documentation isn't very helpful:

On both nodes, you'll need to enable the feature (it's currently experimental):

> ipfs config --json Experimental.Libp2pStreamMounting true
> ... restart ipfs ...

On one of your IPFS nodes (NODEA)b, you'll need to register a listener. First, start your application and have it listen on YOUR_PORT. Then, run:

> ipfs p2p listener open /my/custom/protocol/name /ip4/127.0.0.1/tcp/YOUR_PORT

This will configure IPFS to listen for new streams speaking the protocol /my/custom/protocol/name and, for each new stream, proxy the stream to 127.0.0.1:YOUR_PORT.

Next, on the the other IPFS node, run

> ipfs p2p stream dial $NODEA_ID /my/custom/protocol/name /ip4/127.0.0.1/tcp/SOME_PORT

And connect your application to 127.0.0.1:SOME_PORT. The connection will be proxied through to the listener on the other node.

@Stebalien
Copy link
Member

FYI, I've improved that documentation in: ipfs/kubo#4894

@thelesbianguy
Copy link
Author

thelesbianguy commented Mar 31, 2018 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants