-
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
WIP - feat: add TCP and WS filtering with /ipfs fragment #16
Closed
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
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.
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.
Without wanting to go back and forth. Is there any reason why a transport code itself wouldn't be able to make two assertions .matchIPFS and .matchUDP so that if the first one happen, it decapsulates IPFS first and then does the matchUDP?
Note, that is how all the transports have been working:
There is a separation between what is a valid addr for a spec transport (i.e TCP was here before) and there is the addrs that our libp2p- accept.
libp2p-tcp accepts TCP multiaddrs or TCP + IPFS, but that assertion should happen on the filter function and not in mafmt, which is a utility to check capabilities/presence of certain addrs.
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.
Basically because of this - https://github.com/libp2p/js-libp2p-tcp/pull/80/files, we though at the time that having mafmt handle those special circuit cases such as
/ip4/127.0.0.1/tcp/4001/ws/ipfs/QmRelay/p2p-circuit/ipfs/QmDst
would be a better approach. I'm not so sure anymore, I think the initial approach of handling the special cases might be simpler and safer.The two relevant PR that lead to this change are -
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.
Also, I think that since then, we've also scratched listening on circuit addresses and the more advanced circuit-relay features - we might not even need this anymore (for now) because we're not going to be using that kind of addressing right now. I would say we leave it alone and revisit when we actually need this feature.
Glad you asked the question tho!
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.
@diasdavid seems like I spoke too soon, we still need this as we are supporting specific relay addrs. We can go with this approach or reopen the PRs linked above (handle circuit as a special case in
.filter
). I'm not so sure of which one is better. This PR is definitely higher risk as it affects everything that uses mafmt, handling a special case in.filter
is uglier, but might be safer for the time being?Here is @vyzo response regarding Go's handling of specific circuit addrs.