wtf is this
This commit is contained in:
+4
-4
@@ -1,5 +1,5 @@
|
||||
[build]
|
||||
target = "armv7-unknown-linux-musleabihf"
|
||||
|
||||
[target.armv7-unknown-linux-musleabihf]
|
||||
linker = "rust-lld"
|
||||
linker = "rust-lld"
|
||||
|
||||
[alias]
|
||||
ldabr = "b -r --target=target.armv7-unknown-linux-musleabihf"
|
||||
Generated
+9
@@ -32,6 +32,12 @@ dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.100"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61"
|
||||
|
||||
[[package]]
|
||||
name = "atomic-waker"
|
||||
version = "1.1.2"
|
||||
@@ -614,11 +620,14 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
|
||||
name = "lda-ipjs"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"macaddr",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_with",
|
||||
"strum",
|
||||
"thiserror",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
@@ -10,3 +10,7 @@ strum = { version = "0.27.2", features = ["derive", "strum_macros"] }
|
||||
serde_json = "1.0.143"
|
||||
serde_with = { version = "3.14.0", features = ["json"] }
|
||||
serde = { version = "1.0.219", features = ["derive"] }
|
||||
thiserror = "2.0.16"
|
||||
anyhow = "1.0.100"
|
||||
tokio = { version = "1.47.1", features = ["fs", "process", "rt-multi-thread", "io-util"] }
|
||||
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
trait IpCommand {
|
||||
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
//! ts
|
||||
//!
|
||||
//!
|
||||
//! deals with both ip a (addroutput) and ip l (commonoutput)
|
||||
//!
|
||||
//!
|
||||
//! lowk why its free but its indirection and its ass
|
||||
|
||||
use macaddr::{MacAddr, MacAddr6};
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
pub mod address;
|
||||
pub mod neighbor;
|
||||
pub mod address;
|
||||
@@ -0,0 +1,25 @@
|
||||
//! idk what to put here
|
||||
|
||||
use std::{iter, net::IpAddr};
|
||||
|
||||
use anyhow::bail;
|
||||
|
||||
use super::{NUDState, NeighborItem};
|
||||
|
||||
pub async fn get(
|
||||
ip: Option<IpAddr>,
|
||||
dev: Option<&str>,
|
||||
nud: &[NUDState],
|
||||
) -> anyhow::Result<Vec<NeighborItem>> {
|
||||
let output = tokio::process::Command::new("ip")
|
||||
.args(
|
||||
(["-j", "neigh", "show"].iter().map(ToString::to_string))
|
||||
.chain(ip.map(|ip| ip.to_canonical().to_string()))
|
||||
.chain(dev.map(ToString::to_string))
|
||||
.chain(nud.iter().map(|f| f.to_string())),
|
||||
)
|
||||
.output()
|
||||
.await?;
|
||||
|
||||
bail!("no")
|
||||
}
|
||||
@@ -4,6 +4,8 @@
|
||||
//!
|
||||
//! yes. this is a real call.
|
||||
|
||||
pub mod json;
|
||||
|
||||
use crate::utils::serialize::mac::{des_opm, ser_opm};
|
||||
use std::net::IpAddr;
|
||||
|
||||
@@ -60,7 +62,6 @@ pub enum NUDState {
|
||||
Failed,
|
||||
}
|
||||
|
||||
|
||||
/// everything i see
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Hash, Serialize, Deserialize)]
|
||||
pub struct NeighborItem {
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
use std::iter::Fuse;
|
||||
|
||||
/// wrap ts into a [Fuse][std::iter::Fuse] or something
|
||||
pub struct Real<A: Clone, B: Iterator<Item = A>> {
|
||||
prepend: A,
|
||||
iter: B,
|
||||
my_turn: bool,
|
||||
}
|
||||
|
||||
impl<A: Clone, B: Iterator<Item = A>> Real<A, B> {
|
||||
pub fn new(prepend: A, iter: B) -> Self {
|
||||
Self {
|
||||
prepend,
|
||||
iter,
|
||||
my_turn: true,
|
||||
}
|
||||
}
|
||||
pub fn fuse(prepend: A, iter: B) -> Fuse<Self> {
|
||||
Self::new(prepend, iter).fuse()
|
||||
}
|
||||
}
|
||||
|
||||
impl<A: Clone, B: Iterator<Item = A>> Iterator for Real<A, B> {
|
||||
type Item = A;
|
||||
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
let a = if self.my_turn {
|
||||
Some(self.prepend.clone())
|
||||
} else {
|
||||
self.iter.next()
|
||||
};
|
||||
self.my_turn = !self.my_turn;
|
||||
a
|
||||
}
|
||||
}
|
||||
@@ -1 +1,2 @@
|
||||
pub mod iter;
|
||||
pub mod serialize;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
use macaddr::MacAddr;
|
||||
use serde::{self, Deserialize, Deserializer, de::Error as DeError};
|
||||
use serde::{Serialize, Serializer, de};
|
||||
|
||||
Reference in New Issue
Block a user