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

fix(transports): filter circuit addresses #2060

Merged
merged 1 commit into from
Sep 22, 2023

Conversation

achingbrain
Copy link
Member

Use exact matchers for filtering webtransport and webrtc addresses so those transports do not try to dial (for example) p2p-circuit addresses, instead leaving the more specific address to other transports.

Refs: ipfs/helia#267

Use exact matchers for filtering webtransport and webrtc addresses
so those transports do not try to dial (for example) p2p-circuit
addresses, instead leaving the more specific address to other
transports.
@achingbrain achingbrain requested a review from a team as a code owner September 19, 2023 06:50
Copy link
Member

@SgtPooki SgtPooki left a comment

Choose a reason for hiding this comment

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

Lgtm but question on test


it('transport filter filters out invalid multiaddrs', async () => {
const valid = [
multiaddr('/ip4/1.2.3.4/udp/1234/quic-v1/webtransport/certhash/uEiAUqV7kzvM1wI5DYDc1RbcekYVmXli_Qprlw3IkiEg6tQ/certhash/uEiAUqV7kzvM1wI5DYDc1RbcekYVmXli_Qprlw3IkiEg6tQ/p2p/12D3KooWGDMwwqrpcYKpKCgxuKT2NfqPqa94QnkoBBpqvCaiCzWd')
Copy link
Member

Choose a reason for hiding this comment

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

Should we add a webtransport relay address here?

Copy link
Member Author

Choose a reason for hiding this comment

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

The first entry in the invalid array is a webtransport relay address, unless I'm misunderstanding you. Maybe suggest an edit?

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
multiaddr('/ip4/1.2.3.4/udp/1234/quic-v1/webtransport/certhash/uEiAUqV7kzvM1wI5DYDc1RbcekYVmXli_Qprlw3IkiEg6tQ/certhash/uEiAUqV7kzvM1wI5DYDc1RbcekYVmXli_Qprlw3IkiEg6tQ/p2p/12D3KooWGDMwwqrpcYKpKCgxuKT2NfqPqa94QnkoBBpqvCaiCzWd')
multiaddr('/ip4/1.2.3.4/udp/1234/quic-v1/webtransport/certhash/uEiAUqV7kzvM1wI5DYDc1RbcekYVmXli_Qprlw3IkiEg6tQ/certhash/uEiAUqV7kzvM1wI5DYDc1RbcekYVmXli_Qprlw3IkiEg6tQ/p2p/12D3KooWGDMwwqrpcYKpKCgxuKT2NfqPqa94QnkoBBpqvCaiCzWd'),
multiaddr('/ip4/167.235.53.235/udp/4001/quic-v1/webtransport/certhash/uEiDCKMoprQ0dsmyQ874-yN7h5Nwd1NVMFTeW5Rgg6RXD3Q/certhash/uEiBBN1_poJQS1J7pkbR7nDsFqFjRgrN51RuBlXsgwdA4Ag/p2p/12D3KooWPKRSU7mX3JiiasLBKYsFhPgiGZNcdv5SxBZrbrU7C8Jw/p2p-circuit/p2p/12D3KooWRG7hywMqYLDWh6EhzoYn5nUMJnHytjjuEK4UvKu2b1JQ')

or into invalid addresses if that's where it belongs

Copy link
Member Author

Choose a reason for hiding this comment

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

Is this not the same sort of address as the first entry in the invalid list?

Copy link
Member

@SgtPooki SgtPooki left a comment

Choose a reason for hiding this comment

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

Im blind. My bad, lgtm

@achingbrain achingbrain changed the title fix(@libp2p/webtransport, @libp2p/webrtc): filter circuit addresses fix(transports): filter circuit addresses Sep 22, 2023
@achingbrain achingbrain merged commit 972b10a into master Sep 22, 2023
17 checks passed
@achingbrain achingbrain deleted the fix/filter-multiaddrs-properly branch September 22, 2023 16:03
maschad pushed a commit to maschad/js-libp2p that referenced this pull request Sep 27, 2023
Use exact matchers for filtering webtransport and webrtc addresses
so those transports do not try to dial (for example) p2p-circuit
addresses, instead leaving the more specific address to other
transports.
This was referenced Jan 18, 2024
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.

3 participants