js-libp2p icon indicating copy to clipboard operation
js-libp2p copied to clipboard

Resolve DNS portions of WebTransport addresses before dialing

Open achingbrain opened this issue 3 months ago • 5 comments

Chrome disallows multiple cancelled WebTransport requests to the same host to prevent port scanning. Penalty counts are stored internally in a map with string keys - the keys are the IP address being dialled.

If a multiaddr has a domain name, it must be resolved before it can be dialled, otherwise the IP address used in Chrome's map is an empty string.

If the dial is cancelled before the DNS name is resolved, the penalty is applied to the empty string key. This means dials to all multiaddrs with a DNS component are penalised if one dial to a multiaddr with a DNS component is cancelled before the DNS name is resolved.

If libp2p is running in Chrome, and it is dialing a WebTransport address, we should use the internal DNS component to resolve the DNS name to an IP address before dialling, this way if the dial is aborted by the user or times out, all DNS-based WebTransport multiaddrs will not be penalised.

achingbrain avatar Sep 15 '25 13:09 achingbrain

@achingbrain can i work on this issue?

Patrick-Ehimen avatar Sep 16 '25 16:09 Patrick-Ehimen

Yes, please open a PR with tests.

achingbrain avatar Sep 16 '25 18:09 achingbrain

Yes, please open a PR with tests.

Ok I will get on it ASAP

Patrick-Ehimen avatar Sep 18 '25 09:09 Patrick-Ehimen

@achingbrain can i work on this issue?

siddharthbaleja7 avatar Nov 13 '25 17:11 siddharthbaleja7

@achingbrain can you please review the pr i have raised for this issue? Let me know if any changes needed.

aannaannyaaa avatar Nov 22 '25 13:11 aannaannyaaa