Pfx.address
You're seeing just the function
address
, go back to Pfx module for more information.
Specs
Returns the address portion of given prefix
without applying the mask (if
any).
Note that this has no real effect on a Pfx.t/0
or an ip_address/0
since
there is no mask to ignore. Since no mask is applied, this always returns a
full prefix without any bits masked off. Raises ArgumentError
if given an
invalid prefix.
Examples
iex> address("1.2.3.4/16")
"1.2.3.4"
iex> address({{1, 2, 3, 4}, 16})
{1, 2, 3, 4}
iex> address({{0xacdc, 0x1976, 0, 0, 0, 0, 0, 1}, 64})
{0xacdc, 0x1976, 0, 0, 0, 0, 0, 1}
iex> pfx = "1.2.3.4/24"
iex> new(pfx).bits
<<1, 2, 3>>
iex> new(address(pfx)).bits
<<1, 2, 3, 4>>
# no real effect
iex> address("1.2.3.4")
"1.2.3.4"
iex> address({1, 2, 3, 4})
{1, 2, 3, 4}
iex> address({0xacdc, 0x1976, 0, 0, 0, 0, 0, 1})
{0xacdc, 0x1976, 0, 0, 0, 0, 0, 1}
iex> new("1.2.3.4/16") |> address()
%Pfx{bits: <<1, 2>>, maxlen: 32}