NetAddr.mac_48

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

Specs

mac_48(binary()) :: NetAddr.MAC_48.t() | {:error, :einval}

Parses mac_string, returning a NetAddr.MAC_48.t/0.

For manifest reasons, the corresponding parser may be robust to the point of returning incorrect results. Caveat emptor.

Examples

iex> NetAddr.mac_48 "01:23:45:67:89:AB"
%NetAddr.MAC_48{address: <<0x01,0x23,0x45,0x67,0x89,0xab>>, length: 48}

iex> NetAddr.mac_48 "01-23-45-67-89-AB"
%NetAddr.MAC_48{address: <<0x01,0x23,0x45,0x67,0x89,0xab>>, length: 48}

iex> NetAddr.mac_48 "0123456789aB"
%NetAddr.MAC_48{address: <<0x01,0x23,0x45,0x67,0x89,0xab>>, length: 48}

iex> NetAddr.mac_48 "01 23 45 67 89 AB"
%NetAddr.MAC_48{address: <<0x01,0x23,0x45,0x67,0x89,0xab>>, length: 48}

iex> NetAddr.mac_48 "\"0fF:33-C0.Ff   33 \""
%NetAddr.MAC_48{address: <<0x0f, 0xf, 0x33, 0xc0, 0xff, 0x33>>, length: 48}

iex> NetAddr.mac_48 "1:2:3:4:5:6"
%NetAddr.MAC_48{address: <<1,2,3,4,5,6>>, length: 48}

iex> NetAddr.mac_48 "01-23-45-67-89-ag"
%NetAddr.MAC_48{address: <<0x01,0x23,0x45,0x67,0x89,0xa>>, length: 48}

iex> NetAddr.mac_48 "123456789aB"
%NetAddr.MAC_48{address: <<0x12,0x34,0x56,0x78,0x9a,0xb>>, length: 48}

iex> NetAddr.mac_48 "blarg"
{:error, :einval}