Prepare release v0.3 (#19)
* cleanup the wakey binary * add changelog * update versions * update readme
This commit is contained in:
parent
23f9a53a26
commit
0868354063
19
CHANGELOG.md
Normal file
19
CHANGELOG.md
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
# Changelog
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [0.3.0] - 2023-01-06
|
||||||
|
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- this changelog :)
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- refactored the interface and internals a bit. In short, the library should no longer panic on any errors and should return a sane `Result` so it can be handled by the crate user.
|
||||||
|
- made methods `WolPacket::from_string` and `WolPacket::mac_to_byte` more flexible by making the `data` an `AsRef<str>`.
|
||||||
|
- `wakey-wake` no longer needs an `-m` or `--mac` flag. The adress is now a positional argument so just call the binary with the appropriate address.
|
12
README.md
12
README.md
|
@ -11,11 +11,11 @@ Library for managing Wake-on-LAN packets. It supports:
|
||||||
|
|
||||||
From string representation of MAC address and using defaults when broadcasting:
|
From string representation of MAC address and using defaults when broadcasting:
|
||||||
```rust
|
```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() {
|
if wol.send_magic().is_ok() {
|
||||||
println!("Sent the magic packet!");
|
println!("Sent the magic packet.");
|
||||||
} else {
|
} else {
|
||||||
println!("Failed to send the magic packet!");
|
println!("Failed to send the magic packet.");
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -23,15 +23,15 @@ Packets can also be constructed with raw bytes and sent from / to custom address
|
||||||
```rust
|
```rust
|
||||||
use std::net::SocketAddr;
|
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 src = SocketAddr::from(([0,0,0,0], 0));
|
||||||
let dst = SocketAddr::from(([255,255,255,255], 9));
|
let dst = SocketAddr::from(([255,255,255,255], 9));
|
||||||
|
|
||||||
wol.send_magic_to(src, dst);
|
wol.send_magic_to(src, dst)?;
|
||||||
```
|
```
|
||||||
|
|
||||||
## Included binary
|
## 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
|
||||||
```
|
```
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "wakey-wake"
|
name = "wakey-wake"
|
||||||
version = "0.2.2"
|
version = "0.3.0"
|
||||||
|
|
||||||
authors = ["Hubert Bugaj<lesny.rumcajs@gmail.com>"]
|
authors = ["Hubert Bugaj<lesny.rumcajs@gmail.com>"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
@ -14,4 +14,4 @@ categories = ["network-programming"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
wakey = { path = "../wakey" }
|
wakey = { path = "../wakey" }
|
||||||
clap = { version = "4.0.15", features = ["derive"] }
|
clap = { version = "4.0", features = ["derive"] }
|
||||||
|
|
|
@ -1,25 +1,24 @@
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
|
|
||||||
#[derive(Parser)]
|
#[derive(Parser)]
|
||||||
#[clap(about = "WakeOnLan a device. https://github.com/LesnyRumcajs/wakey.git", long_about = None)]
|
#[clap(author, version, about, long_about = None)]
|
||||||
struct CmdArgs {
|
struct CmdArgs {
|
||||||
/// mac address to send packet to
|
/// MAC address to send packet to. Should be in format AA:BB:CC:DD:EE:FF, AA-BB-CC-DD-EE-FF or
|
||||||
#[clap(short, long)]
|
/// AA/BB/CC/DD/EE/FF.
|
||||||
mac: Option<String>,
|
mac_address: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() -> wakey::Result<()> {
|
fn main() -> wakey::Result<()> {
|
||||||
let args = CmdArgs::parse();
|
let mac_adress = CmdArgs::parse().mac_address;
|
||||||
if let Some(m) = args.mac {
|
let sep = mac_adress
|
||||||
let sep = m.chars().find(|ch| *ch == ':' || *ch == '-').unwrap_or('/');
|
.chars()
|
||||||
let wol = wakey::WolPacket::from_string(&m, sep)?;
|
.find(|ch| *ch == ':' || *ch == '-' || *ch == '/')
|
||||||
|
.expect("Invalid MAC address format. Please use one of the separators: [:, -, /]");
|
||||||
|
let wol = wakey::WolPacket::from_string(&mac_adress, sep)?;
|
||||||
if wol.send_magic().is_ok() {
|
if wol.send_magic().is_ok() {
|
||||||
println!("sent the magic packet.");
|
println!("Sent the magic packet.");
|
||||||
} else {
|
} else {
|
||||||
println!("failed to send the magic packet.");
|
println!("Failed to send the magic packet.");
|
||||||
}
|
|
||||||
} else {
|
|
||||||
println!("give mac address to wake up");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "wakey"
|
name = "wakey"
|
||||||
version = "0.2.2"
|
version = "0.3.0"
|
||||||
|
|
||||||
authors = ["Hubert Bugaj<lesny.rumcajs@gmail.com>"]
|
authors = ["Hubert Bugaj<lesny.rumcajs@gmail.com>"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user