-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
send DHT scrape requests to arbitrary info-hashes #3701
Comments
According to my experiences: DHT get_peers is not reliable because you will get a lot of fake peers. You even get peers for none existent info hashes. Unless you contact each peer you do not know if they exist. |
@MassaRoddel thank you for your response. I did some more testing and I'm able to get > 1000 peers from the DHT for popular swarms. My next preferred step would be to send PEX messages and get the actual peers in the swarm. While doing so, I got the same problem as in this SO post. Only a small percentage of the peers respond to my handshake, which might be caused by firewall/NAT issues. However, a single peer should be enough to bootstrap myself in the swarm and manual send PEX messages to others. |
There's a way to scrape a swarm over DHT. See BEP 33. I don't think libtorrent supports sending scrapes, but it responds to them |
@arvidn that's exactly what I need. It also includes information about the number of seeders and thus the health of a torrent. I will try to implement this and get back to you if I have some results. Thanks 👍 |
@arvidn I've tried a bit to send a I noticed in the documentation that there is a Do you have any other suggestions on how to send a |
I would expect a separate UDP port would work, but libtorrent opens up its port with UPnP, NAT-PMP and PCP also. |
@arvidn thanks for your response. The connectivity issue is indeed a problem when doing requests from another port. We run into the same problem in our IPv8 networking library and we use our custom decentralised NAT puncturing algorithm for this. If I understand it correctly, I should first do a |
yeah, if you actually get the nodes back in the response, that should work. I can't recall off-hand if you do though, or if you just get the peers back. |
@arvidn could you please expose the Alternatively, it might be helpful to add a |
I managed to make some progress on this issue by making two changes to libtorrent. First, I always send a
and
It would be nice if someone with more experience can give some pointers on how to write a better converter for At this point, I'm listening to I think sending DHT scrapes should be possible in libtorrent but I am not sure about the best way to do so 👍 |
sorry for the delay. That seems like a reasonable converter. I would expect you to construct a
Since the returns type is known. I would be open to patches against |
I think landing of #3810 is not sufficient to address this issue, right? There's still no way to send a DHT scrape request. |
@arvidn that’s right. The ability to send scrape requests would be very helpful for our following ongoing work: Tribler/tribler#4256 |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Would this issue include adding support for sending DHT scrapes to the C++ library as well, or would that already be possible? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
If this is the case, and I could get some guidance, I'd be willing to take a stab at this. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
sure. I think this would probably look similar to the other DHT features exposed via the session object. like dht_announce(). The result from the scrape should be returned as an alert. Callbacks across threads would be error prone and complicated. The dht_live_nodes_alert can be used as an example. |
@Ofenhed is Arvid's walkthrough on examples for the proposed solution good enough for you to get started? Or do you happen to be on vacation now? |
@markmdscott Yeah, sorry for not replying. Short story: my current life situation unfortunately doesn't enable any personal projects at the moment. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
For Tribler, we are looking for a way to fetch the overall health of a swarm, in order to share this around and essentially gossip torrent healths around. One problem here is that we need to get the number of seeders and leechers in a swarm, preferably without relying on a UDP or HTTP tracker (since we also want to get the health of magnet-only torrents).
The current approach we are using for this, is to start a download of the swarm in
upload_mode
. After we have fetched the metadata of the torrent (which is indicated by an alert), we inspect the peers we are connected to and simply take the length of this list. However, this approach is suboptimal for two reasons. First, we do not get an accurate representation of the peers in the swarm with this method. Second, it seems that we are unable to say whether a peer is a seeder or leecher (by inspection of thehave
field), potentially because the peers have not exchanged which pieces they have?For this reason, we are looking for a better approach to get the health of a torrent without using trackers. I played a bit around with the
get_dht_peers
method and that seems to work reasonably well. Doing several calls toget_dht_peers
was suggested in a post on Stack Overflow but I'm not sure how accurate this would approximate the health of a swarm. Another approach could be to get a few peers and manually sending PEX messages and 'crawl' the swarm. Would this work?Any suggestions on this are welcome!
The text was updated successfully, but these errors were encountered: