-
Notifications
You must be signed in to change notification settings - Fork 47
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
Implement missing protocols #110
Conversation
I would like to see that merged especially since we need ip6zone |
What's the status on this? @jxs |
Hi @umgefahren sorry I missed this notification, and I don't seem to have permissions for this repo, I can ask to, meanwhile @Zollerboy1 sorry for the delay, but can we separate this into two PR's one implementing the missing protocols and the other re-ordering them? As it is it's very hard to review. |
Hey @jxs, of course, I can do that. I'm on vacation right now, so I probably cannot work on this until next week though. |
Hey @jxs, I finally came around to do this, it should be much easier to review now. I have the code with the reordered protocols in another branch and would create a new PR when (or if) this one gets merged. Currently, the CI is failing because the new |
I don't think adding an extra feature that only pertains to a test is a good idea. Using this cfg is actually not that uncommon. I would suggest you add the lint exception: [lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(nightly)'] } It might seem like a dirty fix, but it's a widely used workaround: It's also one of the suggested solutions by rust itself (and it's more efficient then using a build.rs file). |
I made a quick PR: #112 |
Hi @Zollerboy1 can you pull the latest changes so we can make CI pass? |
It passes now. |
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.
Hi! And sorry for the delay overal LGTM, just one question
.replace('-', "+") | ||
.replace('~', "/"); |
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.
why do we need replacing these characters?
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.
The garlic protocols are very weird in that there is almost no documentation of them anywhere. But apparently, garlic64 doesn't use classic Base64 encoding, but a similar encoding where +
is replaced with -
and /
with ~
. I don't know why. But to use multibase::Base::Base64.decode
on the string, we have to have a proper Base64 encoding, so I'm just replacing these characters. You can see in the multiaddr implementations in Go (https://github.com/multiformats/go-multiaddr/blob/414c602b9282d609668bd58c90c800468816d9f4/transcoders.go#L270-L271) and Java (https://github.com/multiformats/java-multiaddr/blob/ffdc5320b4ccb5d5e490b6bce72a8da5dbe775ae/src/main/java/io/ipfs/multiaddr/Protocol.java#L231) that they're doing the same.
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.
thanks for taking the time to explain and provide examples!
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.
LGTM Thanks! 🚀
.replace('-', "+") | ||
.replace('~', "/"); |
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.
thanks for taking the time to explain and provide examples!
This PR implements all protocols listed in https://github.com/multiformats/multiaddr/blob/master/protocols.csv.
Presumably, this PR closes #97.