-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Use the same port for TCP and WebSocket #2684
Comments
This has to be implemented manually in each transport (see https://grep.app/search?q=quicreuse&filter[repo][0]=libp2p/go-libp2p). |
Looking through the code in TCP transport it has an option for reuse port but I do not see it in websocket transport. Is there an easy way to add? |
Not easily, no. It's not just a matter of saying "reuse this port", you need to be able to detect that the connection is not for you and pass it off to the correct transport. |
@NihiliumOnMarz is there a specific use case you need this for? |
Related libp2p/specs#608 I'll submit a PoC. |
I'd like to have this in kubo. In particular, ipfs/kubo#10521 will allow us to automatically grant people WSS connections that are usable from browsers (see #1360) alongside other libp2p connection types (e.g. TCP+TLS/Noise + Yamux, or QUIC). Getting people to open up new ports with their docker configs, firewall rules, port forwarding, etc. is generally a pain and seems likely to hurt adoption. So if we can reuse the TCP port for WSS connections that would be pretty convenient. @Jorropo my guess is that we can probably reuse a chunk of the investigative work (and perhaps some of the code) from the magiselect proposal here (thanks for that 🙏), and get some of the work landed even if the "look at magic bytes instead of using multistream select" proposal hasn't landed. |
I am trying to listen on
/tcp/1111, /tcp/1111/ws, and /tcp/1111/tls/ws
and getting errorbind: Only one usage of each socket address (protocol/network address/port) is normally permitted."}
I thought LibP2P was capable of this?
The text was updated successfully, but these errors were encountered: