Current section
Files
Jump to
Current section
Files
README.md
# WolWake-on-LAN (WoL) magic packet sender with optional SecureOn support.## InstallationAdd `:wol` to your list of dependencies in `mix.exs`:```elixirdef deps do [ {:wol, "~> 0.1.0"} ]end```## UsageSend a magic packet to the default broadcast address on UDP port 9:```elixir:ok = Wol.send("00:11:22:33:44:55")```## Options`Wol.send/2` accepts:- `:port` (default `9`)- `:broadcast_ip` (default `{255, 255, 255, 255}`)- `:secure_on` - 4- or 6-byte binary appended to the packet- `:ifaddr` - binds the *local* address used to send (`:gen_udp.open/2` `{:ip, ip}`)- `:interface` - Linux-only bind to device (`SO_BINDTODEVICE`) via `{:bind_to_device, ~c"eth0"}`Example:```elixir:ok = Wol.send("00-11-22-33-44-55", port: 7, broadcast_ip: {192, 168, 1, 255}, secure_on: <<1, 2, 3, 4>>, ifaddr: {192, 168, 1, 10}, interface: "eth0" )```## Errors`Wol.send/2` returns `{:error, reason}` for invalid inputs or UDP failures.Common reasons:- `:invalid_mac`- `:invalid_port`- `:invalid_broadcast_ip`- `:invalid_secure_on`- `:invalid_ifaddr`- `:invalid_interface`UDP errors (from `:gen_udp`) may also be returned.Docs can be found at <https://hexdocs.pm/wol>.