How to view the IP addresses hosting a particular file?

Is there a function to see the IP addresses which are hosting a particular file?

1 Like

You can do that with the dht.findprovs API method. This is how you find peers with the content you want, so you can request the content from them.

1 Like

With dht.findprovs you can find the ID of the peers that are saying that they have the specific content. Then you can use that ID to get the addresses that the peer is listening on. One example of this:

$ ipfs dht findprovs QmUvGoyv8hBprTqjFnhD5m4HGkcxqS4FoNteKEbYmyLj9n
QmUH8QCsWBpWoNn3ZvfiTJBFQKGqH5DnNonrqs1NXcHCxg
QmWVHuN2auMKA3KrqS9ESi4o22L8ar6zm46Aojnex1rpyt
QmWdXGxTbksALKkxeRiZKsWKGSpiq4CL2VjFeBXq2uENod
QmSoLueR4xBeUbY9WZ9xGUUxunbKWcrNFTDAadQJmocnWm

$ ipfs dht findpeer QmSoLueR4xBeUbY9WZ9xGUUxunbKWcrNFTDAadQJmocnWm 
/ip4/127.0.0.1/tcp/8081/ws
/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/2604:a880:0:1010::23:d001/tcp/4001
/ip6/fcfe:eab4:e49c:940f:8b29:35a4:8ea8:b01a/tcp/4001
4 Likes