A Wake-on-LAN proxy service written in Go that automatically wakes up servers when requests are made to them.
The service is configured using a TOML file. Here's an example configuration:
port = ":8080" # Port to listen on
timeout = "1m" # How long to wait for server to wake up
response_header_timeout = "1m" # How long to wait for a response header, e.g. during or after slow or long-running requests/uploads
poll_interval = "5s" # How often to check health during wake-up
health_check_interval = "30s" # Background health check frequency
health_cache_duration = "10s" # How long to trust cached health status
# Optional SSL configuration Do not add these values unless you plan to use TLS/HTTPS
ssl_certificate = "/path/to/cert.pem" # Path to your SSL certificate
ssl_certificate_key = "/path/to/key.pem" # Path to your SSL private key
[[targets]]
name = "service"
hostname = "service.host.com" # The "external" hostname - what this server receives as a Host header
destination = "http://service.local" # The actual url to the server
health_endpoint = "http://service.local/ping" # url to check health
mac_address = "7c:8b:ad:da:be:51" # MAC address for WOL
broadcast_ip = "10.0.0.255" # Broadcast IP for WOL
wol_port = 9 # Port for WOL packets
# Optional: Graceful shutdown configuration (SSH or HTTP)
inactivity_threshold = "1h" # Shut down after 1 hour of inactivity
# Option A: SSH-based shutdown (use either Option A or Option B, not both)
ssh_host = "service.local:22" # SSH host:port for shutdown
ssh_user = "wol-proxy" # SSH username for shutdown
ssh_key_path = "/app/private_key" # Path to SSH private key
shutdown_command = "sudo systemctl suspend" # Command to execute for shutdown
# ^ take care - wake from suspend / shutdown can be flaky on some systems.
# if your machine doesnt wake from your chosen "sleep" mode, try another.
# Option B: HTTP-based shutdown (use either Option A or Option B, not both)
#shutdown_http_url = "http://service.local/api/shutdown" # URL to trigger shutdown (final response validated)
#shutdown_http_method = "POST" # Optional; defaults to POST
#shutdown_http_ok_status = 0 # Optional; 0=accept any 2xx (default). Set e.g. 202 to require specific code
[[targets]]
name = "service2"
hostname = "service2.host.com"
destination = "http://service2.local"
health_endpoint = "http://service2.local/ping"
mac_address = "c9:69:45:d2:1e:12"
broadcast_ip = "10.0.0.255"
wol_port = 9
docker pull ghcr.io/darksworm/go-wol-proxy:latest
# Note: network mode "host" is required for Wake-on-LAN packets to be sent correctly
docker run --network host -v /path/to/config.toml:/app/config.toml ghcr.io/darksworm/go-wol-proxy:latest
docker build -t go-wol-proxy .
# Note: network mode "host" is required for Wake-on-LAN packets to be sent correctly
docker run --network host -v /path/to/config.toml:/app/config.toml go-wol-proxy
Create a docker-compose.yml file with the following content:
version: '3'
services:
go-wol-proxy:
image: ghcr.io/darksworm/go-wol-proxy:latest
# Note: network mode "host" is required for Wake-on-LAN packets to be sent correctly
network_mode: host
restart: unless-stopped
volumes:
- ./config.toml:/app/config.toml
# Optional: SSH private key for graceful shutdown
- ./private_key:/app/private_key
Run the container with Docker Compose:
docker-compose up -d
ssh_host, ssh_user, ssh_key_path, and shutdown_command.shutdown_http_url to enable HTTP shutdown.shutdown_http_method defaults to POST if not specified.shutdown_http_ok_status to require a specific code.shutdown_http_url and shutdown_command for the same target.shutdown_http_method and/or shutdown_http_ok_status are set, shutdown_http_url must also be set.We welcome contributions! See CONTRIBUTING.md for guidelines and commit conventions.
$ claude mcp add go-wol-proxy \
-- python -m otcore.mcp_server <graph>