Compare commits

..

1 Commits

Author SHA1 Message Date
Dreaded_X a982950203 Converted to async 2023-08-11 03:41:44 +02:00
12 changed files with 41 additions and 104 deletions
-35
View File
@@ -1,35 +0,0 @@
name: Code coverage
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: "${{ github.ref != 'refs/heads/master' }}"
"on":
workflow_dispatch:
merge_group:
pull_request:
branches:
- master
push:
branches:
- master
jobs:
codedov:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: taiki-e/install-action@cargo-llvm-cov
- run: cargo llvm-cov --all-features --lcov --output-path lcov.info
env:
RUSTC_WRAPPER:
- uses: actions/upload-artifact@v7
with:
name: lcov.info
path: lcov.info
if-no-files-found: error
- name: Upload to codecov
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: |
curl -Os https://uploader.codecov.io/latest/linux/codecov
chmod +x codecov
./codecov -f lcov.info -Z
-16
View File
@@ -1,16 +0,0 @@
# This workflow will run `cargo-deny`, checking for dependency issues related to licensing, known vulnerabilities, and more.
# The configuration file is in [deny.toml](../../deny.toml).
name: Cargo Deny
on:
push:
branches:
- master
pull_request:
merge_group:
jobs:
cargo-deny:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: EmbarkStudios/cargo-deny-action@v2
+30 -10
View File
@@ -14,18 +14,18 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Cancel Previous Runs - name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.13.1 uses: styfle/cancel-workflow-action@0.11.0
with: with:
access_token: ${{ github.token }} access_token: ${{ github.token }}
- name: Checkout Sources - name: Checkout Sources
uses: actions/checkout@v6 uses: actions/checkout@v3
- name: Install Toolchain - name: Install Toolchain
uses: actions-rs/toolchain@v1 uses: actions-rs/toolchain@v1
with: with:
toolchain: stable toolchain: stable
profile: minimal profile: minimal
- name: Rust Cache - name: Rust Cache
uses: Swatinem/rust-cache@v2.9.1 uses: Swatinem/rust-cache@v2.5.1
- name: Run tests - name: Run tests
run: cargo test --verbose run: cargo test --verbose
@@ -35,11 +35,11 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Cancel Previous Runs - name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.13.1 uses: styfle/cancel-workflow-action@0.11.0
with: with:
access_token: ${{ github.token }} access_token: ${{ github.token }}
- name: Checkout Sources - name: Checkout Sources
uses: actions/checkout@v6 uses: actions/checkout@v3
- name: Install Toolchain - name: Install Toolchain
uses: actions-rs/toolchain@v1 uses: actions-rs/toolchain@v1
with: with:
@@ -50,32 +50,52 @@ jobs:
- name: Install RustFmt - name: Install RustFmt
run: rustup component add rustfmt run: rustup component add rustfmt
- name: Rust Cache - name: Rust Cache
uses: Swatinem/rust-cache@v2.9.1 uses: Swatinem/rust-cache@v2.5.1
- name: Run format check - name: Run format check
run: cargo fmt --all --check run: cargo fmt --all --check
- name: Run clippy - name: Run clippy
run: cargo clippy --all --all-targets -- -D warnings run: cargo clippy --all --all-targets -- -D warnings
audit:
name: Audit
runs-on: ubuntu-latest
steps:
- name: Checkout Sources
uses: actions/checkout@v3
- name: Install Toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
- name: Install Audit
run: cargo install cargo-audit
- name: Rust Cache
uses: Swatinem/rust-cache@v2.5.1
- name: Run Audit
uses: actions-rs/cargo@v1
with:
command: audit
build: build:
name: Build name: Build
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
matrix: matrix:
os: [ubuntu-latest, macos-latest, ubuntu-24.04-arm] os: [ubuntu-latest, macos-latest]
rv: [stable, beta, nightly] rv: [stable, beta, nightly]
steps: steps:
- name: Cancel Previous Runs - name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.13.1 uses: styfle/cancel-workflow-action@0.11.0
with: with:
access_token: ${{ github.token }} access_token: ${{ github.token }}
- name: Checkout Sources - name: Checkout Sources
uses: actions/checkout@v6 uses: actions/checkout@v3
- name: Install Toolchain - name: Install Toolchain
uses: actions-rs/toolchain@v1 uses: actions-rs/toolchain@v1
with: with:
toolchain: ${{ matrix.rv }} toolchain: ${{ matrix.rv }}
- name: Rust Cache - name: Rust Cache
uses: Swatinem/rust-cache@v2.9.1 uses: Swatinem/rust-cache@v2.5.1
- name: Cargo Build - name: Cargo Build
uses: actions-rs/cargo@v1 uses: actions-rs/cargo@v1
with: with:
-14
View File
@@ -5,20 +5,6 @@ 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/), 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). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.4.1] - 2026-03-02
### Changed
- Added link to the README in the changelog for better visibility.
## [0.4.0] - 2026-03-02
### Changed
- Bumped Rust edition to 2024 and Rust version to 1.93.1
- `WolPacket::into_inner` now has `must_use` attribute to prevent accidentally consuming the packet without using the inner data.
## [0.3.0] - 2023-01-06 ## [0.3.0] - 2023-01-06
-1
View File
@@ -1,5 +1,4 @@
[workspace] [workspace]
resolver = "2"
members = [ members = [
"wakey", "wakey",
"wakey-wake" "wakey-wake"
+1 -2
View File
@@ -2,9 +2,8 @@
[![Rust](https://github.com/LesnyRumcajs/wakey/actions/workflows/rust.yml/badge.svg)](https://github.com/LesnyRumcajs/wakey/actions/workflows/rust.yml) [![Rust](https://github.com/LesnyRumcajs/wakey/actions/workflows/rust.yml/badge.svg)](https://github.com/LesnyRumcajs/wakey/actions/workflows/rust.yml)
[![Crates.io](https://img.shields.io/crates/v/wakey.svg)](https://crates.io/crates/wakey) [![Crates.io](https://img.shields.io/crates/v/wakey.svg)](https://crates.io/crates/wakey)
[![docs.rs](https://img.shields.io/badge/api-rustdoc-blue.svg)](https://docs.rs/wakey) [![docs.rs](https://img.shields.io/badge/api-rustdoc-blue.svg)](https://docs.rs/wakey)
[![codecov](https://codecov.io/github/LesnyRumcajs/wakey/graph/badge.svg?token=PXR2yHWzvJ)](https://codecov.io/github/LesnyRumcajs/wakey)
Library for managing [Wake-on-LAN packets](https://en.wikipedia.org/wiki/Wake-on-LAN). It supports: Library for managing Wake-on-LAN packets. It supports:
* creating magic packets, * creating magic packets,
* broadcasting them via UDP. * broadcasting them via UDP.
-9
View File
@@ -1,9 +0,0 @@
[advisories]
ignore = []
[licenses]
allow = [
"Apache-2.0",
"MIT",
"Unicode-3.0"
]
-3
View File
@@ -1,3 +0,0 @@
[toolchain]
channel = "1.93.1"
components = ["clippy", "llvm-tools-preview", "rustfmt"]
+2 -5
View File
@@ -1,9 +1,9 @@
[package] [package]
name = "wakey-wake" name = "wakey-wake"
version = "0.4.1" version = "0.3.0"
authors = ["Hubert Bugaj<lesny.rumcajs@gmail.com>"] authors = ["Hubert Bugaj<lesny.rumcajs@gmail.com>"]
edition = "2024" edition = "2021"
license = "MIT" license = "MIT"
repository = "https://github.com/LesnyRumcajs/wakey" repository = "https://github.com/LesnyRumcajs/wakey"
@@ -15,6 +15,3 @@ categories = ["network-programming"]
[dependencies] [dependencies]
wakey = { path = "../wakey" } wakey = { path = "../wakey" }
clap = { version = "4.0", features = ["derive"] } clap = { version = "4.0", features = ["derive"] }
[profile.release]
strip = true
+1 -1
View File
@@ -16,7 +16,7 @@ fn main() -> wakey::Result<()> {
.expect("Invalid MAC address format. Please use one of the separators: [:, -, /]"); .expect("Invalid MAC address format. Please use one of the separators: [:, -, /]");
let wol = wakey::WolPacket::from_string(&mac_adress, sep)?; 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 to {mac_adress}"); println!("Sent the magic packet.");
} else { } else {
println!("Failed to send the magic packet."); println!("Failed to send the magic packet.");
} }
+5 -6
View File
@@ -1,10 +1,9 @@
[package] [package]
name = "wakey" name = "wakey"
version = "0.4.1" version = "0.3.0"
readme = "../README.md"
authors = ["Hubert Bugaj<lesny.rumcajs@gmail.com>"] authors = ["Hubert Bugaj<lesny.rumcajs@gmail.com>"]
edition = "2024" edition = "2021"
license = "MIT" license = "MIT"
repository = "https://github.com/LesnyRumcajs/wakey" repository = "https://github.com/LesnyRumcajs/wakey"
@@ -14,6 +13,6 @@ keywords = ["wol", "wake-on-lan"]
categories = ["network-programming"] categories = ["network-programming"]
[dependencies] [dependencies]
hex = "0.4" hex = "~0.4"
arrayvec = "0.7" arrayvec = "0.7.2"
tokio = { version = "1.52.3", features = ["net"] } tokio = { version = "1.30.0", features = ["net"] }
+2 -2
View File
@@ -122,7 +122,6 @@ impl WolPacket {
} }
/// Returns the underlying WoL packet bytes /// Returns the underlying WoL packet bytes
#[must_use]
pub fn into_inner(self) -> Packet { pub fn into_inner(self) -> Packet {
self.packet self.packet
} }
@@ -152,7 +151,8 @@ impl WolPacket {
/// Extends the MAC address to fill the magic packet /// Extends the MAC address to fill the magic packet
fn extend_mac(mac: &[u8]) -> ArrayVec<u8, { MAC_SIZE * MAC_PER_MAGIC }> { fn extend_mac(mac: &[u8]) -> ArrayVec<u8, { MAC_SIZE * MAC_PER_MAGIC }> {
let magic = iter::repeat_n(mac, MAC_PER_MAGIC) let magic = iter::repeat(mac)
.take(MAC_PER_MAGIC)
.flatten() .flatten()
.copied() .copied()
.collect::<ArrayVec<u8, { MAC_SIZE * MAC_PER_MAGIC }>>(); .collect::<ArrayVec<u8, { MAC_SIZE * MAC_PER_MAGIC }>>();