Skip to content

Add configurable Wake-on-LAN target addresses - #1958

Open
Orkopaede wants to merge 1 commit into
moonlight-stream:masterfrom
Orkopaede:feature-wol-proxy-settings
Open

Add configurable Wake-on-LAN target addresses#1958
Orkopaede wants to merge 1 commit into
moonlight-stream:masterfrom
Orkopaede:feature-wol-proxy-settings

Conversation

@Orkopaede

Copy link
Copy Markdown

Summary

This pull request adds support for configurable Wake-on-LAN target addresses.
Users can specify one or more IPv4 or IPv6 addresses in the application settings. When waking a host, Moonlight sends the Wake-on-LAN magic packet to each configured address on UDP port 9 before continuing with the existing Wake-on-LAN behavior.

Motivation

Standard Wake-on-LAN broadcasts do not work in some network configurations because broadcast packets are typically not routed across Layer 3 boundaries.
This is particularly relevant for setups such as:
• Hosts or virtual machines located in a different subnet
• VPN connections that only provide Layer 3 connectivity
• Routed networks where broadcast traffic is unavailable
• Networks using a Wake-on-LAN relay or proxy
• Custom network configurations where the normal broadcast destination is insufficient
Allowing users to configure additional target addresses makes it possible to forward the magic packet to a suitable relay, directed broadcast address, router, or other reachable endpoint.

Changes

• Add a new Wake-on-LAN proxy settings section
• Allow multiple IPv4 and IPv6 addresses separated by commas
• Validate addresses before saving them
• Reject hostnames, port numbers, and empty entries
• Normalize and deduplicate configured addresses
• Persist the address list in the application settings
• Send the magic packet to each configured address on UDP port 9
• Preserve the existing Wake-on-LAN behavior as a fallback
• Avoid sending duplicate packets to the same endpoint
• Add logging for successful and failed Wake-on-LAN packet transmissions

Example

A user can configure addresses such as:
192.168.1.255, 10.10.0.5, 2001:db8::10
When a host is woken, Moonlight first sends the magic packet to these configured targets and then performs the existing Wake-on-LAN attempts.
Compatibility
The setting is optional. When no custom addresses are configured, Wake-on-LAN continues to behave as before.
Both IPv4 and IPv6 literal addresses are supported. Hostnames and custom ports are intentionally not supported.

Testing

• Verified that valid IPv4 addresses are accepted
• Verified that valid IPv6 addresses are accepted
• Verified that multiple comma-separated addresses are parsed correctly
• Verified that whitespace is normalized
• Verified that duplicate addresses are removed
• Verified that invalid entries are rejected
• Verified that the setting is saved and restored
• Verified that packets are sent to configured targets on UDP port 9
• Verified that the existing Wake-on-LAN behavior still runs afterward

Development assistance

Parts of this change were developed with assistance from OpenAI Codex. The generated and suggested code was reviewed and adjusted before submission.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant