anacrolix / dht

dht is used by anacrolix/torrent, and is intended for use as a library in other projects both torrent related and otherwise
Mozilla Public License 2.0
313 stars 66 forks source link

BEP 0044 implementation. #48

Closed ajnavarro closed 3 years ago

ajnavarro commented 3 years ago

BEP 0044 implementation: Storing arbitrary data in the DHT.

It is my first PR to this repository, do not hesitate to provide all the needed feedback.

Closes #26

Signed-off-by: Antonio Navarro Perez antnavper@gmail.com

anacrolix commented 3 years ago

Sorry it's not documented clearly, but did you see https://pkg.go.dev/github.com/anacrolix/dht/v2@v2.10.5/exts/getput?

anacrolix commented 3 years ago

It looks like you've essentially included the mutable parts of BEP44, it fits over what was already there (the immutable part) quite nicely.

ajnavarro commented 3 years ago

It looks like you've essentially included the mutable parts of BEP44, it fits over what was already there (the immutable part) quite nicely.

Yes! I saw the put/get command implemented, but I thought it was a proof of concept.

I'm really interested in the mutable part of BEP44, to make possible the implementation of BEP50 or BEP46 for mutable torrents in the future.

anacrolix commented 3 years ago

Happy to merge what you have so far. Just curious about using []byte instead of interface{} for v in places, what's the idea there?

anacrolix commented 3 years ago

Oh and see my comment about where to put the store.

ajnavarro commented 3 years ago

Happy to merge what you have so far. Just curious about using []byte instead of interface{} for v in places, what's the idea there?

Yep, you are right, that change is not needed. I rolled it back. Much clearer now.

Let's put this module in exts/getput or something? It's specific to BEP 44. Happy to rename the exts/getput to ./bep44 or something in advance.

I changed store to bep44, but I cannot move ext/getput files to bep44 for cyclic dependencies error.

anacrolix commented 3 years ago

Thanks for doing that. I imagine you have some code built on top of this, and if it's okay I'll probably rearrange things a bit after merging this.

ajnavarro commented 3 years ago

Thanks for doing that. I imagine you have some code built on top of this, and if it's okay I'll probably rearrange things a bit after merging this.

Yes, no problem rearranging things!