windows: don't discover default IP, removes winpcap dependency

This commit is contained in:
Brian Picciano 2025-01-14 12:32:51 +01:00
parent 3e65289b85
commit 7221ac5e88

View file

@ -863,6 +863,15 @@ impl NodeStatus {
/// Obtain the list of currently available IP addresses on all non-loopback /// Obtain the list of currently available IP addresses on all non-loopback
/// interfaces, optionally filtering them to be inside a given IpNet. /// interfaces, optionally filtering them to be inside a given IpNet.
fn get_default_ip(filter_ipnet: Option<ipnet::IpNet>) -> Option<IpAddr> { fn get_default_ip(filter_ipnet: Option<ipnet::IpNet>) -> Option<IpAddr> {
// pnet creates a dependency on winpcap, which is a giant pain to get working with
// cross-compilation.
#[cfg(windows)]
{
None
}
#[cfg(not(windows))]
{
pnet_datalink::interfaces() pnet_datalink::interfaces()
.into_iter() .into_iter()
// filter down and loopback interfaces // filter down and loopback interfaces
@ -875,6 +884,7 @@ fn get_default_ip(filter_ipnet: Option<ipnet::IpNet>) -> Option<IpAddr> {
}) })
.map(|ipn| ipn.ip()) .map(|ipn| ipn.ip())
} }
}
fn get_rpc_public_addr(config: &Config) -> Option<SocketAddr> { fn get_rpc_public_addr(config: &Config) -> Option<SocketAddr> {
match &config.rpc_public_addr { match &config.rpc_public_addr {