Does IPFS can download a file from the closest source file available?

From @mpgn on Sun Mar 27 2016 10:13:08 GMT+0000 (UTC)

Two people have IPFS and user1 download a file with IPFS. The other one want to download the same file and click on the same link as user1. The file retrieves from user2 will be download from user1 ?

Now imagine we can get the closest ? (maybe it’s already possible)

Every tutorial use ipfs.io to/ipfs or ipfs.ip/ipns to share link. Of course you can share a link with a direct IPv4 adresse, but i think the file will be download every time from this adress and IPFS will no look for the closest source so we came back to centralized data.
But if ipfs.io fall down, there is no more gateway, and the system is broken no ?


Copied from original issue: https://github.com/ipfs/faq/issues/102

From @Kubuxu on Sun Mar 27 2016 10:24:49 GMT+0000 (UTC)

Public gateways (ipfs.ip/ipfs/) are only temporary migration facility. For full IPFS’s potential you have to run local daemon which will act as your own private gateway. This gateway will try to download content from the closest peer available.

Using links in format: https://ipfs.io/ipns/bin.ipfs.ovh/ is temporary measure so people that don’t have IPFS running can use services. With right addon (ipfs-gateway-redirect for FF) links in this format are usable: fs:/ipns/bin.ipfs.ovh/ which is probably targeted format for browsers.

From @morningyyy on Tue Sep 06 2016 06:34:37 GMT+0000 (UTC)

What’s the “closest” mean? Min geolocation distance? Or network topology cost? Or RTT?
How can IPFS know which peer is the closest?

From @Ghoughpteighbteau on Tue Sep 06 2016 19:30:50 GMT+0000 (UTC)

actually, IPFS has a pretty good idea from the outset what peers are local, because peers announce their local addresses as well.

~ $ ipfs swarm addrs
QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu (5)
    /ip4/127.0.0.1/tcp/4001
    /ip4/128.199.219.111/tcp/4001
    /ip4/172.17.0.1/tcp/4001
    /ip6/::1/tcp/4001
    /ip6/fc4e:5427:3cd0:cc4c:4770:25bb:a682:d06c/tcp/4001
QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64 (5)
    /ip4/104.236.76.40/tcp/4001
    /ip4/127.0.0.1/tcp/4001
    /ip4/172.17.0.1/tcp/4001
    /ip6/::1/tcp/4001
    /ip6/fcd8:a4e5:3af7:557e:72e5:f9d1:a599:e329/tcp/4001
QmSoLueR4xBeUbY9WZ9xGUUxunbKWcrNFTDAadQJmocnWm (5)
    /ip4/127.0.0.1/tcp/4001
    /ip4/162.243.248.213/tcp/4001
    /ip4/172.17.0.1/tcp/4001
    /ip6/::1/tcp/4001
    /ip6/fcfe:eab4:e49c:940f:8b29:35a4:8ea8:b01a/tcp/4001
QmdkJZUWnVkEc6yfptVu4LWY8nHkEnGwsxqQ233QSGj8UP (8)
    /ip4/10.132.250.250/tcp/4001
    /ip4/10.17.0.5/tcp/4001
    /ip4/127.0.0.1/tcp/4001
    /ip4/172.17.0.1/tcp/4001
    /ip4/172.18.0.1/tcp/4001
    /ip4/45.55.151.20/tcp/4001
    /ip6/2604:a880:800:10::ea5:7001/tcp/4001
    /ip6/::1/tcp/4001

It’s a good bet that communicating with people at these addresses will be way faster than through any kind of internet infrastructure.