paritytech / substrate

Substrate: The platform for blockchain innovators
Apache License 2.0
8.39k stars 2.65k forks source link

Bind to IPv6 addresses if available #5645

Open geigerzaehler opened 4 years ago

geigerzaehler commented 4 years ago

If not explicilty set a node binds only to IPv4 addresses. This results in some usability issues. For example I cannot connect to the HTTP or Websocket RPC API endpoints if I use the host localhost if that host name resolves to ::1. Similarly, if I use --unsafe-rpc-external I cannot reach the RPC API from other machines over IPv6. The same applies to the P2P connection.

I’d suggest binding to ::1 if we’re also binding to 127.0.0.1 and to bind to :: if we’re also binding to 0.0.0.0

tomaka commented 4 years ago

Re-opening, as I think this issue is about JSON-RPC.

Xanewok commented 4 years ago

The function where we specify the listening (ipv4) address:

https://github.com/paritytech/substrate/blob/026531f2f0a60cd7f56deec6eaa93cd888c80786/client/cli/src/commands/runcmd.rs#L482-L507