-
Notifications
You must be signed in to change notification settings - Fork 246
feat: add web route for sending WOL package to given mac addr #945
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
IDisposable
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than to minor validation, this looks great! Thanks for the submission. Make sure you get the CLA agreement sorted, please.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds Wake-on-LAN (WOL) magic packet functionality to the web API, enabling remote wake-up of devices via HTTP endpoint.
- Adds a new POST endpoint
/device/send-wol/:mac-addrto send WOL magic packets - Implements the
handleSendWOLMagicPackethandler to process WOL requests - Removes an extraneous blank line in the WebRTC signal handler
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Updated commit:
|
``` adds a new route /device/send-wol/:mac-addr to send the magic WOL package to the specified mac-addr. Method is POST and is protected. Useful for custom wake up scripts: example is sending HTTP request through iOS shortcut Test plan: calling the API with curl ``` $ curl -X POST http://<jetkvm-ip>/device/send-wol/xx:xx:xx:xx:xx:xx WOL sent to xx:xx:xx:xx:xx:xx ``` and observing the magic packet on my laptop/PC: ``` $ ncat -u -l 9 -k | xxd 00000000: ffff ffff ffff d050 9978 a620 d050 9978 .......P.x. .P.x 00000010: a620 d050 9978 a620 d050 9978 a620 d050 . .P.x. .P.x. .P 00000020: 9978 a620 d050 9978 a620 d050 9978 a620 .x. .P.x. .P.x. 00000030: d050 9978 a620 d050 9978 a620 d050 9978 .P.x. .P.x. .P.x 00000040: a620 d050 9978 a620 d050 9978 a620 d050 . .P.x. .P.x. .P 00000050: 9978 a620 d050 9978 a620 d050 9978 a620 .x. .P.x. .P.x. ``` calling the api with invalid mac addr returns HTTP 400 error ``` $ curl -X POST -v http://<jetkvm-ip>/device/send-wol/abcd ... * Request completely sent off < HTTP/1.1 400 Bad Request ... ... Invalid mac address provided
|
@IDisposable apologies if I am making too much notfications, still getting used to GitHub workflow. |
There's no such thing as too much information ;)
You're rocking it! |
|
I resolved the trivial golint issue (which directly changed your branch), make sure you FETCH/PULL to get current before doing more. Also, for future ease on your side, I recommend not doing edits directly against the |
Summary:
adds a new route
/device/send-wol/:mac-addrto send the magic WOL package to the specified mac-addr.Method is POST and is protected.
Internally, the url handler uses already existing function from wol.go called rpcSendWOLMagicPacket.
Useful for custom wake up scripts: example is sending HTTP request through iOS shortcut to wake up a server.
I could also add a feature to specify the name of the device set up in the WOL UI if needed.
Test plan:
calling the API with curl with valid mac addr
and observing the magic packet on my laptop/PC:
Calling the API with curl with invalid mac addr: