add functions to tell if an address contains a security protocol#160
Draft
marten-seemann wants to merge 1 commit intomasterfrom
Draft
add functions to tell if an address contains a security protocol#160marten-seemann wants to merge 1 commit intomasterfrom
marten-seemann wants to merge 1 commit intomasterfrom
Conversation
Stebalien
reviewed
Jul 26, 2021
| func ContainsSecurityProtocol(addr Multiaddr) bool { | ||
| var contains bool | ||
| ForEach(addr, func(c Component) bool { | ||
| if code := c.Protocol().Code; code == P_TLS || code == P_NOISE { |
Member
There was a problem hiding this comment.
- I would definitely put this in an extendable map.
- This is also somewhat ambiguous. For example, what about
wss? What aboutquic? This kind of check will likely fit better in the swarm itself.
Contributor
Author
There was a problem hiding this comment.
- I would definitely put this in an extendable map.
Makes sense.
- This is also somewhat ambiguous. For example, what about wss? What about quic? This kind of check will likely fit better in the swarm itself.
True, this should probably be better documented.
I'm not sure if putting it in the swarm is the right solution though. We'll need a function like this (maybe a SecurityProtocol(Multiaddr) string is even better?) in quite a lot of packages, especially as we'll have a lengthy transition period.
25e552b to
4814703
Compare
4814703 to
1582ecd
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.