https://github.com/lesnyrumcajs/wakey
Rust Wake-on-LAN library
https://github.com/lesnyrumcajs/wakey
crate rust wake-on-lan
Last synced: over 1 year ago
JSON representation
Rust Wake-on-LAN library
- Host: GitHub
- URL: https://github.com/lesnyrumcajs/wakey
- Owner: LesnyRumcajs
- License: mit
- Created: 2019-02-03T13:07:27.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2025-03-24T08:38:52.000Z (over 1 year ago)
- Last Synced: 2025-03-30T03:04:54.054Z (over 1 year ago)
- Topics: crate, rust, wake-on-lan
- Language: Rust
- Homepage:
- Size: 60.5 KB
- Stars: 39
- Watchers: 2
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# Wakey
[](https://github.com/LesnyRumcajs/wakey/actions/workflows/rust.yml)
[](https://crates.io/crates/wakey)
[](https://docs.rs/wakey)
[](https://codecov.io/github/LesnyRumcajs/wakey)
Library for managing [Wake-on-LAN packets](https://en.wikipedia.org/wiki/Wake-on-LAN). It supports:
* creating magic packets,
* broadcasting them via UDP.
# Usage
From string representation of MAC address and using defaults when broadcasting:
```rust
let wol = wakey::WolPacket::from_string(&mac_adress, sep)?;
if wol.send_magic().is_ok() {
println!("Sent the magic packet.");
} else {
println!("Failed to send the magic packet.");
}
```
Packets can also be constructed with raw bytes and sent from / to custom addresses:
```rust
use std::net::SocketAddr;
let wol = wakey::WolPacket::from_bytes(&[0x00, 0x01, 0x02, 0x03, 0x04, 0x05])?;
let src = SocketAddr::from(([0,0,0,0], 0));
let dst = SocketAddr::from(([255,255,255,255], 9));
wol.send_magic_to(src, dst)?;
```
## Included binary
```
cargo run --bin wakey-wake 00:11:22:33:44:55
```