Skip to main content

Crate wol

Crate wol 

Source
Expand description

Wake on LAN magic packets.

§Send magic packets

send_magic_packet provides a convenience function to send a single packet:

use std::str::FromStr;
use std::net::Ipv4Addr;
let mac_address = wol::MacAddress::from([0x12, 0x13, 0x14, 0x15, 0x16, 0x17]);
wol::send_magic_packet(mac_address, None, (Ipv4Addr::BROADCAST, 9).into()).unwrap();

For more control, create the std::net::UdpSocket yourself:

use std::str::FromStr;
use std::net::{Ipv4Addr, UdpSocket};
use wol::SendMagicPacket;
let socket = UdpSocket::bind((Ipv4Addr::UNSPECIFIED, 0)).unwrap();
let mac_address = wol::MacAddress::from([0x12, 0x13, 0x14, 0x15, 0x16, 0x17]);

socket.send_magic_packet(mac_address, None, (Ipv4Addr::BROADCAST, 9)).unwrap();

§Assemble magic packets

To send magic packets over other socket APIs, use fill_magic_packet or write_magic_packet to assmble magic packets.

§SecureON

This crate supports SecureON magic packets.

Modules§

file
Parse “wakeup files”.

Structs§

MacAddress
A MAC address as a newtype wrapper around [u8; 6].
ParseError
A parse error.
SecureOn
A SecureON token.

Enums§

ParseErrorKind
Kind of parse error.

Traits§

SendMagicPacket
A socket which supports sending a magic packet.

Functions§

fill_magic_packet
Fill a buffer with a magic packet.
fill_magic_packet_secure_on
Fill a buffer with a magic packet with a SecureON token.
send_magic_packet
Send one magic packet.
write_magic_packet
Write a magic packet to a buffer.