-
Notifications
You must be signed in to change notification settings - Fork 18
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
Protocols in providers #465
Conversation
instead of retriever.CandidateFinder, use types.CandidateSource, converging on single method FindCandidates
instead of using peer.AddrInfo, protocols now have providers
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #465 +/- ##
==========================================
+ Coverage 75.63% 75.79% +0.16%
==========================================
Files 87 87
Lines 6657 6656 -1
==========================================
+ Hits 5035 5045 +10
+ Misses 1341 1335 -6
+ Partials 281 276 -5
|
@@ -258,8 +259,24 @@ func ParseProviderStrings(v string) ([]peer.AddrInfo, error) { | |||
return nil, err | |||
} |
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.
would this make sense now? seems a reasonable assumption if they're specifying the address in http://
form
} | |
} | |
protocols = append(protocols, metadata.IpfsGatewayHttp{}) |
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.
I actually had this but then that means GetDescriptorString produces a +http which is a bit odd :P
@@ -200,6 +201,21 @@ func TestRequestStringRepresentations(t *testing.T) { | |||
_, err := ParseProviderStrings("http://127.0.0.1:5000/nope") | |||
require.ErrorContains(t, err, "paths not supported") | |||
}) | |||
|
|||
t.Run("fixed peer, protocol included", func(t *testing.T) { | |||
pps, err := ParseProviderStrings("/ip4/127.0.0.1/tcp/5000/p2p/12D3KooWBSTEYMLSu5FnQjshEVah9LFGEZoQt26eacCEVYfedWA4+bitswap") |
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.
some multiaddr aficionado is going to find this one day and get all twitchy
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.
some day, but not this day :P
@@ -258,8 +259,24 @@ func ParseProviderStrings(v string) ([]peer.AddrInfo, error) { | |||
return nil, err | |||
} | |||
} else { | |||
parts := strings.Split(v, "+") |
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.
It's likely possible to break multiaddr with the +
assumption, you could probably base64 encode the peer ID and end up with +
in the /p2p/
component. Not sure how much it's worth worrying about since this is pretty niche use, although this can come in through the CLI and I don't think we really have a handle on how that might be used.
So, I wonder if it shouldn't be fatal below - if we hit the default
, print a warning and fall-back to addrString = v
and protocols = []
?
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.
think I got a decent solution to this -- check the change
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, I'll let you decide how to deal with my feedback, I'm fine either way
|
fix race in DirectCandidateSource when not using libp2p
Co-authored-by: Rod Vagg <rod@vagg.org>
|
Not documented publicly (yet) but it impacts the
|
Goals
Implementation
For Discussion