added README
This commit is contained in:
parent
5eb250212c
commit
d2d287f252
27
README.md
Normal file
27
README.md
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
# Wakey
|
||||||
|
Library for managing Wake-on-LAN packets. It supports:
|
||||||
|
* creating magic packets,
|
||||||
|
* broadcasting them via UDP.
|
||||||
|
|
||||||
|
# Typical usage
|
||||||
|
|
||||||
|
```rust
|
||||||
|
extern crate wakey;
|
||||||
|
let wol = wakey::WolPacket::from_string("01:02:03:04:05:06", ':');
|
||||||
|
match wol.send_magic() {
|
||||||
|
Ok(_) => println!("Sent the magic packet!"),
|
||||||
|
Err(_) => println!("Failed to send the magic packet!")
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Packets can also be constructed with raw bytes and sent from / to custom addresses:
|
||||||
|
```rust
|
||||||
|
extern crate wakey;
|
||||||
|
use std::net::SocketAddr;
|
||||||
|
|
||||||
|
let wol = wakey::WolPacket::from_bytes(&vec![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);
|
||||||
|
```
|
11
src/lib.rs
11
src/lib.rs
|
@ -1,3 +1,14 @@
|
||||||
|
//! Library for managing Wake-on-LAN packets.
|
||||||
|
//! # Example
|
||||||
|
//! ```
|
||||||
|
//! extern crate wakey;
|
||||||
|
//! let wol = wakey::WolPacket::from_string("01:02:03:04:05:06", ':');
|
||||||
|
//! match wol.send_magic() {
|
||||||
|
//! Ok(_) => println!("Sent the magic packet!"),
|
||||||
|
//! Err(_) => println!("Failed to send the magic packet!")
|
||||||
|
//! }
|
||||||
|
//! ```
|
||||||
|
|
||||||
extern crate hex;
|
extern crate hex;
|
||||||
|
|
||||||
use std::iter;
|
use std::iter;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user