# wol-vbox-helper

Wake-on-LAN listener that starts configured VirtualBox VMs when a matching magic packet is received.

## Project structure

- `source/`: all files required to build the application
  - `main.go`
  - `go.mod`
  - `go.sum`
  - `config.yaml`
- `dist/`: build output
  - `virtualbox-vm-wol.exe`
  - `config.yaml`

## Requirements

- Windows
- Go (version compatible with `source/go.mod`)
- Oracle VirtualBox with `VBoxManage.exe`

## Build

Run from the project root:

```powershell
go -C .\source build -o ..\dist\virtualbox-vm-wol.exe .
Copy-Item -Force .\source\config.yaml .\dist\config.yaml
```

This generates the executable and ensures the configuration file is present in `dist/`.

## Configuration

Edit `source/config.yaml` (or `dist/config.yaml` after building):

- `listen.address`: UDP bind address (for example `0.0.0.0`)
- `listen.port`: UDP port for Wake-on-LAN packets (commonly `9`)
- `virtualbox.vboxmanage`: full path to `VBoxManage.exe`
- `vms`: list of VMs with `name` and `mac`

## Run

Run from `dist/` so the executable can load `config.yaml` from the current directory:

```powershell
Set-Location .\dist
.\virtualbox-vm-wol.exe
```

## Run As Windows Service (Servy)

You can use `Servy` to run `virtualbox-vm-wol.exe` as a Windows service.

Recommended service settings in Servy:

- Service executable: `D:\Codex\VirtualBox-VM-Wol\dist\virtualbox-vm-wol.exe`
- Working directory: `D:\Codex\VirtualBox-VM-Wol\dist`
- Startup type: `Automatic`
- Service account: an account that can access `VBoxManage.exe` and control your VirtualBox VMs

After creating the service in Servy, start it from Servy or Windows Services (`services.msc`).
