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

`/dnsaddr` is handled as `/dns4` in `libp2p-websocket` and `libp2p-websocket-websys`

Open oblique opened this issue 1 year ago • 1 comments

Summary

/dnsaddr is handled as /dns4 in libp2p-websocket and libp2p-websocket-websys. This is incorrect because /dnsaddr is only for quering _dnsaddr.domain from DNS.

/dnsaddr support in WebSocket is tracked in https://github.com/libp2p/rust-libp2p/issues/5529.

libp2p-websocket: https://github.com/libp2p/rust-libp2p/blob/a2a281609a0a64b211f7917aa856924983b63200/transports/websocket/src/framed.rs#L511-L516

libp2p-websocket-websys: https://github.com/libp2p/rust-libp2p/blob/a2a281609a0a64b211f7917aa856924983b63200/transports/websocket-websys/src/lib.rs#L131-L136

Expected behavior

TransportError::MultiaddrNotSupported should be returned from dial.

Actual behavior

/dnsaddr multiaddress is dialed as if it was /dns4.

Relevant log output

No response

Possible Solution

No response

Version

0.54.1

Would you like to work on fixing this bug ?

Maybe

oblique avatar Sep 18 '24 08:09 oblique

Hey! Interesting find. I would have always assumed that using dnsaddr in this manner for websocket is fine but it does make sense that it would be meant to query the dns record itself.

dariusc93 avatar Sep 18 '24 13:09 dariusc93