Skip to content
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

ipfs get over one hop not working #6407

Closed
ligi opened this issue Jun 5, 2019 · 6 comments
Closed

ipfs get over one hop not working #6407

ligi opened this issue Jun 5, 2019 · 6 comments
Labels
kind/support A question or request for support

Comments

@ligi
Copy link

ligi commented Jun 5, 2019

to reproduce this I need 3 machines - all run go-ipfs 0.4.21:

machine 1 (lets call 'server' here) has a public IP
machine 2 (lets call 'client' here) is behind a NAT

now I can connect from machine 2 to machine 1 via ipfs swarm connect and get content that is pinned on machine 1

now introducing machine 3 which is in the same network as machine 1 and connect them via ipfs swarm connect in both ways (I think there should be a way to do it one way only - see this coment: #6271 (comment)) so I can get content pinned on machine 1 by machine 3 and the other way around
But now when I try to get content pinned on 3 with machine 2 it is not working. It is directly downloading when I ipfs get the content on machine 1

@Stebalien Stebalien added the kind/support A question or request for support label Jun 5, 2019
@Stebalien
Copy link
Member

If I'm understanding this correctly, the issue is that machine 1 will not fetch content from machine 3 on behalf of machine 2. This was a planned feature in the original IPFS whitepaper but has a bunch of legal implications that need to be thought through before it's practical.

At the moment, machine 1 can make itself a public relay but then it'll relay traffic for any peer on the network.

@ligi
Copy link
Author

ligi commented Jun 5, 2019

Can't machine 1 not just establish a encrypted communication between node 2 and 3 so it does not know the content it is transporting? Was already puzzled that I manually have to connect nodes to get content from A to B - if what you say is true that makes IPFS unusable for me.

@deviousasti
Copy link

deviousasti commented Jun 19, 2019

I'm assuming there's peer exchange happening on all nodes.
But will the public peer be able to assist in traversing NAT?

I can't get 1 to talk to 2. They can both talk to the public peer though.


             +-------------------+ Public Server  +---------------+
             |                                                    |
             |                                                    |
             |                                                    |
             |                                                    |
             +                                                    |
+----------CGNAT+-------+                            +---------Single NAT---+
|            +          |                            |            |         |
|            +          |                            |            +         |
|        Machine 2      |                            |      Machine 1       |
|                       |                            |                      |
|                       |                            |                      |
+-----------------------+                            +----------------------+

At the moment, machine 1 can make itself a public relay but then it'll relay traffic for any peer on the network.

Is circuit relay operational at the moment?

@Stebalien
Copy link
Member

Stebalien commented Jul 3, 2019

@ligi

Can't machine 1 not just establish a encrypted communication between node 2 and 3 so it does not know the content it is transporting?

It can using the p2p-circuit ("relay") transport. However:

Nodes won't relay traffic by default as this can easily run up a large bandwidth bill. However, you can enable this on node 1 by setting Swarm.EnableRelayHop to true.

There's no way for node 2 to know that node 3 is connected to node 1 as well unless node 1 says so by announcing a special relay address. You can do this manually by adding a p2p-circuit address to Addresses.Announce ("/p2p/QmNode1/p2p-circuit").

You can also automatically use a public relay by enabling Swarm.EnableAutoRelay. If you do that, your node will (a) find a public relay and (b) advertise a relay address using that relay. However, node 1 won't automatically be a public relay.

You can make it a public relay by additionally setting Swarm.EnableRelayHop. However, doing so will make your node very popular and may cost quite a bit in terms of bandwidth.

@Stebalien
Copy link
Member

@deviousasti

Is circuit relay operational at the moment?

Yes (ish). Nodes will connect to other nodes through relays by default if those nodes advertise a relay. However:

  1. Nodes won't act as relays by default unless configured to do so (Swarm.EnableRelayHop).
  2. Nodes won't announce relays by default unless configured to do so (Swarm.EnableAutoRelay).

@godcong
Copy link
Contributor

godcong commented Jul 9, 2019

I'm assuming there's peer exchange happening on all nodes.
But will the public peer be able to assist in traversing NAT?

I can't get 1 to talk to 2. They can both talk to the public peer though.


             +-------------------+ Public Server  +---------------+
             |                                                    |
             |                                                    |
             |                                                    |
             |                                                    |
             +                                                    |
+----------CGNAT+-------+                            +---------Single NAT---+
|            +          |                            |            |         |
|            +          |                            |            +         |
|        Machine 2      |                            |      Machine 1       |
|                       |                            |                      |
|                       |                            |                      |
+-----------------------+                            +----------------------+

At the moment, machine 1 can make itself a public relay but then it'll relay traffic for any peer on the network.

Is circuit relay operational at the moment?
i used frp to link machine 2 with a public IP Machine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/support A question or request for support
Projects
None yet
Development

No branches or pull requests

4 participants