Skip to content

Commit 8dd2cb9

Browse files
more fixes
1 parent 5ce7a89 commit 8dd2cb9

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

netwatch/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ rtnetlink = "=0.13.1" # pinned because of https://github.com/rust-netlink/rtnetl
5858
[target.'cfg(target_os = "windows")'.dependencies]
5959
wmi = "0.14"
6060
windows = { version = "0.58", features = ["Win32_NetworkManagement_IpHelper", "Win32_Foundation", "Win32_NetworkManagement_Ndis", "Win32_Networking_WinSock"] }
61+
windows-result = "0.3"
6162
serde = { version = "1", features = ["derive"] }
6263
derive_more = { version = "1.0.0", features = ["debug"] }
6364

netwatch/src/interfaces/linux.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ pub async fn default_route_android_ip_route() -> Result<Option<DefaultRouteDetai
9595
.kill_on_drop(true)
9696
.output()
9797
.await?;
98-
let stdout = std::str::from_utf8(&output.stdout)?;
98+
let stdout = std::string::String::from_utf8_lossy(&output.stdout);
9999
let details = parse_android_ip_route(&stdout).map(|iface| DefaultRouteDetails {
100100
interface_name: iface.to_string(),
101101
});
@@ -186,7 +186,7 @@ async fn iface_by_index(handle: &rtnetlink::Handle, index: u32) -> Result<String
186186
use netlink_packet_route::link::LinkAttribute;
187187

188188
let mut links = handle.link().get().match_index(index).execute();
189-
let msg = links.try_next().await?.ok_or_else(|| Error::NoResponse)?;
189+
let msg = links.try_next().await?.ok_or(Error::NoResponse)?;
190190

191191
for nla in msg.attributes {
192192
if let LinkAttribute::IfName(name) = nla {

netwatch/src/netmon/windows.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use libc::c_void;
44
use tokio::sync::mpsc;
55
use tracing::{trace, warn};
66
use windows::Win32::{
7-
Foundation::{BOOLEAN, HANDLE as Handle, WIN32_ERROR},
7+
Foundation::{BOOLEAN, HANDLE as Handle},
88
NetworkManagement::IpHelper::{
99
MIB_IPFORWARD_ROW2, MIB_NOTIFICATION_TYPE, MIB_UNICASTIPADDRESS_ROW,
1010
},
@@ -23,7 +23,7 @@ pub enum Error {
2323
#[error("IO {0}")]
2424
Io(#[from] std::io::Error),
2525
#[error("win32: {0}")]
26-
Win32(#[from] windows::Win32::Foundation::Error),
26+
Win32(#[from] windows_result::Error),
2727
}
2828

2929
impl RouteMonitor {

0 commit comments

Comments
 (0)