Translate 0.0.0.0 to localhost (#1992)

Closes #1991.
This commit is contained in:
José Valim 2023-06-20 11:20:02 +02:00 committed by GitHub
parent add3de24b7
commit bf16cd3e6a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -549,12 +549,13 @@ defmodule Livebook.Utils do
"localhost"
iex> Livebook.Utils.ip_to_host({0, 0, 0, 0})
"0.0.0.0"
"localhost"
"""
@spec ip_to_host(:inet.ip_address()) :: String.t()
def ip_to_host(ip)
def ip_to_host({0, 0, 0, 0}), do: "localhost"
def ip_to_host({127, 0, 0, 1}), do: "localhost"
def ip_to_host(ip) do