View Source PhxConfigUtil.BindToIp (phx_config_util v0.1.0)
Parse shortcuts or string representations to IP addresses.
PhxConfigUtil.BindToIp.parse!/1
Expects a string representation of an IP address or one of the following shortcuts:
all4
- All IPv4 addresses ("0.0.0.0")all6
- All IPv6 addresses ("::")local4
- Local IPv4 address ("127.0.0.1")local6
- Local IPv6 address ("::1")tailscale4
- Tailscale IPv4 address (usestailscale ip -4
)tailscale6
- Tailscale IPv6 address (usestailscale ip -6
)
Examples
iex> PhxConfigUtil.BindToIp.parse!("all4")
{0, 0, 0, 0}
iex> PhxConfigUtil.BindToIp.parse!("local4")
{127, 0, 0, 1}
iex> PhxConfigUtil.BindToIp.parse!("all6")
{0, 0, 0, 0, 0, 0, 0, 0}
iex> PhxConfigUtil.BindToIp.parse!("local6")
{0, 0, 0, 0, 0, 0, 0, 1}
iex> PhxConfigUtil.BindToIp.parse!("172.16.0.1")
{172, 16, 0, 1}