Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
LesnyRumcajs committed Jan 6, 2023
1 parent cc136da commit 3a4440c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,27 @@ Library for managing Wake-on-LAN packets. It supports:

From string representation of MAC address and using defaults when broadcasting:
```rust
let wol = wakey::WolPacket::from_string("01:02:03:04:05:06", ':');
let wol = wakey::WolPacket::from_string(&mac_adress, sep)?;
if wol.send_magic().is_ok() {
println!("Sent the magic packet!");
println!("Sent the magic packet.");
} else {
println!("Failed to send the magic packet!");
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 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);
wol.send_magic_to(src, dst)?;
```

## Included binary

```
cargo run --bin wakey-wake -m 00:11:22:33:44:55
cargo run --bin wakey-wake 00:11:22:33:44:55
```

0 comments on commit 3a4440c

Please sign in to comment.