rktr1998/zig-wol
Wake-on-lan CLI written in Zig.
a39ab2595d685526a6fb13f9caba7317a2686a7d
Written in the Zig programming language, zig-wol is a CLI utility for sending wake-on-lan magic packets to wake up a computer in a LAN given its MAC address.
Wake a machine on your LAN by broadcasting the magic packet: replace <MAC>
with the target MAC address (e.g. 9A-63-A1-FF-8B-4C
).
zig-wol wake <MAC>
Create an alias for a MAC address, list all aliases or remove one.
zig-wol alias <NAME> <MAC> --address <ADDR> # create an alias and set its broadcast
zig-wol wake <NAME> # wake a machine by alias
The optional --address
(e.g. 192.168.0.255) is important if there are multiple network interfaces. Setting the correct subnet broadcast address ensures the OS chooses the right network interface. If not specified, the default broadcast 255.255.255.255 address is used.
Run zig-wol help
to display all subcommands and zig-wol <subcommand> --help
to display specific options.
Pre-compiled binaries of zig-wol are distributed with releases: download the binary for your architecture and operating system and you are good to go!
Invoke-RestMethod "https://raw.githubusercontent.com/rktr1998/zig-wol/refs/heads/main/install/install-latest-on-windows.ps1" | Invoke-Expression
This command downloads the latest release for your processor architecture and installs the program at C:\Users\%username%\.zig-wol
. To uninstall zig-wol, simply delete this folder.
bash <(curl -sSL https://raw.githubusercontent.com/rktr1998/zig-wol/refs/heads/main/install/install-latest-on-linux.sh)
This command downloads the latest release for your processor architecture and installs the program at /home/$USER/.zig-wol
. To uninstall zig-wol, simply delete this folder.
bash <(curl -sSL https://raw.githubusercontent.com/rktr1998/zig-wol/refs/heads/main/install/install-latest-on-macos.sh)
This command downloads the latest release for your processor architecture and installs the program at /home/$USER/.zig-wol
. To uninstall zig-wol, simply delete this folder.
git clone https://github.com/rktr1998/zig-wol.git
cd zig-wol
zig build
This command compiles the source code and places the executable in the zig-out/bin/
directory.
It is possible to use the wake-on-lan functionality of this project as a library.
zig fetch --save=wol git+https://github.com/rktr1998/zig-wol
Add the wol module from the fetched dependency in build.zig.
const wol_module = b.dependency("wol", .{}).module("wol");
exe.root_module.addImport("wol", wol_module); // e.g. add it to an exe
Import the module in Zig.
const wol = @import("wol");
This project is licensed under the MIT License. See the LICENSE file for details.