anacrolix / torrent

Full-featured BitTorrent client package and utilities
Mozilla Public License 2.0
5.55k stars 625 forks source link

Implement BEP 14: LSD / local peer discovery #248

Open djkazic opened 6 years ago

djkazic commented 6 years ago

I have an implementation for the UDP multicast message sending. Would you consider a PR to merge it?

elgatito commented 6 years ago

@djkazic definitely create a PR. If the code is fine (and if not - you can change it in scope of a PR, until it gets better and ready to be merged) then why not?!

djkazic commented 6 years ago

@elgatito well, while it does work, it doesn't technically adhere very closely to the BEP. Mainly, that the advertisement rate is well above the recommended rate (1 per minute at most versus my 30 second poll time). This is due to the structure of this library in terms of how peers are added, and I'm not sure it would be acceptable for that reason.

It's kind of dirty to do a loop like this anyway. I wanted to also see if anyone had thought about working on this and could help me come up with a better overall solution.

elgatito commented 6 years ago

@djkazic you should start a PR to get a code review and, maybe, some help.

anacrolix commented 6 years ago

Yes, please post a PR.

pataquets commented 5 years ago

@djkazic: Thanks for the work! I +1 what's said above. Even if the code is not perfect as it is now, posting it already adds a lot of value. Reviews will come in for sure. And even if you don't have time to polish it yourself, others can move the issue forward, so it ends up merged. Please, post whatever you have to set the ball rolling.

anacrolix commented 5 years ago

Note that this is BEP 14 per https://github.com/anacrolix/torrent/issues/329#issuecomment-523795879.

anacrolix commented 5 years ago

Any update @djkazic ?

pataquets commented 4 years ago

@djkazic friendly ping We'd love to have the code as is now :smile: It would be a pity that it might end lost

dd4e commented 4 years ago

Hello everyone! I want help with LSD. I understood lsd proto and I can write lsd module. But, I think, I need help with integration it to torrent library.

anacrolix commented 4 years ago

@dd4e I can assist with the integration.

dd4e commented 4 years ago

@dd4e I can assist with the integration.

I want to agree on implementation. The main task of LSD is to send and receive infohash (ihash) value. BEP14

I see the implementation in the form of a package with the transfer and receipt of ihash via channels. Channels are passed as parameters when the structure is initialized. The Start and Stop methods start and stop the announcement.

I have some questions:

  1. Is there a data type to store ihash or use a string (or array)?
  2. Are there any comments on the implementation?

Update: also need a host and port to identify the peer

anacrolix commented 3 years ago

I see the implementation in the form of a package with the transfer and receipt of ihash via channels. Channels are passed as parameters when the structure is initialized. The Start and Stop methods start and stop the announcement.

I think exposing channels are an anti-pattern in Go. A synchronous method to retrieve the next announce, or a callback should be fine.

  1. Is there a data type to store ihash or use a string (or array)?

https://pkg.go.dev/github.com/anacrolix/torrent#InfoHash

Update: also need a host and port to identify the peer

Do you mean the local Client? You can use any/all of the https://pkg.go.dev/github.com/anacrolix/torrent#Client.ListenAddrs.

MetalRex101 commented 3 years ago

Guys, any chance LPD will be available for this library?

anacrolix commented 3 years ago

@MetalRex101 I'm hoping for a community contribution on this, as I won't use it myself. @dd4e @djkazic can you advise on the status of your implementation(s), if any? Thanks.

pataquets commented 3 years ago

For reference, axet/libtorrent (which happens to use this lib) already implements this. See lpd.go.

anacrolix commented 3 years ago

That implementation looks pretty reasonable, and is appropriately detached from the torrent package. It would be a candidate for being upstreamed if there's any interest.

VuzzyM commented 3 years ago

@anacrolix It's been 3 years, maybe it's time for an update?

anacrolix commented 3 years ago

@VuzzyM everything to know is visible from this issue. 3rd party contributions appear to be stalled.

pataquets commented 3 years ago

For the record, I filed an issue a month ago in @axet's repo on GitLab if anyone wants to track it. Although no obligation, obviously, neither on him nor @anacrolix (as he already stated a few comments above).

anacrolix commented 2 months ago

I can take a PR or funding to implement this. See WebRTC and BitTorrent v2 support for previous success stories on this front.