Pfx.type

You're seeing just the function type, go back to Pfx module for more information.

Specs

type(prefix()) :: :ip4 | :ip6 | :eui48 | :eui64 | non_neg_integer() | :einvalid

Returns the prefix type, one of :ip4, :ip6, :eui48, eui64 or simply its maxlen property.

Examples

iex> type("1.2.3.4")
:ip4
iex> type("1.2.3.0/24")
:ip4
iex> type({1, 2, 3, 4})
:ip4
iex> type({{1, 2, 3, 4}, 24})
:ip4
iex> type(%Pfx{bits: <<1, 2, 3, 4>>, maxlen: 32})
:ip4

iex> type("acdc:1976::1")
:ip6
iex> type({1, 2, 3, 4, 5, 6, 7, 8})
:ip6
iex> type({{1, 2, 3,4 ,5 ,6, 7, 8}, 64})
:ip6
iex> type(%Pfx{bits: <<>>, maxlen: 128})
:ip6

iex> type("aa-bb-cc-dd-ee-ff")
:eui48
iex> type(%Pfx{bits: <<0xaa, 0xbb>>, maxlen: 48})
:eui48

iex> type("aa-bb-cc-ee-ff-00-00-00")
:eui64
iex> type(%Pfx{bits: <<0xaa, 0xbb, 0xcc>>, maxlen: 64})
:eui64

iex> type(%Pfx{bits: <<1, 2>>, maxlen: 256})
256