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

Bug: failing with invalid multiaddr on quic-v1 webtransport #147

Closed
SgtPooki opened this issue Mar 29, 2023 · 3 comments · Fixed by #148
Closed

Bug: failing with invalid multiaddr on quic-v1 webtransport #147

SgtPooki opened this issue Mar 29, 2023 · 3 comments · Fixed by #148

Comments

@SgtPooki
Copy link
Contributor

SgtPooki commented Mar 29, 2023

libp2p:bootstrap:error Invalid multiaddr +0ms /ip4/10.5.0.2/udp/4001/quic-v1/p2p/12D3KooWQF6Q3i1QkziJQ9mkNNcyFD8GPQz6R6oEvT75wgsVXm4v
common.js:113 libp2p:bootstrap:error Invalid multiaddr +0ms /ip4/10.5.0.2/udp/4001/quic-v1/webtransport/certhash/uEiDWmsTxXe55Mbwnvd1qrPZAcE5Jtc0tE9WtGXD_NpMERg/certhash/uEiCoik2HBeT5oc9Jib3SQJzNjn9AnznMDpQWcOeKSuEc9A/p2p/12D3KooWQF6Q3i1QkziJQ9mkNNcyFD8GPQz6R6oEvT75wgsVXm4v
common.js:113 libp2p:bootstrap:error Invalid multiaddr +2ms /ip4/127.0.0.1/udp/4001/quic-v1/p2p/12D3KooWQF6Q3i1QkziJQ9mkNNcyFD8GPQz6R6oEvT75wgsVXm4v
common.js:113 libp2p:bootstrap:error Invalid multiaddr +0ms /ip4/127.0.0.1/udp/4001/quic-v1/webtransport/certhash/uEiDWmsTxXe55Mbwnvd1qrPZAcE5Jtc0tE9WtGXD_NpMERg/certhash/uEiCoik2HBeT5oc9Jib3SQJzNjn9AnznMDpQWcOeKSuEc9A/p2p/12D3KooWQF6Q3i1QkziJQ9mkNNcyFD8GPQz6R6oEvT75wgsVXm4v
common.js:113 libp2p:bootstrap:error Invalid multiaddr +1ms /ip4/97.126.16.119/udp/4001/quic-v1/p2p/12D3KooWQF6Q3i1QkziJQ9mkNNcyFD8GPQz6R6oEvT75wgsVXm4v
common.js:113 libp2p:bootstrap:error Invalid multiaddr +0ms /ip4/97.126.16.119/udp/4001/quic-v1/webtransport/certhash/uEiDWmsTxXe55Mbwnvd1qrPZAcE5Jtc0tE9WtGXD_NpMERg/certhash/uEiCoik2HBeT5oc9Jib3SQJzNjn9AnznMDpQWcOeKSuEc9A/p2p/12D3KooWQF6Q3i1QkziJQ9mkNNcyFD8GPQz6R6oEvT75wgsVXm4v
common.js:113 libp2p:bootstrap:error Invalid multiaddr +1ms /ip6/::1/udp/4001/quic-v1/p2p/12D3KooWQF6Q3i1QkziJQ9mkNNcyFD8GPQz6R6oEvT75wgsVXm4v
common.js:113 libp2p:bootstrap:error Invalid multiaddr +0ms /ip6/::1/udp/4001/quic-v1/webtransport/certhash/uEiDWmsTxXe55Mbwnvd1qrPZAcE5Jtc0tE9WtGXD_NpMERg/certhash/uEiCoik2HBeT5oc9Jib3SQJzNjn9AnznMDpQWcOeKSuEc9A/p2p/12D3KooWQF6Q3i1QkziJQ9mkNNcyFD8GPQz6R6oEvT75wgsVXm4v

This is being called from @libp2p/bootstrap at https://github.com/libp2p/js-libp2p-bootstrap/blob/6d1b65aaa8ff770443f9df92baba6cd588d41a65/src/index.ts#L73-L76 and blocking DHT functionality when trying to talk to my own node, bootstrapping it.

I looked at the source(https://github.com/multiformats/js-mafmt/blob/master/src/index.ts) and am not sure how to add a support for a new multiaddr format

cc @achingbrain @aschmahmann @BigLep

@SgtPooki
Copy link
Contributor Author

Currently bypassing this with a very very hacky patch

diff --git a/node_modules/@libp2p/bootstrap/dist/src/index.js b/node_modules/@libp2p/bootstrap/dist/src/index.js
index 1386e3c..ca83bf0 100644
--- a/node_modules/@libp2p/bootstrap/dist/src/index.js
+++ b/node_modules/@libp2p/bootstrap/dist/src/index.js
@@ -22,8 +22,8 @@ class Bootstrap extends EventEmitter {
         this.timeout = options.timeout ?? DEFAULT_BOOTSTRAP_DISCOVERY_TIMEOUT;
         this.list = [];
         for (const candidate of options.list) {
-            if (!P2P.matches(candidate)) {
-                log.error('Invalid multiaddr');
+            if (!P2P.matches(candidate) && !candidate.toString().includes('webtransport')) {
+                log.error('Invalid multiaddr', candidate);
                 continue;
             }
             const ma = multiaddr(candidate);

@achingbrain
Copy link
Member

achingbrain commented Mar 30, 2023

am not sure how to add a support for a new multiaddr format

Have a look at how WebRTCDirect is done, it's got a very similar structure to WebTransport as it includes the certhash components.

I think you'll need to add a QUICv1 format and extend that for WebTransport in the same way _WebRTCDirect extends UDP.

@SgtPooki
Copy link
Contributor Author

Thanks for the guidance. will look into this later today

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 a pull request may close this issue.

2 participants