{"id":26040246,"url":"https://github.com/rktr1998/zig-wol","last_synced_at":"2026-06-05T11:31:42.397Z","repository":{"id":279502106,"uuid":"939022195","full_name":"rktr1998/zig-wol","owner":"rktr1998","description":"A simple wake-on-lan tool written in Zig","archived":false,"fork":false,"pushed_at":"2025-03-05T17:54:47.000Z","size":15,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-05T18:45:22.575Z","etag":null,"topics":["command-line","wake-on-lan","ziglang"],"latest_commit_sha":null,"homepage":"","language":"Zig","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rktr1998.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-25T21:39:06.000Z","updated_at":"2025-03-02T15:49:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"cc67543c-9bea-4877-b3ee-e8bfecb3492e","html_url":"https://github.com/rktr1998/zig-wol","commit_stats":null,"previous_names":["rktr1998/zig-wol"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rktr1998%2Fzig-wol","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rktr1998%2Fzig-wol/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rktr1998%2Fzig-wol/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rktr1998%2Fzig-wol/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rktr1998","download_url":"https://codeload.github.com/rktr1998/zig-wol/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242386700,"owners_count":20119573,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["command-line","wake-on-lan","ziglang"],"created_at":"2025-03-07T12:08:50.097Z","updated_at":"2026-06-05T11:31:42.390Z","avatar_url":"https://github.com/rktr1998.png","language":"Zig","funding_links":[],"categories":["Zig","Network \u0026 Web"],"sub_categories":["Network"],"readme":"![GitHub License](https://img.shields.io/github/license/rito1998/zwol)\n\n# zwol\n\nA CLI utility for sending wake-on-lan magic packets to wake up a computer in a LAN given its MAC address. Find [zwol](https://github.com/rito1998/zwol) also on [codeberg](https://codeberg.org/rito/zwol).\n\n## Features\n\n- Broadcast magic packets to wake up devices on the local network.\n- Cross-platform support for Windows, macOS and Linux for both x86_64 and aarch64 architectures.\n\n## Installation\n\nPre-compiled binaries of [zwol](https://github.com/rito1998/zwol) are distributed with [releases](https://github.com/rito1998/zwol/releases). The installation scripts below download the latest release for your processor architecture and **install** the program at `C:\\Users\\%username%\\.zwol` on Windows and `/home/$USER/.zwol` on Linux and macOS. To **uninstall** zwol, simply delete this folder.\n\n### Windows\n\n```pwsh\nirm \"https://raw.githubusercontent.com/rito1998/zwol/refs/heads/main/install/install-latest-on-windows.ps1\" | iex\n```\n\n### Linux\n\n```sh\nbash \u003c(curl -sSL https://raw.githubusercontent.com/rito1998/zwol/refs/heads/main/install/install-latest-on-linux.sh)\n```\n\n### macOS\n\n```sh\nbash \u003c(curl -sSL https://raw.githubusercontent.com/rito1998/zwol/refs/heads/main/install/install-latest-on-macos.sh)\n```\n\n## Usage\n\nWake a machine on the LAN by broadcasting a magic packet: replace `\u003cMAC\u003e` with the target MAC (e.g. `9A-63-A1-FF-8B-4C`).\n\n```sh\nzwol wake \u003cMAC\u003e\n```\n\nCreate an alias for a MAC address, list all aliases, or remove one.\n\n```sh\nzwol alias \u003cNAME\u003e \u003cMAC\u003e --broadcast \u003cADDR:PORT\u003e   # create an alias and set its broadcast\nzwol wake \u003cNAME\u003e                             # wake a machine by alias\n```\n\nThe optional `--broadcast` (e.g. 192.168.0.255:9) 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, 255.255.255.255:9 is used.\n\nUse `zwol ping` to ping all machines by their FQDNs (if defined on alias creation) and display the result.\n\n```sh\n🟢  office-server\n🔴  workstation-A\n🟢  video-server\n🟢  workstation-B\n🔴  coffee-machine\n```\n\nRun `zwol help` to display all subcommands and `zwol \u003csubcommand\u003e --help` to display specific options.\n\n## Build\n\n### Prerequisites\n\n- [Zig](https://ziglang.org/download/)\n\n### 1. Clone the Repository\n\n```sh\ngit clone https://github.com/rito1998/zwol.git\ncd zwol\n```\n\n### 2. Build the Application\n\n```sh\nzig build\n```\n\nThis command compiles the source code and places the executable in the `zig-out/bin/` directory.\n\n## As a library\n\nIt is possible to use the wake-on-lan functionality of this project as a library.\n\n```sh\nzig fetch --save git+https://github.com/rito1998/zwol\n```\n\nAdd the wol module from the fetched dependency in `build.zig`.\n\n```zig\nconst wol_module = b.dependency(\"zwol\", .{}).module(\"wol\");\nexe.root_module.addImport(\"wol\", wol_module); // e.g. add it to an exe root module\n```\n\nImport the module in `main.zig` and broadcast a magic packet.\n\n```zig\nconst std = @import(\"std\");\nconst wol = @import(\"wol\");\n\npub fn main(init: std.process.Init) !void {\n    try wol.broadcastMagicPacket(init.io, \"11-22-33-44-55-66\", \"255.255.255.255:9\", 1);\n}\n```\n\n## Remote wake-on-lan\n\nUse the subcommand **relay** to make zwol work as a beacon that listens on a port for inbound wake-on-lan magic packets, for example coming from a router, and relays them, usually to the LAN broadcast in order to wake devices.\n\n```sh\nzwol relay 192.168.0.10:9999 192.168.0.255:9\n```\n\nA realistic example usage, using the command above as a reference, is to have a home LAN comprised of one or more powerful machines that need to be woken remotely and an always-on low-power machine, like a Raspberry Pi, that runs the `zwol relay` repeater.\nEnable port-forwarding in the router settings to forward inbound traffic from some specific port of choice to 9999/udp of the Raspberry Pi, then zwol relay service relays the magic packets on the local subnet broadcast allowing to wake the other machines from outside the LAN, provided the router public address is known.\n\n![relay-diagram](docs/assets/relay-diagram.png)\n\n### As a service on Linux\n\nEnsure you have zwol and set net permissions to the binary.\n\n```sh\nsudo chmod +x /home/USERNAME/.zwol/zwol\nsudo setcap 'cap_net_bind_service=+ep' /home/USERNAME/.zwol/zwol\n```\n\nFirewall rules (based on the example above).\n\n```sh\nsudo ufw allow in proto udp to any port 9999\nsudo ufw allow out proto udp to any port 9\nsudo ufw reload\n```\n\nCreate the service file, set the USERNAME and addresses accordingly.\n\n```sh\nsudo tee /etc/systemd/system/zwol.service \u003e /dev/null \u003c\u003cEOF\n[Unit]\nDescription=zwol\nAfter=network-online.target\nWants=network-online.target\nStartLimitBurst=5\nStartLimitIntervalSec=60s\n\n[Service]\nType=simple\nUser=USERNAME\nAmbientCapabilities=CAP_NET_BIND_SERVICE\nCapabilityBoundingSet=CAP_NET_BIND_SERVICE\nWorkingDirectory=/home/USERNAME/.zwol\nExecStartPre=/bin/sleep 5\nExecStart=/home/USERNAME/.zwol/zwol relay 192.168.0.10:9999 192.168.0.255:9\nRestart=on-failure\nRestartSec=10s\n\n[Install]\nWantedBy=multi-user.target\nEOF\n\n```\n\nReload, enable and start the service.\n\n```sh\nsudo systemctl daemon-reload\nsudo systemctl enable zwol.service\nsudo systemctl start zwol.service\n```\n\nMonitor the service.\n\n```sh\nsudo systemctl status zwol.service\nsudo journalctl -u zwol.service -f\n```\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n## Star History\n\n\u003ca href=\"https://www.star-history.com/?repos=rito1998%2Fzwol\u0026type=date\u0026legend=top-left\"\u003e\n \u003cpicture\u003e\n   \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://api.star-history.com/image?repos=rito1998/zwol\u0026type=date\u0026theme=dark\u0026legend=top-left\" /\u003e\n   \u003csource media=\"(prefers-color-scheme: light)\" srcset=\"https://api.star-history.com/image?repos=rito1998/zwol\u0026type=date\u0026legend=top-left\" /\u003e\n   \u003cimg alt=\"Star History Chart\" src=\"https://api.star-history.com/image?repos=rito1998/zwol\u0026type=date\u0026legend=top-left\" /\u003e\n \u003c/picture\u003e\n\u003c/a\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frktr1998%2Fzig-wol","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frktr1998%2Fzig-wol","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frktr1998%2Fzig-wol/lists"}