-
Notifications
You must be signed in to change notification settings - Fork 41
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
feat: replace peer ID recognition with tdyne-peer-id-registry #477
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #477 +/- ##
===========================================
+ Coverage 84.52% 85.27% +0.75%
===========================================
Files 100 100
Lines 7119 7050 -69
===========================================
- Hits 6017 6012 -5
+ Misses 1102 1038 -64
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Hi @si14 thank you very much!
Why is not a valid Peer ID?
I do not think it would interfere, but I would keep it as it is to avoid incompatibility issues. I would prefer to add new methods like:
That could be a new PR.
For the By the way, I found this in JavaScript: https://github.com/webtorrent/bittorrent-peerid. |
One more thing @si14 could you sign the commit? We have some rules for branches and we want all commits to be signed. If you are busy I can rebase the PR and sign it, but I think it's a good practice for you to sign all commits. We like promoting it: https://secure-git.guide/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pending to sign commit to merge.
Strictly speaking any 20-byte array is a valid peer ID, but per BEP 20:
It's often called "azureus style" and that's what qBit does.
Got you. I guess it depends on where you want to expose them. I'm also considering opening a non-allocating API with a more structured version (I only allocate when turning things into strings), the current API just has the least chance of needing to have backwards incompatible changes. I'll probably open it after I start passing Transmission test suite. Using that would help avoiding unnecessary version parsing.
I was primarily thinking of adding Fair enough re: extracting generic code first, as things stand we basically have parallel implementations and it's great as it makes easier to see what can be refactored out.
Yes! That's what I was using as my primary inspiration for the parsing logic, which they in turn inherited from older Java code. I had to fix a bunch of problems there (for example, they don't handle Transmission versions correctly) and add a few new clients (like BiglyBT and its Android version), so Thank you for the heads up re: signing! Will figure it out later today and amend the PR. |
OK, I did not know about it. Maybe I should read all BEPs. I think that's the reason why it makes sense to extract packages. Even the most simple domain has its own complexity when you dive into it.
Cool! I did not know either about "the orphan rules". I'm a newbie with Rust. I think in this case, I would implement all of them, since I guess there are not many more cases and the package is very specific for Peer Id, so I do not see a problem that the package can exceed its responsibility. Maybe I would even make sense to have new types for the other representations: HexPeerId, Base62PeerId, etc. It they need to have associated logic. But I do not see it for the time being. I think it would be enough with some named constructors.
I think that's the best way to abstract away the logic, from two concrete cases.
Thank you!! |
Just force-pushed a signed commit!
Haha yes I spent waaaayyy longer on this than I expected initially |
@josecelano seems that CI/coverage didn't pick up the force push, is there anything I can do to help you guys move this forward? |
ACK cb914da |
Hi @si14 ; Yes, I've just run the workflow again, and I could merge it. Thanks! These days I'm a little bit sick, so it might take me longer to reply. |
See also: #475
I made this PR as small as possible. I had to change the test, as
-qB00000000000000000
is not a valid qBittorent peer ID (it has to have another dash), so I amended it.Do you want me to append the detected version to the string
.get_client_name()
returns? It can becomeqBittorrent 2.3.4
instead, which is on the one hand more convenient for people, but on the other might interfere with grouping somewhere.If you're open to it, I'll experiment with extracting more logic from
Id
intotdyne-peer-id
(and maybeInfoHash
, see #360, although it's trickier to design because of v2) to make it possible to share types directly and make a separate PR.