private @NotNull String readHostIp() throws ExecutionException {
    String wsl1LoopbackAddress = getWsl1LoopbackAddress();
    if (wsl1LoopbackAddress != null) {
      return wsl1LoopbackAddress;
    }
    if (Registry.is("wsl.obtain.windows.host.ip.alternatively", true)) {
      // Connect to any port on WSL IP. The destination endpoint is not needed to be reachable as no real connection is established.
      // This transfers the socket into "connected" state including setting the local endpoint according to the system's routing table.
      // Works on Windows and Linux.
      try (DatagramSocket datagramSocket = new DatagramSocket()) {
        // We always need eth0 ip, can't use 127.0.0.1
        InetAddress wslAddr = InetAddresses.forString(readWslIp());
        // Any port in range [1, 0xFFFF] can be used. Port=0 is forbidden: https://datatracker.ietf.org/doc/html/rfc8085
        // "A UDP receiver SHOULD NOT bind to port zero".
        // Java asserts "port != 0" since v15 (https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8240533).
        int anyPort = 1;
        datagramSocket.connect(wslAddr, anyPort);
        return datagramSocket.getLocalAddress().getHostAddress();
      }
      catch (Exception e) {
        LOG.error("Cannot obtain Windows host IP alternatively: failed to connect to WSL IP. Fallback to default way.", e);
      }
    }

    return executeAndParseOutput(IdeBundle.message("wsl.win.ip"), strings -> {
      for (String line : strings) {
        if (line.startsWith("nameserver")) {
          return line.substring("nameserver".length()).trim();
        }
      }
      return null;
    }, "cat", "/etc/resolv.conf");
  }
private @NotNull String readHostIp()