wakeonlan v0.1.0 WOL

A module for sending Wake-on-LAN packets.

Summary

Functions

Converts the given mac_addr into a binary. Hexadecimals can be mixed case, and valid separators are hyphen (-) and colon (:)

Creates a magic packet for the given mac_addr

Send magic packet to the given mac_addr. By default, the packet is sent to the broadcast address 255.255.255.255 (current nework) and UDP port 9 (discard)

Functions

mac_to_binary(mac_addr)

Converts the given mac_addr into a binary. Hexadecimals can be mixed case, and valid separators are hyphen (-) and colon (:).

Examples

iex> WOL.mac_to_binary("12:34:56:AB:CD:EF")
<<18, 52, 86, 171, 205, 239>>

iex> WOL.mac_to_binary("12-34-56-AB-CD-EF")
<<18, 52, 86, 171, 205, 239>>

iex> WOL.mac_to_binary("12-34-56-ab-cd-ef")
<<18, 52, 86, 171, 205, 239>>
magic_packet(mac_addr)

Creates a magic packet for the given mac_addr.

Examples

iex> magic_packet = WOL.magic_packet("12:34:56:ab:cd:ef")
iex> is_binary(magic_packet)
true
iex> byte_size(magic_packet)
102
send(mac_addr, opts \\ [])

Send magic packet to the given mac_addr. By default, the packet is sent to the broadcast address 255.255.255.255 (current nework) and UDP port 9 (discard).

Returns :ok.

Examples

iex> WOL.send("12:34:56:ab:cd:ef")
:ok

iex> WOL.send("12:34:56:ab:cd:ef", broadcast_addr: "192.168.0.255", port: 7)
:ok