cippy issue, fmt, update/upgrade
This commit is contained in:
@@ -286,9 +286,15 @@ mod windows;
|
||||
pub use windows::{PinnedRelayRoute, best_route_to, interface_identity_from_guid, pin_relay_route};
|
||||
#[cfg(windows)]
|
||||
pub use windows::{
|
||||
ScopedDefaultRoutes, ScopedInterfaceMetric, ScopedInterfaceMtu, interface_metric,
|
||||
interface_mtu, interface_unicast_addresses, set_scoped_default_routes_disabled,
|
||||
set_scoped_interface_metric, set_scoped_interface_mtu,
|
||||
ScopedDefaultRoutes,
|
||||
ScopedInterfaceMetric,
|
||||
ScopedInterfaceMtu,
|
||||
interface_metric,
|
||||
interface_mtu,
|
||||
interface_unicast_addresses,
|
||||
set_scoped_default_routes_disabled,
|
||||
set_scoped_interface_metric,
|
||||
set_scoped_interface_mtu,
|
||||
};
|
||||
|
||||
#[cfg(not(windows))]
|
||||
|
||||
@@ -1,34 +1,62 @@
|
||||
use std::{
|
||||
fmt, io,
|
||||
fmt,
|
||||
io,
|
||||
net::{IpAddr, Ipv4Addr, Ipv6Addr},
|
||||
ptr::{null, null_mut},
|
||||
slice,
|
||||
};
|
||||
|
||||
use anyhow::{Context, Result, bail};
|
||||
use windows_sys::Win32::{
|
||||
Foundation::{ERROR_OBJECT_ALREADY_EXISTS, ERROR_SUCCESS},
|
||||
NetworkManagement::{
|
||||
IpHelper::{
|
||||
ConvertInterfaceGuidToLuid, ConvertInterfaceLuidToIndex, CreateIpForwardEntry2,
|
||||
DeleteIpForwardEntry2, FreeMibTable, GetBestRoute2, GetIpInterfaceEntry,
|
||||
GetUnicastIpAddressTable, IP_ADDRESS_PREFIX, InitializeIpForwardEntry,
|
||||
InitializeIpInterfaceEntry, MIB_IPFORWARD_ROW2, MIB_IPINTERFACE_ROW,
|
||||
MIB_UNICASTIPADDRESS_ROW, MIB_UNICASTIPADDRESS_TABLE, SetIpInterfaceEntry,
|
||||
use windows_sys::{
|
||||
Win32::{
|
||||
Foundation::{ERROR_OBJECT_ALREADY_EXISTS, ERROR_SUCCESS},
|
||||
NetworkManagement::{
|
||||
IpHelper::{
|
||||
ConvertInterfaceGuidToLuid,
|
||||
ConvertInterfaceLuidToIndex,
|
||||
CreateIpForwardEntry2,
|
||||
DeleteIpForwardEntry2,
|
||||
FreeMibTable,
|
||||
GetBestRoute2,
|
||||
GetIpInterfaceEntry,
|
||||
GetUnicastIpAddressTable,
|
||||
IP_ADDRESS_PREFIX,
|
||||
InitializeIpForwardEntry,
|
||||
InitializeIpInterfaceEntry,
|
||||
MIB_IPFORWARD_ROW2,
|
||||
MIB_IPINTERFACE_ROW,
|
||||
MIB_UNICASTIPADDRESS_ROW,
|
||||
MIB_UNICASTIPADDRESS_TABLE,
|
||||
SetIpInterfaceEntry,
|
||||
},
|
||||
Ndis::NET_LUID_LH,
|
||||
},
|
||||
Networking::WinSock::{
|
||||
AF_INET,
|
||||
AF_INET6,
|
||||
AF_UNSPEC,
|
||||
IN_ADDR,
|
||||
IN_ADDR_0,
|
||||
IN6_ADDR,
|
||||
IN6_ADDR_0,
|
||||
RouteProtocolNetMgmt,
|
||||
SOCKADDR_IN,
|
||||
SOCKADDR_IN6,
|
||||
SOCKADDR_IN6_0,
|
||||
SOCKADDR_INET,
|
||||
},
|
||||
Ndis::NET_LUID_LH,
|
||||
},
|
||||
Networking::WinSock::{
|
||||
AF_INET, AF_INET6, AF_UNSPEC, IN_ADDR, IN_ADDR_0, IN6_ADDR, IN6_ADDR_0,
|
||||
RouteProtocolNetMgmt, SOCKADDR_IN, SOCKADDR_IN6, SOCKADDR_IN6_0, SOCKADDR_INET,
|
||||
},
|
||||
core::GUID,
|
||||
};
|
||||
use windows_sys::core::GUID;
|
||||
|
||||
use crate::{
|
||||
InterfaceMetricSnapshot, InterfaceMtuSnapshot, InterfaceUnicastAddress, IpInterfaceFamily,
|
||||
InterfaceMetricSnapshot,
|
||||
InterfaceMtuSnapshot,
|
||||
InterfaceUnicastAddress,
|
||||
IpInterfaceFamily,
|
||||
NetworkInterfaceIdentity,
|
||||
RouteSnapshot,
|
||||
};
|
||||
use crate::{NetworkInterfaceIdentity, RouteSnapshot};
|
||||
|
||||
pub fn interface_identity_from_guid(interface_guid: &str) -> Result<NetworkInterfaceIdentity> {
|
||||
let guid = parse_interface_guid(interface_guid)?;
|
||||
|
||||
Reference in New Issue
Block a user