#wake-on-lan #packets #wol #magic #sending #mac

wakey

Wake-on-LAN library for creating and sending magic WOL packets

7 releases

0.3.0 Jan 6, 2023
0.2.2 Jun 26, 2022
0.1.2 Aug 20, 2019
0.1.1 Feb 4, 2019

#3 in #wake-on-lan

Download history 8/week @ 2023-12-15 14/week @ 2023-12-22 6/week @ 2023-12-29 32/week @ 2024-01-05 15/week @ 2024-01-12 4/week @ 2024-01-19 7/week @ 2024-01-26 40/week @ 2024-02-02 49/week @ 2024-02-09 21/week @ 2024-02-16 20/week @ 2024-02-23 25/week @ 2024-03-01 37/week @ 2024-03-08 62/week @ 2024-03-15 92/week @ 2024-03-22 148/week @ 2024-03-29

343 downloads per month

MIT license

10KB
181 lines

Wakey

Rust Crates.io docs.rs

Library for managing Wake-on-LAN packets. It supports:

  • creating magic packets,
  • broadcasting them via UDP.

Usage

From string representation of MAC address and using defaults when broadcasting:

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:

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

lib.rs:

Library for managing Wake-on-LAN packets.

Example

let wol = wakey::WolPacket::from_string("01:02:03:04:05:06", ':').unwrap();
if wol.send_magic().is_ok() {
    println!("Sent the magic packet!");
} else {
    println!("Failed to send the magic packet!");
}

Dependencies

~87KB