16 Commits
48 changed files with 769 additions and 134 deletions

No files matched your search

+6 -2
View File
@@ -1,8 +1,8 @@
[target.armv7-unknown-linux-musleabihf]
linker = "rust-lld"
[target.aarch64-unknown-linux-gnu]
linker = "aarch64-linux-gnu-gcc"
# [target.aarch64-unknown-linux-gnu]
# linker = "aarch64-linux-gnu-gcc"
[build]
# target = "armv7-unknown-linux-musleabihf"
@@ -20,3 +20,7 @@ tw = "t --target=x86_64-pc-windows-msvc"
ldabr = "b -r --target=armv7-unknown-linux-musleabihf"
t = "test -- --nocapture --test-threads=1"
tdebug = "test -- --nocapture --test-threads=1 --show-output"
[registries.gitea]
index = "sparse+https://git.ldlda.com/api/packages/lda/cargo/" # Sparse index
+24 -5
View File
@@ -7,6 +7,10 @@ on:
- "v*"
workflow_dispatch:
env:
# When using cargo-zigbuild for *-gnu targets, link against this glibc baseline (wider VPS compatibility).
WAKEY_CC_GLIBC_VERSION: "2.28"
jobs:
build:
# My Machine has arm-musl stuff - or else i have to use cross :(
@@ -43,17 +47,32 @@ jobs:
run: |
set -euo pipefail
cd ui
# corepack enable # no no no
pnpm install --frozen-lockfile
pnpm build
- name: Build control-plane (linux gnu)
- name: Build control-plane (linux-gnu; zig + older glibc when available)
shell: bash
run: |
set -euo pipefail
for target in x86_64-unknown-linux-gnu aarch64-unknown-linux-gnu; do
cargo build --release --target "$target" -p wakey-control-plane
done
GLIBC_VER="${WAKEY_CC_GLIBC_VERSION:-2.28}"
GNU_TARGETS=(x86_64-unknown-linux-gnu aarch64-unknown-linux-gnu)
use_zig=false
if command -v zig >/dev/null 2>&1 && cargo zigbuild -h >/dev/null 2>&1; then
use_zig=true
fi
if [ "$use_zig" = true ]; then
echo "cargo-zigbuild + zig found: building control-plane with glibc ${GLIBC_VER}"
for base in "${GNU_TARGETS[@]}"; do
cargo zigbuild --release --target "${base}.${GLIBC_VER}" -p wakey-control-plane
done
else
echo "zig or cargo zigbuild not available: using plain cargo build (binary needs glibc >= host)"
for base in "${GNU_TARGETS[@]}"; do
cargo build --release --target "$base" -p wakey-control-plane
done
fi
- name: Package rootfs tarball
shell: pwsh
File renamed without changes.
File renamed without changes.
+1
View File
@@ -2,3 +2,4 @@ We work towards clean, modular, maintainable design, clear documentation... im n
DRY: spawn subagents.
Context: break those files out.
Test: make functions easy to test.
+57
View File
@@ -0,0 +1,57 @@
name: CI
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
jobs:
rust:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: cargo fmt
run: cargo fmt --all -- --check
- name: cargo clippy
run: cargo clippy --workspace --all-targets --all-features -- -D warnings
- name: cargo test
run: cargo test --workspace --all-features
# Operator UI (`ui/`): same checks you’d run locally before a control-plane bundle.
ui:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ui
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 10
- uses: actions/setup-node@v4
with:
node-version: "22"
cache: pnpm
cache-dependency-path: ui/pnpm-lock.yaml
- name: pnpm install
run: pnpm install --frozen-lockfile
- name: TypeScript (no emit)
run: pnpm run typecheck
- name: Prettier
run: pnpm run format:check
- name: Vite production build
run: pnpm run build
+104
View File
@@ -0,0 +1,104 @@
name: release
run-name: Release ${{ github.ref_name }}
on:
push:
tags:
- "v*"
workflow_dispatch:
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-unknown-linux-gnu,aarch64-unknown-linux-gnu
- uses: pnpm/action-setup@v4
with:
version: 10
- uses: actions/setup-node@v4
with:
node-version: "22"
cache: pnpm
cache-dependency-path: ui/pnpm-lock.yaml
- name: Install cross
run: cargo install cross --locked
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: linux-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build (armv7-musl with cross)
run: |
cross build --release --target armv7-unknown-linux-musleabihf -p wakey -p wakey-agent
- name: Build UI dist
shell: bash
run: |
set -euo pipefail
cd ui
pnpm install --frozen-lockfile
pnpm build
- name: Build control-plane (linux-gnu)
shell: bash
run: |
set -euo pipefail
# x86_64 builds natively; aarch64 needs cross
echo "Building control-plane x86_64-unknown-linux-gnu (native)"
cargo build --release --target x86_64-unknown-linux-gnu -p wakey-control-plane
echo "Building control-plane aarch64-unknown-linux-gnu (cross)"
cross build --release --target aarch64-unknown-linux-gnu -p wakey-control-plane
- name: Package rootfs tarball
shell: pwsh
run: |
./scripts/package_rootfs.ps1 -Version "${{ github.ref_name }}" -Target armv7-unknown-linux-musleabihf
- name: Package control-plane bundles
shell: bash
run: |
set -euo pipefail
chmod +x scripts/update_wakey_cc.sh scripts/package_wakey_cc_bundle.sh
for target in x86_64-unknown-linux-gnu aarch64-unknown-linux-gnu; do
./scripts/package_wakey_cc_bundle.sh --version "${{ github.ref_name }}" --target "$target"
done
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: wakey-rootfs
path: dist/wakey-rootfs-*armv7-unknown-linux-musleabihf.tgz
- name: Upload control-plane bundles
uses: actions/upload-artifact@v4
with:
name: wakey-cc-bundles
path: dist/wakey-cc-*unknown-linux-gnu.tgz
- name: Publish Release to GitHub
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: ${{ github.ref_name }}
files: |
dist/wakey-rootfs-*armv7-unknown-linux-musleabihf.tgz
dist/wakey-cc-*unknown-linux-gnu.tgz
Generated
+6 -6
View File
@@ -1262,7 +1262,7 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
[[package]]
name = "lda-ipjs"
version = "0.0.3"
version = "0.0.4"
dependencies = [
"anyhow",
"futures",
@@ -3034,7 +3034,7 @@ checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
[[package]]
name = "wakey"
version = "0.2.0"
version = "0.2.1"
dependencies = [
"anyhow",
"chrono",
@@ -3055,7 +3055,7 @@ dependencies = [
[[package]]
name = "wakey-agent"
version = "0.0.1"
version = "0.1.0"
dependencies = [
"anyhow",
"clap",
@@ -3079,7 +3079,7 @@ dependencies = [
[[package]]
name = "wakey-control-plane"
version = "0.1.0"
version = "0.1.1"
dependencies = [
"anyhow",
"axum",
@@ -3106,7 +3106,7 @@ dependencies = [
[[package]]
name = "wakey-core"
version = "0.2.0"
version = "0.2.1"
dependencies = [
"macaddr",
"serde",
@@ -3117,7 +3117,7 @@ dependencies = [
[[package]]
name = "wakey-linux"
version = "0.2.0"
version = "0.2.1"
dependencies = [
"anyhow",
"futures",
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "wakey"
version = "0.2.0"
version = "0.2.1"
edition = "2024"
publish = ["gitea"]
+22 -9
View File
@@ -23,13 +23,20 @@ service-first project with:
In practice that means commands like:
```sh
wakey status bedroom-pc
wakey inventory bedroom-pc
wakey leases --include-state
wakey devs
wakey wake bedroom-pc
wakey wake --mac aa:bb:cc:dd:ee:ff
```
(`inventory` is the canonical subcommand; `status` is a visible alias for the same behavior.)
## Architecture at a glance
- **On-router (local):** run `wakey` for `inventory`, `leases`, `devs`, and `wake` against live Linux neighbor/DHCP/interface data.
- **Fleet (remote):** `wakey-agent` on each router enrolls with `wakey-control-plane`, keeps an authenticated WebSocket, and executes relayed commands using the same service logic as the local CLI.
## Workspace layout
- `wakey-core`
@@ -54,7 +61,7 @@ Inside the `wakey` crate:
- `src/service`
- the real use-case layer
- status, leases, inventory, interfaces, wake, and query resolution
- inventory, leases, interfaces, wake, and query resolution
The long-term direction is:
@@ -214,7 +221,7 @@ agent enrollment and websocket endpoints reachable.
An example Caddy config is provided at:
- `deploy/Caddyfile.control-plane.example`
- `deploy/control-plane.Caddyfile`
Expected exposure model:
@@ -285,22 +292,24 @@ The update tarball is expected to contain:
`wakey` is usable as a local/operator CLI.
### Status
### Inventory
Show device status rows using a free-form selector:
Show merged device inventory rows using a free-form selector:
```sh
wakey status bedroom-pc
wakey inventory bedroom-pc
```
Or use explicit filters:
```sh
wakey status --dev br-lan --nud reachable
wakey status --mac aa:bb:cc:dd:ee:ff
wakey status --json
wakey inventory --dev br-lan --nud reachable
wakey inventory --mac aa:bb:cc:dd:ee:ff
wakey inventory --json
```
The `status` subcommand is an alias for `inventory` (same flags and output).
### Leases
Show DHCP leases:
@@ -359,6 +368,10 @@ cargo test --no-run
cargo clippy --all-targets --all-features -- -D warnings
```
On GitHub Actions (`.github/workflows/ci.yml`), the same Rust checks run on
`ubuntu-latest`, plus a separate **`ui`** job: `pnpm install --frozen-lockfile`
in `ui/`, then `typecheck`, `format:check`, and `vite build`.
Focused control-plane state tests:
```sh
@@ -6,13 +6,13 @@
#
# Replace cp.example.com with your public control-plane domain.
cp.example.com {
wakey.ldlda.com {
encode zstd gzip
# Public agent-facing endpoints.
@public path /healthz /api/v1/agents/enroll /api/v1/agent/ws
handle @public {
reverse_proxy 127.0.0.1:8787
reverse_proxy 127.0.0.1:6767
}
# Admin surface requires Cloudflare Access headers.
@@ -21,7 +21,7 @@ cp.example.com {
handle @admin {
handle @cf_access {
reverse_proxy 127.0.0.1:8787
reverse_proxy 127.0.0.1:6767
}
respond "forbidden" 403
}
+2 -2
View File
@@ -5,8 +5,8 @@ Wants=network-online.target
[Service]
Type=simple
User=wakey
Group=wakey
User=lda
Group=lda
WorkingDirectory=/opt/wakey
ExecStart=/opt/wakey/bin/wakey-control-plane serve --config-file /etc/wakey-control-plane/config.toml
Restart=on-failure
+1 -1
View File
@@ -1,7 +1,7 @@
[package]
name = "lda-ipjs"
description = "ip -j show schemas"
version = "0.0.3"
version = "0.0.4"
edition = "2024"
publish = ["gitea"]
+4 -4
View File
@@ -65,10 +65,10 @@ pub async fn get_with_handle(
for attr in msg.attributes {
match attr {
AddressAttribute::Address(addr) | AddressAttribute::Local(addr) => {
if local.is_none() {
local = addr.to_string().parse().ok();
}
AddressAttribute::Address(addr) | AddressAttribute::Local(addr)
if local.is_none() =>
{
local = addr.to_string().parse().ok();
}
AddressAttribute::Broadcast(addr) => {
broadcast = addr.to_string().parse().ok();
+3 -1
View File
@@ -146,7 +146,9 @@ mod tests {
assert_eq!(link.operstate, Some(OperState::Up));
assert_eq!(
link.address.map(|mac| mac.to_string()).as_deref(),
link.address
.map(|mac| mac.to_string().to_ascii_lowercase())
.as_deref(),
Some("aa:bb:cc:dd:ee:ff")
);
}
+32 -4
View File
@@ -45,6 +45,7 @@ This folder has small helpers for build, CI, and router install. Keep it simple;
- Uploads to `<RemotePath>.tmp` then atomically moves into place; `-Restart` restarts the service; `-Quiet` silences MOTD.
- `package_rootfs.ps1` — Produces `dist/wakey-rootfs-<version>-<target>.tgz` with `/root/.bin/wakey` and `/etc/init.d/*`.
- `update_wakey_cc.sh` — Linux VPS updater for control-plane bundles; extracts into the selected directory (default: current directory) and restarts `wakey-cc.service`.
- `update_wakey_cc_from_repo.sh` — Linux VPS source updater; clones repo to temp dir, builds UI + control-plane locally, packages bundle tgz, installs into selected directory, and restarts `wakey-cc.service`.
- `package_wakey_cc_bundle.sh` — Produces `dist/wakey-cc-<version>-<target>.tgz` with `bin/wakey-control-plane`, `ui/dist/*`, updater script, and systemd template.
- `publish.ps1` — Optional version bump + build + tag (and `cargo publish` only if you pass `-Publish`).
- `test_remote.ps1` — Build ARM Linux test binaries locally, upload them to the router, and run them there.
@@ -61,6 +62,20 @@ WAKEY_CC_VERSION=v0.2.0 WAKEY_CC_TARGET=x86_64-unknown-linux-gnu \
sudo -E ./scripts/update_wakey_cc.sh
```
## VPS source updater (control-plane)
Build-and-install locally on the VPS (avoids glibc mismatch from prebuilt binaries):
```sh
chmod +x ./scripts/update_wakey_cc_from_repo.sh
cd /opt/wakey
sudo -E /path/to/repo/scripts/update_wakey_cc_from_repo.sh
# optional: pin ref/target and skip restart
WAKEY_CC_REF=main WAKEY_CC_TARGET=x86_64-unknown-linux-gnu WAKEY_CC_NO_RESTART=1 \
sudo -E /path/to/repo/scripts/update_wakey_cc_from_repo.sh
```
Expected tarball layout:
- `bin/wakey-control-plane`
@@ -79,7 +94,7 @@ Basic examples:
```powershell
./scripts/test_remote.ps1 -Package wakey
./scripts/test_remote.ps1 -Package wakey -BinaryFilter integration_live_services -Ignored -NoCapture
./scripts/test_remote.ps1 -Package wakey -BinaryFilter integration_live_services -Filter status_real_router_default_query_succeeds -Ignored -NoCapture
./scripts/test_remote.ps1 -Package wakey -BinaryFilter integration_live_services -Filter inventory_real_router_default_query_returns_rows_or_empty_cleanly -Ignored -NoCapture
./scripts/test_remote.ps1 -AllPackages
```
@@ -113,13 +128,26 @@ Implementation notes:
- each package run gets a unique remote temp directory for safer concurrent use
- packages with no test executables are skipped instead of treated as failures
## Release checklist (tag push)
1. **Version:** bump crate versions / changelog as you prefer; tag `v*` and push.
2. **Runner:** Fedora/WSL self-hosted labels `self-hosted`, `linux`, `fedora`, `wsl`, `release` online (see [`WSL_RUNNER.md`](./WSL_RUNNER.md)).
3. **Control-plane bundle:** release job builds `ui/dist`, then `wakey-control-plane` for `x86_64-unknown-linux-gnu` and `aarch64-unknown-linux-gnu`. With **zig** + **cargo-zigbuild** on the runner, gnu builds use workflow env `WAKEY_CC_GLIBC_VERSION` (default `2.28`) for a predictable glibc floor; without them, binaries match the host glibc.
4. **Artifacts:** expect `dist/wakey-rootfs-*-armv7-unknown-linux-musleabihf.tgz` and `dist/wakey-cc-*-unknown-linux-gnu.tgz` attached to the Gitea release.
5. **Secret:** `GITEA_TOKEN` must be set for the publish step.
## CI (Gitea)
- Defined in `.gitea/workflows/release.yml`.
- Release job now targets your Fedora/WSL runner labels: `self-hosted`, `linux`, `fedora`, `wsl`, `release`.
- Steps: Linux-native build of `wakey` + `wakey-agent` → package rootfs → upload artifact (v3) → publish a release and attach tgz.
- Defined in `.gitea/workflows/release.yml` (tag / manual dispatch): router rootfs + control-plane bundles and Gitea release attach.
- Release job targets your Fedora/WSL runner labels: `self-hosted`, `linux`, `fedora`, `wsl`, `release`.
- Requires `secrets.GITEA_TOKEN` in the repo to publish the release.
## CI (GitHub)
- Defined in `.github/workflows/ci.yml` on pushes/PRs to `main` or `master`:
- **`rust` job:** `cargo fmt --check`, `clippy -D warnings`, `cargo test --workspace` on `ubuntu-latest`.
- **`ui` job:** under `ui/`, `pnpm install --frozen-lockfile`, then `pnpm run typecheck`, `format:check`, and `build` (mirrors what you need before packaging the control-plane bundle). GitHub sets `CI=true` for the runner; pnpm uses lockfile `ui/pnpm-lock.yaml` for cache.
## Runner migration
- Fedora/WSL is now the intended release-builder path.
+6 -3
View File
@@ -62,8 +62,9 @@ fi
[ -f "$BINARY" ] || { echo "missing binary: $BINARY" >&2; exit 1; }
[ -f "$UI_DIST/index.html" ] || { echo "missing UI dist index: $UI_DIST/index.html" >&2; exit 1; }
[ -f "scripts/update_wakey_cc.sh" ] || { echo "missing updater script" >&2; exit 1; }
[ -f "scripts/update_wakey_cc.sh" ] && [ -f "scripts/update_wakey_cc_from_repo.sh" ] || { echo "missing updater scripts" >&2; exit 1; }
[ -f "deploy/systemd/wakey-cc.service" ] || { echo "missing systemd template" >&2; exit 1; }
[ -f "deploy/control-plane.Caddyfile" ] || { echo "missing Caddyfile" >&2; exit 1; }
mkdir -p "$OUT_DIR"
STAGING="$OUT_DIR/wakey-cc-stage.$$"
@@ -75,9 +76,11 @@ mkdir -p "$STAGING/bin" "$STAGING/ui" "$STAGING/scripts" "$STAGING/deploy/system
cp "$BINARY" "$STAGING/bin/wakey-control-plane"
cp -a "$UI_DIST" "$STAGING/ui/dist"
cp "scripts/update_wakey_cc.sh" "$STAGING/scripts/update_wakey_cc.sh"
cp "scripts/update_wakey_cc_from_repo.sh" "$STAGING/scripts/update_wakey_cc_from_repo.sh"
cp "deploy/systemd/wakey-cc.service" "$STAGING/deploy/systemd/wakey-cc.service"
cp "deploy/control-plane.Caddyfile" "$STAGING/deploy/control-plane.Caddyfile"
chmod +x "$STAGING/bin/wakey-control-plane" "$STAGING/scripts/update_wakey_cc.sh"
chmod +x "$STAGING/bin/wakey-control-plane" "$STAGING/scripts/update_wakey_cc.sh" "$STAGING/scripts/update_wakey_cc_from_repo.sh" "$STAGING/deploy/control-plane.Caddyfile"
(
cd "$STAGING"
@@ -87,4 +90,4 @@ chmod +x "$STAGING/bin/wakey-control-plane" "$STAGING/scripts/update_wakey_cc.sh
rm -rf "$STAGING"
echo "Bundle package: $OUT_DIR/$PKG"
echo "Contains: bin/wakey-control-plane, ui/dist, scripts/update_wakey_cc.sh, deploy/systemd/wakey-cc.service"
echo "Contains: bin/wakey-control-plane, ui/dist, scripts/update_wakey_cc.sh, scripts/update_wakey_cc_from_repo.sh, deploy/systemd/wakey-cc.service, deploy/control-plane.Caddyfile"
+155
View File
@@ -0,0 +1,155 @@
#!/usr/bin/env sh
# Build and install wakey-control-plane from repository source on the target host.
# This avoids glibc baseline mismatches from prebuilt artifacts by building locally,
# then packaging the same bundle format and installing it.
#
# Simplest use:
# sudo -E ./scripts/update_wakey_cc_from_repo.sh
#
# Env options:
# WAKEY_CC_REPO_URL Git URL (default: https://git.ldlda.com/lda/wakey.git)
# WAKEY_CC_REF Git ref/branch/tag (default: main)
# WAKEY_CC_TARGET Rust target triple (default from uname)
# WAKEY_CC_ROOT Install root (default: current directory)
# WAKEY_CC_SERVICE systemd unit name (default: wakey-cc.service)
# WAKEY_CC_VERSION Bundle version label (default: v0.0.0-local-<short_sha>)
# WAKEY_CC_NO_RESTART If set, skip systemd restart
# WAKEY_CC_KEEP_TMP If set, keep temp checkout/build dir for debugging
# SUDO Privilege escalation command/path (default: sudo when needed)
#
# Requires: git, cargo, tar, pnpm, systemctl (optional for restart)
set -eu
log() { printf '[update_wakey_cc_from_repo] %s\n' "$*"; }
fail() {
printf '[update_wakey_cc_from_repo] ERROR: %s\n' "$*" >&2
exit 1
}
default_target() {
arch=$(uname -m)
case "$arch" in
x86_64)
printf '%s' 'x86_64-unknown-linux-gnu'
;;
aarch64|arm64)
printf '%s' 'aarch64-unknown-linux-gnu'
;;
*)
fail "unsupported arch for default target mapping: $arch (set WAKEY_CC_TARGET explicitly)"
;;
esac
}
require_cmd() {
command -v "$1" >/dev/null 2>&1 || fail "required command not found: $1"
}
sudo_cmd() {
if [ "$(id -u)" -eq 0 ]; then
return 0
fi
if [ -n "${SUDO:-}" ]; then
printf '%s' "$SUDO"
return 0
fi
if command -v sudo >/dev/null 2>&1; then
printf '%s' sudo
return 0
fi
fail 'root privileges are required for install/restart steps; set SUDO or run as root'
}
main() {
REPO_URL="${WAKEY_CC_REPO_URL:-https://git.ldlda.com/lda/wakey.git}"
REF="${WAKEY_CC_REF:-main}"
TARGET="${WAKEY_CC_TARGET:-$(default_target)}"
ROOT="${WAKEY_CC_ROOT:-$PWD}"
SERVICE="${WAKEY_CC_SERVICE:-wakey-cc.service}"
SUDO_BIN=$(sudo_cmd)
require_cmd git
require_cmd cargo
require_cmd tar
require_cmd pnpm
TMPBASE="${TMPDIR:-/tmp}"
WORKDIR="$TMPBASE/wakey-cc-src.$$"
STAGING="$TMPBASE/wakey-cc-stage.$$"
cleanup() {
if [ -z "${WAKEY_CC_KEEP_TMP:-}" ]; then
rm -rf "$WORKDIR" "$STAGING"
else
log "keeping temp dir: $WORKDIR"
fi
}
trap cleanup EXIT INT TERM
log "cloning $REPO_URL (ref: $REF)"
git clone --depth 1 --branch "$REF" "$REPO_URL" "$WORKDIR" ||
fail 'git clone failed'
cd "$WORKDIR"
log 'building UI dist'
(
cd ui
pnpm install --frozen-lockfile
pnpm build
)
log "building control-plane target $TARGET"
cargo build --release --target "$TARGET" -p wakey-control-plane ||
fail 'cargo build failed'
SHA=$(git rev-parse --short HEAD)
VERSION="${WAKEY_CC_VERSION:-v0.0.0-local-$SHA}"
log "packaging bundle version $VERSION"
./scripts/package_wakey_cc_bundle.sh --version "$VERSION" --target "$TARGET" ||
fail 'bundle packaging failed'
PKG="dist/wakey-cc-$VERSION-$TARGET.tgz"
[ -f "$PKG" ] || fail "bundle not found: $PKG"
rm -rf "$STAGING"
mkdir -p "$STAGING"
tar -xzf "$PKG" -C "$STAGING" || fail 'bundle extract failed'
[ -f "$STAGING/bin/wakey-control-plane" ] || fail 'bundle missing bin/wakey-control-plane'
[ -f "$STAGING/ui/dist/index.html" ] || fail 'bundle missing ui/dist/index.html'
if [ "$(id -u)" -ne 0 ] && [ -n "$SUDO_BIN" ]; then
$SUDO_BIN mkdir -p "$ROOT"
$SUDO_BIN cp -a "$STAGING/." "$ROOT/"
else
mkdir -p "$ROOT"
cp -a "$STAGING/." "$ROOT/"
fi
if [ -z "${WAKEY_CC_NO_RESTART:-}" ] && command -v systemctl >/dev/null 2>&1; then
if systemctl list-unit-files "$SERVICE" >/dev/null 2>&1; then
log "restarting $SERVICE"
if [ "$(id -u)" -ne 0 ] && [ -n "$SUDO_BIN" ]; then
$SUDO_BIN systemctl daemon-reload
$SUDO_BIN systemctl restart "$SERVICE"
$SUDO_BIN systemctl --no-pager --full status "$SERVICE" | sed -n '1,16p'
else
systemctl daemon-reload
systemctl restart "$SERVICE"
systemctl --no-pager --full status "$SERVICE" | sed -n '1,16p'
fi
else
log "service $SERVICE not installed; skipped restart"
fi
fi
log "done: installed into $ROOT"
}
main "$@"
+1
View File
@@ -25,6 +25,7 @@ pub struct Cli {
#[derive(Subcommand)]
pub enum Command {
/// Show merged device inventory rows.
#[command(visible_alias = "status")]
Inventory(InventoryArgs),
/// Show DHCP leases, optionally enriched with current neighbor state.
Leases(LeasesArgs),
+5 -3
View File
@@ -1,11 +1,13 @@
//! Operator-facing service API: inventory, leases, interfaces, wake, and query resolution.
//! The `wakey` binary is Linux-only; use `wakey-agent` / `wakey-control-plane` for remote control.
pub mod service;
pub mod utils;
pub use service::{
broadcast_wake_targets, get_interface_summaries, get_interface_summary, get_ips, get_leases,
inventory, leases_without_state, merge_devices, query_to_inventory_query, resolve_devices,
resolve_query, resolve_selector, resolve_wake_targets, wake_explicit, wake_from_query,
wake_targets,
inventory, leases_without_state, merge_devices, resolve_devices, resolve_query,
resolve_selector, resolve_wake_targets, wake_explicit, wake_from_query, wake_targets,
};
#[cfg(test)]
+1 -1
View File
@@ -5,7 +5,7 @@ use clap::Parser;
#[cfg(not(target_os = "linux"))]
fn main() -> anyhow::Result<()> {
Err(anyhow::anyhow!(
"OS not supported! run this on your ahh router!"
"wakey only runs on Linux (router/OpenWrt-style targets)."
))
}
+10 -29
View File
@@ -59,8 +59,8 @@ pub fn merge_devices(
.map(|(neighbors, leases)| Device::from_parts(neighbors, leases))
.collect();
let mut texts: Vec<&str> = Vec::new();
let mut devs: Vec<&str> = Vec::new();
let mut texts = Vec::new();
let mut devs = Vec::new();
let mut ips = Vec::new();
let mut macs = Vec::new();
let mut nuds = Vec::new();
@@ -72,35 +72,16 @@ pub fn merge_devices(
Query::Ip(v) => ips.push(*v),
Query::Mac(v) => macs.push(*v),
Query::NeighborState(v) => nuds.push(*v),
}
}
if !texts.is_empty() {
devices.retain(|device| device.names.iter().any(|n| texts.iter().any(|t| n == t)));
}
if !devs.is_empty() {
devices.retain(|device| {
device
.interfaces
.iter()
.any(|iface| devs.iter().any(|d| iface == d))
});
}
if !ips.is_empty() {
devices.retain(|device| device.ips.iter().any(|ip| ips.contains(ip)));
}
if !macs.is_empty() {
devices.retain(|device| device.macs.iter().any(|mac| macs.contains(mac)));
}
if !nuds.is_empty() {
devices.retain(|device| {
device
.neighbors
.iter()
.any(|neighbor| nuds.contains(&neighbor.state))
});
};
}
devices.retain(|device| {
(texts.is_empty() || device.names.iter().any(|n| texts.contains(&n.as_str())))
&& (devs.is_empty() || device.interfaces.iter().any(|i| devs.contains(&i.as_str()))) // same pattern as iter().any
&& (ips.is_empty() || device.ips.iter().any(|ip| ips.contains(ip)))
&& (macs.is_empty() || device.macs.iter().any(|mac| macs.contains(mac)))
&& (nuds.is_empty() || device.neighbors.iter().any(|n| nuds.contains(&n.state)))
});
devices.sort_by(|a, b| {
presence_rank(b.presence)
.cmp(&presence_rank(a.presence))
+1 -1
View File
@@ -7,7 +7,7 @@ pub mod wake;
pub use interfaces::{get_interface_summaries, get_interface_summary, get_ips};
pub use inventory::{inventory, merge_devices, resolve_devices};
pub use leases::{get_leases, leases_without_state};
pub use query::{query_to_inventory_query, resolve_query, resolve_selector};
pub use query::{resolve_query, resolve_selector};
pub use wake::{
broadcast_wake_targets, resolve_wake_targets, wake_explicit, wake_from_query, wake_targets,
};
+1 -12
View File
@@ -2,11 +2,8 @@ use anyhow::Result;
use wakey_core::{InventoryQuery, Query, QueryInput};
/// Resolve free-form user input into an `InventoryQuery` filter shape.
///
/// This is the compatibility entrypoint used by CLI and HTTP paths that still
/// speak in terms of query/filter payloads.
pub async fn resolve_query(input: impl Into<String>) -> Result<InventoryQuery> {
query_to_inventory_query(resolve_selector(input).await?)
Ok(vec![resolve_selector(input).await?])
}
/// Classify one piece of free-form user input into a typed selector.
@@ -24,11 +21,3 @@ pub async fn resolve_selector(input: impl Into<String>) -> Result<Query> {
},
)
}
/// Convert the newer selector-oriented `Query` model into an `InventoryQuery`.
///
/// This keeps the old filter-based service and HTTP surfaces working while the
/// internals migrate toward selector- and device-oriented APIs.
pub fn query_to_inventory_query(query: Query) -> Result<InventoryQuery> {
Ok(vec![query])
}
+9 -7
View File
@@ -6,6 +6,7 @@ use wakey_core::{InterfaceSummary, WakeResult, WakeTarget};
use crate::service::interfaces::get_interface_summaries;
use crate::service::inventory::resolve_devices;
use crate::utils::product;
/// Send Wake-on-LAN packets for already-concrete wake targets.
#[instrument(skip_all, fields(targets = targets.len()))]
@@ -50,14 +51,15 @@ pub async fn wake_explicit(mac: MacAddr, ip: Option<IpAddr>) -> Result<WakeResul
#[instrument(skip_all)]
pub async fn resolve_wake_targets(input: impl Into<String>) -> Result<Vec<WakeTarget>> {
let devices = resolve_devices(input).await?;
let targets: Vec<WakeTarget> = devices
.into_iter()
.flat_map(|device| {
let mac = device.macs.first().copied();
device
.ips
.into_iter()
.map(move |ip| WakeTarget { ip: Some(ip), mac })
// TRY EVERYTHING some has to work
product(device.ips, device.macs).map(|(i, m)| WakeTarget {
ip: Some(i),
mac: Some(m),
})
})
.collect();
debug!(targets = targets.len(), "resolved wake targets");
@@ -79,8 +81,8 @@ fn broadcast_wake_targets_from_interfaces(
.iter()
.flat_map(|iface| iface.addrs.iter())
.filter_map(|addr| addr.broadcast)
.map(|ip| WakeTarget {
ip: Some(IpAddr::V4(ip)),
.map(|br| WakeTarget {
ip: Some(IpAddr::V4(br)), // some will hit eventually AHHH logic
mac: Some(mac),
})
.collect();
+15 -1
View File
@@ -1 +1,15 @@
// Intentionally left empty.
//! rare fns that belong nowhere
/// absolute dih cheese
/// took some inspo from itertools
pub fn product<A, B, T1, T2>(i1: T1, i2: T2) -> impl Iterator<Item = (A, B)>
where
A: Clone,
T1: IntoIterator<Item = A>,
T2: IntoIterator<Item = B>,
T2::IntoIter: Clone,
{
let i2 = i2.into_iter();
i1.into_iter()
.flat_map(move |i1i| i2.clone().map(move |i2i| (i1i.clone(), i2i)))
}
+157
View File
@@ -0,0 +1,157 @@
import * as React from "react";
import { Dialog as DialogPrimitive } from "@base-ui/react/dialog";
import { cn } from "@/lib/utils";
import { Button } from "@/components/ui/button";
import { XIcon } from "lucide-react";
function Dialog({ ...props }: DialogPrimitive.Root.Props) {
return <DialogPrimitive.Root data-slot="dialog" {...props} />;
}
function DialogTrigger({ ...props }: DialogPrimitive.Trigger.Props) {
return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />;
}
function DialogPortal({ ...props }: DialogPrimitive.Portal.Props) {
return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />;
}
function DialogClose({ ...props }: DialogPrimitive.Close.Props) {
return <DialogPrimitive.Close data-slot="dialog-close" {...props} />;
}
function DialogOverlay({
className,
...props
}: DialogPrimitive.Backdrop.Props) {
return (
<DialogPrimitive.Backdrop
data-slot="dialog-overlay"
className={cn(
"fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",
className,
)}
{...props}
/>
);
}
function DialogContent({
className,
children,
showCloseButton = true,
...props
}: DialogPrimitive.Popup.Props & {
showCloseButton?: boolean;
}) {
return (
<DialogPortal>
<DialogOverlay />
<DialogPrimitive.Popup
data-slot="dialog-content"
className={cn(
"fixed top-1/2 start-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 rtl:translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
className,
)}
{...props}
>
{children}
{showCloseButton && (
<DialogPrimitive.Close
data-slot="dialog-close"
render={
<Button
variant="ghost"
className="absolute top-2 end-2"
size="icon-sm"
/>
}
>
<XIcon />
<span className="sr-only">Close</span>
</DialogPrimitive.Close>
)}
</DialogPrimitive.Popup>
</DialogPortal>
);
}
function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="dialog-header"
className={cn("flex flex-col gap-2", className)}
{...props}
/>
);
}
function DialogFooter({
className,
showCloseButton = false,
children,
...props
}: React.ComponentProps<"div"> & {
showCloseButton?: boolean;
}) {
return (
<div
data-slot="dialog-footer"
className={cn(
"-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end",
className,
)}
{...props}
>
{children}
{showCloseButton && (
<DialogPrimitive.Close render={<Button variant="outline" />}>
Close
</DialogPrimitive.Close>
)}
</div>
);
}
function DialogTitle({ className, ...props }: DialogPrimitive.Title.Props) {
return (
<DialogPrimitive.Title
data-slot="dialog-title"
className={cn(
"font-heading text-base leading-none font-medium",
className,
)}
{...props}
/>
);
}
function DialogDescription({
className,
...props
}: DialogPrimitive.Description.Props) {
return (
<DialogPrimitive.Description
data-slot="dialog-description"
className={cn(
"text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",
className,
)}
{...props}
/>
);
}
export {
Dialog,
DialogClose,
DialogContent,
DialogDescription,
DialogFooter,
DialogHeader,
DialogOverlay,
DialogPortal,
DialogTitle,
DialogTrigger,
};
+22 -4
View File
@@ -12,6 +12,7 @@ import {
SelectTrigger,
} from "@/components/ui/select";
import { DeviceInventoryTable } from "@/pages/devices/DeviceInventoryTable";
import { DeviceDetailsDialog } from "@/pages/devices/DeviceDetailsDialog";
import { WakeHistoryCard } from "@/pages/devices/WakeHistoryCard";
import type {
DeviceRow,
@@ -112,6 +113,7 @@ export function DevicesPage({
const [bulkWakeBusy, setBulkWakeBusy] = useState(false);
const [quickWake, setQuickWake] = useState("");
const [selectedIds, setSelectedIds] = useState<string[]>([]);
const [detailsDevice, setDetailsDevice] = useState<DeviceRow | null>(null);
const [copyStatus, setCopyStatus] = useState("");
const [recentWakes, setRecentWakes] = useState<WakeEvent[]>([]);
function appendWakeEvent(event: WakeEvent) {
@@ -288,9 +290,17 @@ export function DevicesPage({
);
}
// Sort
const sorter = sorters[sort.key];
result = [...result].sort(sorter);
if (sort.dir === "desc") result.reverse();
if (sort.key === "name") {
result = [...result].sort((a, b) => {
if (a.isUnnamed !== b.isUnnamed) return a.isUnnamed ? 1 : -1;
const cmp = a.name.localeCompare(b.name);
return sort.dir === "desc" ? -cmp : cmp;
});
} else {
const sorter = sorters[sort.key];
result = [...result].sort(sorter);
if (sort.dir === "desc") result.reverse();
}
return result;
}, [rows, query, sort, presenceFilter]);
@@ -342,7 +352,7 @@ export function DevicesPage({
<span>Agent</span>
<Select
value={selectedAgentId}
onValueChange={(value) => {
onValueChange={(value: string | null) => {
if (value) onSelectAgent(value);
}}
>
@@ -505,6 +515,14 @@ export function DevicesPage({
onSortChange={setSort}
onWakeDevice={(device) => void wakeDevice(device)}
onCopyValue={(label, value) => void copyValue(label, value)}
onOpenDetails={setDetailsDevice}
/>
<DeviceDetailsDialog
device={detailsDevice}
open={Boolean(detailsDevice)}
onOpenChange={(open) => {
if (!open) setDetailsDevice(null);
}}
/>
</CardContent>
</Card>
@@ -0,0 +1,68 @@
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import {
Dialog,
DialogContent,
DialogDescription,
DialogFooter,
DialogHeader,
DialogTitle,
} from "@/components/ui/dialog";
import { Separator } from "@/components/ui/separator";
import type { DeviceRow } from "@/pages/devices/types";
type Props = {
device: DeviceRow | null;
open: boolean;
onOpenChange: (open: boolean) => void;
};
function summarizeAll(values: string[]): string {
if (!values.length) return "-";
return values.join(", ");
}
export function DeviceDetailsDialog({ device, open, onOpenChange }: Props) {
if (!device) return null;
return (
<Dialog open={open} onOpenChange={onOpenChange}>
<DialogContent className="max-w-2xl p-0">
<div className="grid gap-4 p-4 text-sm">
<DialogHeader className="pr-8">
<div className="flex items-start justify-between gap-3">
<div className="min-w-0">
<DialogTitle className="truncate">{device.name}</DialogTitle>
<DialogDescription>Device details</DialogDescription>
</div>
<Badge variant="outline">{device.presence}</Badge>
</div>
</DialogHeader>
<div>
<p className="mb-1 font-medium">IP addresses</p>
<p className="text-muted-foreground">{summarizeAll(device.ips)}</p>
</div>
<Separator />
<div>
<p className="mb-1 font-medium">MAC addresses</p>
<p className="text-muted-foreground">{summarizeAll(device.macs)}</p>
</div>
<Separator />
<div>
<p className="mb-1 font-medium">Interfaces</p>
<p className="text-muted-foreground">
{summarizeAll(device.interfaces)}
</p>
</div>
<DialogFooter>
<Button variant="outline" onClick={() => onOpenChange(false)}>
Close
</Button>
</DialogFooter>
</div>
</DialogContent>
</Dialog>
);
}
+21 -9
View File
@@ -28,6 +28,7 @@ type Props = {
onSortChange: (next: { key: SortKey; dir: SortDir }) => void;
onWakeDevice: (device: DeviceRow) => void;
onCopyValue: (label: string, value: string) => void;
onOpenDetails: (device: DeviceRow) => void;
};
function sortArrow(active: boolean, dir: SortDir) {
@@ -48,7 +49,13 @@ export function DeviceInventoryTable({
onSortChange,
onWakeDevice,
onCopyValue,
onOpenDetails,
}: Props) {
function shouldIgnoreRowClick(target: EventTarget | null): boolean {
if (!(target instanceof Element)) return false;
return Boolean(target.closest("button, input, a, [role='menuitem']"));
}
return (
<div className="device-list grid gap-2">
<div className="device-row device-header rounded-md border bg-muted/60 px-3 py-2 text-sm">
@@ -85,14 +92,26 @@ export function DeviceInventoryTable({
>
Presence {sortArrow(sort.key === "presence", sort.dir)}
</span>
<span className="device-cell">Interfaces</span>
<span className="device-cell device-action">Actions</span>
</div>
{rows.map((row) => (
<div
className="device-row rounded-md border bg-card px-3 py-2 text-sm"
className="device-row cursor-pointer rounded-md border bg-card px-3 py-2 text-sm transition-colors hover:bg-accent/30"
key={row.id}
role="button"
tabIndex={0}
onClick={(event) => {
if (shouldIgnoreRowClick(event.target)) return;
onOpenDetails(row);
}}
onKeyDown={(event) => {
if (shouldIgnoreRowClick(event.target)) return;
if (event.key === "Enter" || event.key === " ") {
event.preventDefault();
onOpenDetails(row);
}
}}
>
<span className="device-cell device-select" data-label="Pick">
<input
@@ -122,13 +141,6 @@ export function DeviceInventoryTable({
<span className="device-cell" data-label="Presence">
<Badge variant="outline">{row.presence}</Badge>
</span>
<span
className="device-cell"
data-label="Interfaces"
title={row.interfaces.join(", ") || "-"}
>
{summarize(row.interfaces)}
</span>
<span className="device-cell device-action" data-label="">
<Button
onClick={() => onWakeDevice(row)}
+3 -8
View File
@@ -52,11 +52,11 @@
display: grid;
grid-template-columns:
36px minmax(110px, 1.1fr) minmax(160px, 2fr) minmax(130px, 1.5fr)
minmax(100px, 0.85fr) minmax(100px, 0.9fr) minmax(170px, max-content);
minmax(100px, 0.85fr) minmax(170px, max-content);
align-items: center;
column-gap: 0.4rem;
row-gap: 0.55rem;
min-width: 980px;
min-width: 860px;
}
.device-header {
@@ -111,8 +111,7 @@
"name name"
"presence presence"
"ip ip"
"mac mac"
"interfaces interfaces";
"mac mac";
align-items: start;
min-width: 0;
}
@@ -162,10 +161,6 @@
grid-area: mac;
}
.device-row .device-cell[data-label="Interfaces"] {
grid-area: interfaces;
}
.device-row .device-action {
grid-area: action;
justify-self: end;
+1
View File
@@ -1,6 +1,7 @@
export type DeviceRow = {
id: string;
name: string;
isUnnamed: boolean;
ips: string[];
macs: string[];
interfaces: string[];
+3 -3
View File
@@ -50,11 +50,13 @@ export function parseInventoryRows(payload: unknown): DeviceRow[] {
: [];
const presence =
typeof device.presence === "string" ? device.presence : "unknown";
const isUnnamed = names.length === 0;
const id = macs[0] || ips[0] || names[0] || `row-${idx}`;
return {
id,
name: names[0] || "(unnamed)",
isUnnamed,
ips,
macs,
interfaces,
@@ -122,9 +124,7 @@ export function parseWakeSummary(response: unknown): {
}
export function chooseWakeTarget(device: DeviceRow): string {
return device.name !== "(unnamed)"
? device.name
: device.macs[0] || device.ips[0] || "";
return device.isUnnamed ? device.macs[0] || device.ips[0] || "" : device.name;
}
export function summarize(values: string[]): string {
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "wakey-agent"
version = "0.0.1"
version = "0.1.0"
edition = "2024"
publish = ["gitea"]
+2
View File
@@ -1 +1,3 @@
//! Outbound router agent: enrollment, websocket session, and dispatch into local wakey services.
pub mod protocol;
+1 -1
View File
@@ -109,7 +109,7 @@ fn init_config(args: InitConfigArgs) -> Result<()> {
let cfg = config::AgentConfig {
server_url: args
.server_url
.unwrap_or_else(|| "https://control-plane.example.com".to_string()),
.unwrap_or_else(|| "https://wakey.ldlda.com".to_string()),
agent_id: args
.agent_id
.unwrap_or_else(|| "REPLACE_ME_AGENT_ID".to_string()),
+1 -1
View File
@@ -36,7 +36,7 @@ async fn run_once(config: &AgentConfig) -> Result<()> {
.unwrap_or_default()
);
let span = info_span!("agent_session", session_id = %session_id, agent_id = %config.agent_id);
let _span_guard = span.enter();
let _span_guard = span.enter(); // the ENTIRETY of below is agent_session.
let ws_url = websocket_url(&config.server_url)?;
info!(%ws_url, agent_id = %config.agent_id, "connecting agent websocket");
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "wakey-control-plane"
version = "0.1.0"
version = "0.1.1"
edition = "2024"
publish = ["gitea"]
+2
View File
@@ -1,3 +1,5 @@
//! HTTP + WebSocket control plane: agent enrollment, registry, command relay, and operator UI hosting.
mod api;
mod cli;
mod config;
+1 -1
View File
@@ -18,7 +18,7 @@ pub struct Store {
agent_meta: sled::Tree,
audit_events: sled::Tree,
active_alerts: sled::Tree,
alert_transitions: sled::Tree,
alert_transitions: sled::Tree, // Where are them Types!
}
const SCHEMA_VERSION_KEY: &[u8] = b"schema_version";
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "wakey-core"
version = "0.2.0"
version = "0.2.1"
edition = "2024"
publish = ["gitea"]
+2
View File
@@ -1,3 +1,5 @@
//! Shared domain types and parsing for DHCP, neighbors, interfaces, devices, and wake flows.
pub mod model;
pub mod parse;
+6 -6
View File
@@ -71,8 +71,8 @@ impl Device {
for lease in &leases {
ips.insert(lease.ip);
macs.insert(lease.mac);
if let Some(name) = &lease.name {
names.insert(name.clone());
if let Some(name) = lease.name.as_deref() {
names.insert(name);
}
}
for neighbor in &neighbors {
@@ -80,8 +80,8 @@ impl Device {
if let Some(mac) = neighbor.mac {
macs.insert(mac);
}
if let Some(dev) = &neighbor.dev {
interfaces.insert(dev.clone());
if let Some(dev) = neighbor.dev.as_deref() {
interfaces.insert(dev);
}
presence = std::cmp::max(
presence_rank(presence),
@@ -93,10 +93,10 @@ impl Device {
let macs: Vec<MacAddr> = macs.into_iter().collect();
Self {
id: macs.first().copied().map(|mac| DeviceId { mac }),
names: names.into_iter().collect(),
names: names.into_iter().map(|n| n.to_owned()).collect(),
ips: ips.into_iter().collect(),
macs,
interfaces: interfaces.into_iter().collect(),
interfaces: interfaces.into_iter().map(|d| d.to_owned()).collect(),
neighbors,
leases,
presence,
+1 -1
View File
@@ -50,7 +50,7 @@ pub struct WakeTargetResult {
#[serde(rename_all = "snake_case")]
pub enum WakeStatus {
Succeed,
NonexistentAddress,
NonexistentAddress, // how do i know this isnt some other errors? what!
WrongSize,
Incomplete,
}
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "wakey-linux"
version = "0.2.0"
version = "0.2.1"
edition = "2024"
publish = ["gitea"]
+2 -1
View File
@@ -13,7 +13,7 @@ use wakey_core::{InterfaceAddr, InterfaceSummary};
/// Loopback is intentionally excluded.
pub async fn list_interface_summaries() -> Result<Vec<InterfaceSummary>> {
#[cfg(unix)]
let rows = address::nl::get(None)
let rows = address::nl::get(None) // <- why not do filtering here
.await
.context("rtnetlink address query failed")?;
@@ -22,6 +22,7 @@ pub async fn list_interface_summaries() -> Result<Vec<InterfaceSummary>> {
.await
.context("ip -j address show failed")?;
// convert semi raw [AddrOutput] into Almost the same [InterfaceSummary]
let mut out: Vec<InterfaceSummary> = rows
.into_iter()
.filter(|row| row.ifname != "lo")
+2
View File
@@ -1,3 +1,5 @@
//! Linux/OpenWrt adapters: DHCP leases, interface summaries, neighbor tables, and WoL.
pub mod devices;
pub mod dhcp;
pub mod wake;