Compare commits

...

31 Commits

Author SHA1 Message Date
Dreaded_X 9dfcc401ed Converted to async 2026-05-12 04:44:59 +02:00
dependabot[bot] a8e430cdf2 Bump styfle/cancel-workflow-action from 0.13.0 to 0.13.1 (#56) 2026-03-23 09:03:05 +01:00
dependabot[bot] b83c1a79bd Bump Swatinem/rust-cache from 2.8.2 to 2.9.1 (#55)
Bumps [Swatinem/rust-cache](https://github.com/swatinem/rust-cache) from 2.8.2 to 2.9.1.
- [Release notes](https://github.com/swatinem/rust-cache/releases)
- [Changelog](https://github.com/Swatinem/rust-cache/blob/master/CHANGELOG.md)
- [Commits](https://github.com/swatinem/rust-cache/compare/v2.8.2...v2.9.1)

---
updated-dependencies:
- dependency-name: Swatinem/rust-cache
  dependency-version: 2.9.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-16 09:43:27 +01:00
Hubert 2fa102ce19 chore: strip release binary (#54) 2026-03-15 11:47:04 +01:00
Hubert Bugaj f1ff0bafc4 chore: release v0.4.1 2026-03-02 11:41:27 +01:00
Hubert 73f6331f03 release: v0.4.0 (#53) 2026-03-02 11:37:32 +01:00
Hubert 86879ffcfe chore: bump toolchain (#52) 2026-03-02 11:33:03 +01:00
dependabot[bot] 273a0ab858 Bump actions/upload-artifact from 6 to 7 (#51)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 6 to 7.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-02 11:29:30 +01:00
dependabot[bot] ce3982c4d9 Bump styfle/cancel-workflow-action from 0.12.1 to 0.13.0 (#50)
Bumps [styfle/cancel-workflow-action](https://github.com/styfle/cancel-workflow-action) from 0.12.1 to 0.13.0.
- [Release notes](https://github.com/styfle/cancel-workflow-action/releases)
- [Commits](https://github.com/styfle/cancel-workflow-action/compare/0.12.1...0.13.0)

---
updated-dependencies:
- dependency-name: styfle/cancel-workflow-action
  dependency-version: 0.13.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-01-19 10:32:35 +01:00
dependabot[bot] 83bb0462f9 Bump actions/upload-artifact from 5 to 6 (#49)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 5 to 6.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-12-15 09:39:19 +01:00
dependabot[bot] 9270c08445 Bump Swatinem/rust-cache from 2.8.1 to 2.8.2 (#48)
Bumps [Swatinem/rust-cache](https://github.com/swatinem/rust-cache) from 2.8.1 to 2.8.2.
- [Release notes](https://github.com/swatinem/rust-cache/releases)
- [Changelog](https://github.com/Swatinem/rust-cache/blob/master/CHANGELOG.md)
- [Commits](https://github.com/swatinem/rust-cache/compare/v2.8.1...v2.8.2)

---
updated-dependencies:
- dependency-name: Swatinem/rust-cache
  dependency-version: 2.8.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-12-01 10:43:46 +01:00
dependabot[bot] 6da68306fb Bump actions/checkout from 5 to 6 (#47) 2025-11-24 10:43:47 +01:00
dependabot[bot] 3f8bbe6fed Bump actions/upload-artifact from 4 to 5 (#46)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4 to 5.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-27 10:32:27 +01:00
dependabot[bot] b2ef0f640e Bump Swatinem/rust-cache from 2.8.0 to 2.8.1 (#45)
Bumps [Swatinem/rust-cache](https://github.com/swatinem/rust-cache) from 2.8.0 to 2.8.1.
- [Release notes](https://github.com/swatinem/rust-cache/releases)
- [Changelog](https://github.com/Swatinem/rust-cache/blob/master/CHANGELOG.md)
- [Commits](https://github.com/swatinem/rust-cache/compare/v2.8.0...v2.8.1)

---
updated-dependencies:
- dependency-name: Swatinem/rust-cache
  dependency-version: 2.8.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-09-22 10:21:18 +02:00
dependabot[bot] 2b9b53525e Bump actions/checkout from 4 to 5 (#44)
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 5.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-08-18 09:27:50 +02:00
dependabot[bot] c6ed8ba411 Bump Swatinem/rust-cache from 2.7.8 to 2.8.0 (#43)
---
updated-dependencies:
- dependency-name: Swatinem/rust-cache
  dependency-version: 2.8.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-06-30 10:36:40 +02:00
dependabot[bot] 2550a944f0 Bump Swatinem/rust-cache from 2.7.7 to 2.7.8 (#42)
Bumps [Swatinem/rust-cache](https://github.com/swatinem/rust-cache) from 2.7.7 to 2.7.8.
- [Release notes](https://github.com/swatinem/rust-cache/releases)
- [Changelog](https://github.com/Swatinem/rust-cache/blob/master/CHANGELOG.md)
- [Commits](https://github.com/swatinem/rust-cache/compare/v2.7.7...v2.7.8)

---
updated-dependencies:
- dependency-name: Swatinem/rust-cache
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-24 09:38:51 +01:00
Hubert b334b5d891 feat(ci): use cargo deny instead of cargo audit (#41) 2025-02-27 17:41:45 +01:00
Hubert cca6efd831 Update README.md 2025-02-27 17:33:50 +01:00
Hubert 441ee65b84 chore: bump Rust edition to 2024 (#40) 2025-02-27 17:31:39 +01:00
dependabot[bot] 4d23124eb9 Bump Swatinem/rust-cache from 2.7.5 to 2.7.7 (#39)
Bumps [Swatinem/rust-cache](https://github.com/swatinem/rust-cache) from 2.7.5 to 2.7.7.
- [Release notes](https://github.com/swatinem/rust-cache/releases)
- [Changelog](https://github.com/Swatinem/rust-cache/blob/master/CHANGELOG.md)
- [Commits](https://github.com/swatinem/rust-cache/compare/v2.7.5...v2.7.7)

---
updated-dependencies:
- dependency-name: Swatinem/rust-cache
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-20 10:43:38 +01:00
dependabot[bot] 8f57e6f821 Bump Swatinem/rust-cache from 2.7.3 to 2.7.5 (#38)
Bumps [Swatinem/rust-cache](https://github.com/swatinem/rust-cache) from 2.7.3 to 2.7.5.
- [Release notes](https://github.com/swatinem/rust-cache/releases)
- [Changelog](https://github.com/Swatinem/rust-cache/blob/master/CHANGELOG.md)
- [Commits](https://github.com/swatinem/rust-cache/compare/v2.7.3...v2.7.5)

---
updated-dependencies:
- dependency-name: Swatinem/rust-cache
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-15 17:35:20 +02:00
Hubert a7ed2ca9a0 fix: master not main in CI codecov (#37) 2024-10-07 17:21:32 +02:00
Hubert 3c314f10af feat(ci): add code coverage (#36) 2024-10-07 17:18:13 +02:00
Hubert 7840b338f8 Random refreshers (#35)
random refreshers
2024-04-14 13:23:22 +02:00
dependabot[bot] fab61e686b Bump styfle/cancel-workflow-action from 0.12.0 to 0.12.1 (#34)
Bumps [styfle/cancel-workflow-action](https://github.com/styfle/cancel-workflow-action) from 0.12.0 to 0.12.1.
- [Release notes](https://github.com/styfle/cancel-workflow-action/releases)
- [Commits](https://github.com/styfle/cancel-workflow-action/compare/0.12.0...0.12.1)

---
updated-dependencies:
- dependency-name: styfle/cancel-workflow-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-29 09:22:23 +01:00
dependabot[bot] e19003ecb7 Bump Swatinem/rust-cache from 2.7.1 to 2.7.3 (#33)
Bumps [Swatinem/rust-cache](https://github.com/swatinem/rust-cache) from 2.7.1 to 2.7.3.
- [Release notes](https://github.com/swatinem/rust-cache/releases)
- [Changelog](https://github.com/Swatinem/rust-cache/blob/master/CHANGELOG.md)
- [Commits](https://github.com/swatinem/rust-cache/compare/v2.7.1...v2.7.3)

---
updated-dependencies:
- dependency-name: Swatinem/rust-cache
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-15 09:21:54 +01:00
dependabot[bot] c03002b250 Bump Swatinem/rust-cache from 2.7.0 to 2.7.1 (#32)
Bumps [Swatinem/rust-cache](https://github.com/swatinem/rust-cache) from 2.7.0 to 2.7.1.
- [Release notes](https://github.com/swatinem/rust-cache/releases)
- [Changelog](https://github.com/Swatinem/rust-cache/blob/master/CHANGELOG.md)
- [Commits](https://github.com/swatinem/rust-cache/compare/v2.7.0...v2.7.1)

---
updated-dependencies:
- dependency-name: Swatinem/rust-cache
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-23 08:02:40 +02:00
dependabot[bot] 3cd4320d8e Bump styfle/cancel-workflow-action from 0.11.0 to 0.12.0 (#31)
Bumps [styfle/cancel-workflow-action](https://github.com/styfle/cancel-workflow-action) from 0.11.0 to 0.12.0.
- [Release notes](https://github.com/styfle/cancel-workflow-action/releases)
- [Commits](https://github.com/styfle/cancel-workflow-action/compare/0.11.0...0.12.0)

---
updated-dependencies:
- dependency-name: styfle/cancel-workflow-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-09 09:38:47 +02:00
dependabot[bot] 069b470473 Bump actions/checkout from 3 to 4 (#30)
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-29 08:42:55 +02:00
dependabot[bot] 20bdacbbea Bump Swatinem/rust-cache from 2.5.1 to 2.7.0 (#29)
Bumps [Swatinem/rust-cache](https://github.com/swatinem/rust-cache) from 2.5.1 to 2.7.0.
- [Release notes](https://github.com/swatinem/rust-cache/releases)
- [Changelog](https://github.com/Swatinem/rust-cache/blob/master/CHANGELOG.md)
- [Commits](https://github.com/swatinem/rust-cache/compare/v2.5.1...v2.7.0)

---
updated-dependencies:
- dependency-name: Swatinem/rust-cache
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-18 12:03:27 +02:00
12 changed files with 111 additions and 45 deletions
+35
View File
@@ -0,0 +1,35 @@
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
@@ -0,0 +1,16 @@
# 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
+10 -30
View File
@@ -14,18 +14,18 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.11.0
uses: styfle/cancel-workflow-action@0.13.1
with:
access_token: ${{ github.token }}
- name: Checkout Sources
uses: actions/checkout@v3
uses: actions/checkout@v6
- name: Install Toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
- name: Rust Cache
uses: Swatinem/rust-cache@v2.5.1
uses: Swatinem/rust-cache@v2.9.1
- name: Run tests
run: cargo test --verbose
@@ -35,11 +35,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.11.0
uses: styfle/cancel-workflow-action@0.13.1
with:
access_token: ${{ github.token }}
- name: Checkout Sources
uses: actions/checkout@v3
uses: actions/checkout@v6
- name: Install Toolchain
uses: actions-rs/toolchain@v1
with:
@@ -50,52 +50,32 @@ jobs:
- name: Install RustFmt
run: rustup component add rustfmt
- name: Rust Cache
uses: Swatinem/rust-cache@v2.5.1
uses: Swatinem/rust-cache@v2.9.1
- name: Run format check
run: cargo fmt --all --check
- name: Run clippy
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:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest, macos-latest, ubuntu-24.04-arm]
rv: [stable, beta, nightly]
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.11.0
uses: styfle/cancel-workflow-action@0.13.1
with:
access_token: ${{ github.token }}
- name: Checkout Sources
uses: actions/checkout@v3
uses: actions/checkout@v6
- name: Install Toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rv }}
- name: Rust Cache
uses: Swatinem/rust-cache@v2.5.1
uses: Swatinem/rust-cache@v2.9.1
- name: Cargo Build
uses: actions-rs/cargo@v1
with:
+14
View File
@@ -5,6 +5,20 @@ 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.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
+1
View File
@@ -1,4 +1,5 @@
[workspace]
resolver = "2"
members = [
"wakey",
"wakey-wake"
+2 -1
View File
@@ -2,8 +2,9 @@
[![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)
[![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. It supports:
Library for managing [Wake-on-LAN packets](https://en.wikipedia.org/wiki/Wake-on-LAN). It supports:
* creating magic packets,
* broadcasting them via UDP.
+9
View File
@@ -0,0 +1,9 @@
[advisories]
ignore = []
[licenses]
allow = [
"Apache-2.0",
"MIT",
"Unicode-3.0"
]
+3
View File
@@ -0,0 +1,3 @@
[toolchain]
channel = "1.93.1"
components = ["clippy", "llvm-tools-preview", "rustfmt"]
+5 -2
View File
@@ -1,9 +1,9 @@
[package]
name = "wakey-wake"
version = "0.3.0"
version = "0.4.1"
authors = ["Hubert Bugaj<lesny.rumcajs@gmail.com>"]
edition = "2021"
edition = "2024"
license = "MIT"
repository = "https://github.com/LesnyRumcajs/wakey"
@@ -15,3 +15,6 @@ categories = ["network-programming"]
[dependencies]
wakey = { path = "../wakey" }
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: [:, -, /]");
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 to {mac_adress}");
} else {
println!("Failed to send the magic packet.");
}
+6 -4
View File
@@ -1,9 +1,10 @@
[package]
name = "wakey"
version = "0.3.0"
version = "0.4.1"
readme = "../README.md"
authors = ["Hubert Bugaj<lesny.rumcajs@gmail.com>"]
edition = "2021"
edition = "2024"
license = "MIT"
repository = "https://github.com/LesnyRumcajs/wakey"
@@ -13,5 +14,6 @@ keywords = ["wol", "wake-on-lan"]
categories = ["network-programming"]
[dependencies]
hex = "~0.4"
arrayvec = "0.7.2"
hex = "0.4"
arrayvec = "0.7"
tokio = { version = "1.52.3", features = ["net"] }
+9 -7
View File
@@ -10,10 +10,11 @@
//! ```
use std::error::Error;
use std::net::{SocketAddr, ToSocketAddrs, UdpSocket};
use std::net::SocketAddr;
use std::{fmt, iter};
use arrayvec::ArrayVec;
use tokio::net::{ToSocketAddrs, UdpSocket};
const MAC_SIZE: usize = 6;
const MAC_PER_MAGIC: usize = 16;
@@ -95,11 +96,12 @@ impl WolPacket {
/// let wol = wakey::WolPacket::from_bytes(&vec![0x00, 0x01, 0x02, 0x03, 0x04, 0x05]).unwrap();
/// wol.send_magic();
/// ```
pub fn send_magic(&self) -> Result<()> {
pub async fn send_magic(&self) -> Result<()> {
self.send_magic_to(
SocketAddr::from(([0, 0, 0, 0], 0)),
SocketAddr::from(([255, 255, 255, 255], 9)),
)
.await
}
/// Broadcasts the magic packet from / to specified address.
@@ -111,15 +113,16 @@ impl WolPacket {
/// let dst = SocketAddr::from(([255,255,255,255], 9));
/// wol.send_magic_to(src, dst);
/// ```
pub fn send_magic_to<A: ToSocketAddrs>(&self, src: A, dst: A) -> Result<()> {
let udp_sock = UdpSocket::bind(src)?;
pub async fn send_magic_to<A: ToSocketAddrs>(&self, src: A, dst: A) -> Result<()> {
let udp_sock = UdpSocket::bind(src).await?;
udp_sock.set_broadcast(true)?;
udp_sock.send_to(&self.packet, dst)?;
udp_sock.send_to(&self.packet, dst).await?;
Ok(())
}
/// Returns the underlying WoL packet bytes
#[must_use]
pub fn into_inner(self) -> Packet {
self.packet
}
@@ -149,8 +152,7 @@ impl WolPacket {
/// Extends the MAC address to fill the magic packet
fn extend_mac(mac: &[u8]) -> ArrayVec<u8, { MAC_SIZE * MAC_PER_MAGIC }> {
let magic = iter::repeat(mac)
.take(MAC_PER_MAGIC)
let magic = iter::repeat_n(mac, MAC_PER_MAGIC)
.flatten()
.copied()
.collect::<ArrayVec<u8, { MAC_SIZE * MAC_PER_MAGIC }>>();