filecoin-project / lassie

A minimal universal retrieval client library for IPFS and Filecoin
Other
111 stars 17 forks source link

feat: attempt translate filecoin SP-like provider addresses with heyfil #441

Closed rvagg closed 1 year ago

rvagg commented 1 year ago

One for you to review @willscott.

This ends up being a complete noop if none of the provided addresses look like they can be translated. So for current usage this is entirely transparent, but as soon as someone provides an f0\d+ or just a plain peer ID, it'll try and use heyfil to fill in the blank.

I don't have a good example handy of a specific bit of content and a working SP, but this one should work for some known content that the SP claims to be storing, using both forms:

Screenshot 2023-09-29 at 10 42 53 pm Screenshot 2023-09-29 at 10 41 57 pm
codecov-commenter commented 1 year ago

Codecov Report

Merging #441 (8ad02d4) into rvagg/--provider-http-shortcuts (b33092c) will decrease coverage by 0.49%. The diff coverage is 51.51%.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/filecoin-project/lassie/pull/441/graphs/tree.svg?width=650&height=150&src=pr&token=0ELGTPSK3J&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=filecoin-project)](https://app.codecov.io/gh/filecoin-project/lassie/pull/441?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=filecoin-project) ```diff @@ Coverage Diff @@ ## rvagg/--provider-http-shortcuts #441 +/- ## =================================================================== - Coverage 76.40% 75.91% -0.49% =================================================================== Files 85 86 +1 Lines 6458 6586 +128 =================================================================== + Hits 4934 5000 +66 - Misses 1259 1305 +46 - Partials 265 281 +16 ``` | [Files](https://app.codecov.io/gh/filecoin-project/lassie/pull/441?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=filecoin-project) | Coverage Δ | | |---|---|---| | [cmd/lassie/flags.go](https://app.codecov.io/gh/filecoin-project/lassie/pull/441?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=filecoin-project#diff-Y21kL2xhc3NpZS9mbGFncy5nbw==) | `51.02% <40.00%> (-3.33%)` | :arrow_down: | | [pkg/server/http/ipfs.go](https://app.codecov.io/gh/filecoin-project/lassie/pull/441?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=filecoin-project#diff-cGtnL3NlcnZlci9odHRwL2lwZnMuZ28=) | `89.62% <62.50%> (-0.98%)` | :arrow_down: | | [cmd/lassie/fetch.go](https://app.codecov.io/gh/filecoin-project/lassie/pull/441?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=filecoin-project#diff-Y21kL2xhc3NpZS9mZXRjaC5nbw==) | `33.62% <0.00%> (-0.61%)` | :arrow_down: | | [pkg/heyfil/heyfil.go](https://app.codecov.io/gh/filecoin-project/lassie/pull/441?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=filecoin-project#diff-cGtnL2hleWZpbC9oZXlmaWwuZ28=) | `53.50% <53.50%> (ø)` | | ... and [5 files with indirect coverage changes](https://app.codecov.io/gh/filecoin-project/lassie/pull/441/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=filecoin-project)