fuck is some bullshit ts returns cuh
This commit is contained in:
@@ -32,7 +32,7 @@ pub async fn get(dev: Option<&str>) -> anyhow::Result<Vec<AddrOutput>> {
|
|||||||
anyhow::bail!(String::from_utf8_lossy(&output.stderr).into_owned());
|
anyhow::bail!(String::from_utf8_lossy(&output.stderr).into_owned());
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(serde_json::from_slice(&output.stdout)?)
|
serde_json::from_slice(&output.stdout).context("Deserialize failed")
|
||||||
}
|
}
|
||||||
pub async fn _get(dev: Option<&str>) -> io::Result<Output> {
|
pub async fn _get(dev: Option<&str>) -> io::Result<Output> {
|
||||||
let mut cmd = tokio::process::Command::new("ip");
|
let mut cmd = tokio::process::Command::new("ip");
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ pub async fn get(
|
|||||||
if !output.status.success() {
|
if !output.status.success() {
|
||||||
bail!(String::from_utf8_lossy(&output.stderr).into_owned())
|
bail!(String::from_utf8_lossy(&output.stderr).into_owned())
|
||||||
} else {
|
} else {
|
||||||
Ok(serde_json::from_slice(&output.stdout)?)
|
serde_json::from_slice(&output.stdout).context("Deserialize failed")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use macaddr::MacAddr;
|
use macaddr::MacAddr;
|
||||||
use serde::{self, Deserialize, Deserializer, de::Error as DeError};
|
use serde::{self, Deserialize, Deserializer, de::Error as DeError};
|
||||||
use serde::{Serialize, Serializer, de};
|
use serde::{Serialize, Serializer};
|
||||||
|
|
||||||
pub fn serialize_macs<S>(macs: &[MacAddr], serializer: S) -> Result<S::Ok, S::Error>
|
pub fn serialize_macs<S>(macs: &[MacAddr], serializer: S) -> Result<S::Ok, S::Error>
|
||||||
where
|
where
|
||||||
@@ -33,14 +33,18 @@ pub mod option_mac {
|
|||||||
pub fn serialize<S: Serializer>(bro: &Option<MacAddr>, ser: S) -> Result<S::Ok, S::Error> {
|
pub fn serialize<S: Serializer>(bro: &Option<MacAddr>, ser: S) -> Result<S::Ok, S::Error> {
|
||||||
Option::<String>::serialize(&bro.as_ref().map(ToString::to_string), ser)
|
Option::<String>::serialize(&bro.as_ref().map(ToString::to_string), ser)
|
||||||
}
|
}
|
||||||
/// deserialize an [`Option<MacAddr>`]
|
/// deserialize an [`Option<MacAddr>`], returns None for invalid input (::, 0.0.0.0)
|
||||||
pub fn deserialize<'de, D>(des: D) -> Result<Option<MacAddr>, D::Error>
|
pub fn deserialize<'de, D>(des: D) -> Result<Option<MacAddr>, D::Error>
|
||||||
where
|
where
|
||||||
D: serde::Deserializer<'de>,
|
D: serde::Deserializer<'de>,
|
||||||
{
|
{
|
||||||
Option::<&str>::deserialize(des)?
|
let s: Option<&str> = Option::<&str>::deserialize(des)?;
|
||||||
.map(str::parse)
|
match s {
|
||||||
.transpose()
|
Some(val) => match val.parse::<MacAddr>() {
|
||||||
.map_err(de::Error::custom)
|
Ok(mac) => Ok(Some(mac)),
|
||||||
|
Err(_) => Ok(None),
|
||||||
|
},
|
||||||
|
None => Ok(None),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+17
-3
@@ -1,6 +1,6 @@
|
|||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
|
|
||||||
use lda_ipjs::subcommands::neighbor;
|
use lda_ipjs::subcommands::{address, neighbor};
|
||||||
|
|
||||||
#[tokio::test] // ← Use tokio::test instead of manual #[tokio::main]
|
#[tokio::test] // ← Use tokio::test instead of manual #[tokio::main]
|
||||||
async fn ball1() -> anyhow::Result<()> {
|
async fn ball1() -> anyhow::Result<()> {
|
||||||
@@ -119,7 +119,21 @@ async fn ball_compare_backends() -> anyhow::Result<()> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// #[tokio::test]
|
||||||
|
// async fn cidr_filter() {
|
||||||
|
// unimplemented!("never. i aint add what i dont need")
|
||||||
|
// }
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn cidr_filter() {
|
async fn ipjas() -> anyhow::Result<()> {
|
||||||
unimplemented!("never. i aint add what i dont need")
|
let cuh = address::json::get(None).await?;
|
||||||
|
println!("{cuh:#?}");
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn ipjas_raw() -> anyhow::Result<()> {
|
||||||
|
let cuh = address::json::_get(None).await?;
|
||||||
|
println!("{cuh:#?}");
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
[System.Diagnostics.CodeAnalysis.SuppressMessage('PSAvoidDefaultValueSwitchParameter', 'Default true is intentional for fast dev loop')]
|
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidDefaultValueSwitchParameter', "",
|
||||||
|
Justification = 'Default true is intentional for fast dev loop')]
|
||||||
param(
|
param(
|
||||||
[string]$Pass,
|
[string]$Pass,
|
||||||
[string]$HostName = "192.168.100.1",
|
[string]$HostName = "192.168.100.1",
|
||||||
|
|||||||
@@ -34,9 +34,9 @@ ForEach-Object { $_.Matches.Groups[1].Value } |
|
|||||||
Get-Item
|
Get-Item
|
||||||
|
|
||||||
if ($testBinaries.Count -eq 0) {
|
if ($testBinaries.Count -eq 0) {
|
||||||
Write-Error "No test binaries found!"
|
Write-Error "No test binaries found! Exiting..."
|
||||||
Write-Host "Cargo output:" -ForegroundColor Yellow
|
# Write-Host "Cargo output:" -ForegroundColor Yellow
|
||||||
$cargoOutput | ForEach-Object { Write-Host $_ }
|
# $cargoOutput | ForEach-Object { Write-Host $_ }
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user