WHAT THE FUCKKKKKK
thats a real bug? thats crazy
This commit is contained in:
@@ -38,8 +38,6 @@ pub async fn get_with_handle(
|
|||||||
nuds: &[NUDState],
|
nuds: &[NUDState],
|
||||||
macs: &[MacAddr],
|
macs: &[MacAddr],
|
||||||
) -> anyhow::Result<Vec<NeighborItem>> {
|
) -> anyhow::Result<Vec<NeighborItem>> {
|
||||||
let mut neighbor_data = handle.neighbours().get().execute();
|
|
||||||
|
|
||||||
// Build filter sets (empty = match all)
|
// Build filter sets (empty = match all)
|
||||||
let ip_set: HashSet<IpAddr> = ips.iter().copied().collect();
|
let ip_set: HashSet<IpAddr> = ips.iter().copied().collect();
|
||||||
let dev_set: HashSet<&str> = devs.iter().map(AsRef::as_ref).collect();
|
let dev_set: HashSet<&str> = devs.iter().map(AsRef::as_ref).collect();
|
||||||
@@ -52,6 +50,8 @@ pub async fn get_with_handle(
|
|||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|link| (link.ifindex, link.ifname))
|
.map(|link| (link.ifindex, link.ifname))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
|
let mut neighbor_data = handle.neighbours().get().execute();
|
||||||
let mut result = vec![];
|
let mut result = vec![];
|
||||||
|
|
||||||
'row: while let Some(msg) = neighbor_data.try_next().await? {
|
'row: while let Some(msg) = neighbor_data.try_next().await? {
|
||||||
|
|||||||
+28
-1
@@ -7,7 +7,8 @@ use wakey_core::{DeviceFilters, DeviceQuery, InterfaceSummary, WakeResult};
|
|||||||
|
|
||||||
#[derive(Parser)]
|
#[derive(Parser)]
|
||||||
#[command(name = "wakey")]
|
#[command(name = "wakey")]
|
||||||
#[command(version, about = "Wakey service CLI and HTTP adapter")]
|
#[command(version, about = "CLI and temporary HTTP adapter for Wakey")]
|
||||||
|
#[command(long_about = "Wakey can run as a local/operator CLI or serve the legacy HTTP/static interface during the migration to a service-first architecture.")]
|
||||||
struct Cli {
|
struct Cli {
|
||||||
#[command(subcommand)]
|
#[command(subcommand)]
|
||||||
command: Command,
|
command: Command,
|
||||||
@@ -15,62 +16,88 @@ struct Cli {
|
|||||||
|
|
||||||
#[derive(Subcommand)]
|
#[derive(Subcommand)]
|
||||||
enum Command {
|
enum Command {
|
||||||
|
/// Serve the temporary legacy HTTP/static app.
|
||||||
Http(HttpArgs),
|
Http(HttpArgs),
|
||||||
|
/// Show device status rows from neighbor/device data.
|
||||||
Status(StatusArgs),
|
Status(StatusArgs),
|
||||||
|
/// Show DHCP leases, optionally enriched with current neighbor state.
|
||||||
Leases(LeasesArgs),
|
Leases(LeasesArgs),
|
||||||
|
/// Send Wake-on-LAN packets from a query or explicit MAC/IP pair.
|
||||||
Wake(WakeArgs),
|
Wake(WakeArgs),
|
||||||
|
/// Show condensed network interface summaries.
|
||||||
Devs(DevsArgs),
|
Devs(DevsArgs),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Args)]
|
#[derive(Args)]
|
||||||
struct HttpArgs {
|
struct HttpArgs {
|
||||||
|
/// Host address to bind the HTTP server to.
|
||||||
#[arg(long, default_value = "::")]
|
#[arg(long, default_value = "::")]
|
||||||
host: IpAddr,
|
host: IpAddr,
|
||||||
|
/// TCP port to bind the HTTP server to.
|
||||||
#[arg(long, default_value_t = 12012)]
|
#[arg(long, default_value_t = 12012)]
|
||||||
port: u16,
|
port: u16,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Args)]
|
#[derive(Args)]
|
||||||
struct LeasesArgs {
|
struct LeasesArgs {
|
||||||
|
/// Include best-known current neighbor state for each lease IP.
|
||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
include_state: bool,
|
include_state: bool,
|
||||||
|
/// Print machine-readable JSON instead of a table.
|
||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
json: bool,
|
json: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Args)]
|
#[derive(Args)]
|
||||||
|
#[command(after_long_help = "Examples:\n wakey wake bedroom-pc\n wakey wake --mac aa:bb:cc:dd:ee:ff\n wakey wake --mac aa:bb:cc:dd:ee:ff --ip 192.168.1.255\n\nRules:\n - query mode and explicit --mac/--ip mode are mutually exclusive\n - --ip requires --mac\n - --mac without --ip fans out to interface broadcast targets")]
|
||||||
struct WakeArgs {
|
struct WakeArgs {
|
||||||
|
/// Free-form device query, for example a hostname, IP, MAC, interface, or NUD state.
|
||||||
query: Option<String>,
|
query: Option<String>,
|
||||||
|
/// Explicit MAC address for manual wake mode.
|
||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
mac: Option<macaddr::MacAddr>,
|
mac: Option<macaddr::MacAddr>,
|
||||||
|
/// Explicit destination IP or broadcast address for manual wake mode.
|
||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
ip: Option<IpAddr>,
|
ip: Option<IpAddr>,
|
||||||
|
/// Print machine-readable JSON instead of a table.
|
||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
json: bool,
|
json: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Args)]
|
#[derive(Args)]
|
||||||
|
#[command(after_long_help = "Examples:\n wakey status bedroom-pc\n wakey status --mac aa:bb:cc:dd:ee:ff\n wakey status --dev br-lan --nud reachable\n\nIf only the positional query is provided, it is treated as free-form input and resolved through the smart selector path.")]
|
||||||
struct StatusArgs {
|
struct StatusArgs {
|
||||||
|
/// Free-form device query.
|
||||||
query: Option<String>,
|
query: Option<String>,
|
||||||
|
/// Explicit name/text filter.
|
||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
name: Option<String>,
|
name: Option<String>,
|
||||||
|
/// Explicit IP filters.
|
||||||
#[arg(long = "ip")]
|
#[arg(long = "ip")]
|
||||||
ips: Vec<std::net::IpAddr>,
|
ips: Vec<std::net::IpAddr>,
|
||||||
|
/// Explicit interface-name filters.
|
||||||
#[arg(long = "dev")]
|
#[arg(long = "dev")]
|
||||||
devs: Vec<String>,
|
devs: Vec<String>,
|
||||||
|
/// Explicit neighbor-state filters.
|
||||||
#[arg(long = "nud")]
|
#[arg(long = "nud")]
|
||||||
nuds: Vec<wakey_core::NeighborState>,
|
nuds: Vec<wakey_core::NeighborState>,
|
||||||
|
/// Explicit MAC-address filters.
|
||||||
#[arg(long = "mac")]
|
#[arg(long = "mac")]
|
||||||
macs: Vec<macaddr::MacAddr>,
|
macs: Vec<macaddr::MacAddr>,
|
||||||
|
/// Print machine-readable JSON instead of a table.
|
||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
json: bool,
|
json: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Args)]
|
#[derive(Args)]
|
||||||
|
#[command(after_long_help = "Examples:\n wakey devs\n wakey devs br-lan\n wakey devs --up\n wakey devs --json")]
|
||||||
struct DevsArgs {
|
struct DevsArgs {
|
||||||
|
/// Optional interface name to show.
|
||||||
dev: Option<String>,
|
dev: Option<String>,
|
||||||
|
/// Show only interfaces whose operstate is `up`.
|
||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
up: bool,
|
up: bool,
|
||||||
|
/// Print machine-readable JSON instead of a table.
|
||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
json: bool,
|
json: bool,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user