Skip to content
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

add functions to tell if an address contains a security protocol #160

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

marten-seemann
Copy link
Contributor

No description provided.

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 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • I would definitely put this in an extendable map.
  • 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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants