Switch from deprecated get_if_addrs to if-addrs

Fixes #1079.
This commit is contained in:
Sven-Hendrik Haase 2023-04-20 22:40:53 +02:00
parent 74a4f8445c
commit 73c65650e8
No known key found for this signature in database
GPG Key ID: 39E4B877E62EB915
3 changed files with 21 additions and 51 deletions

68
Cargo.lock generated
View File

@ -431,7 +431,7 @@ checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
dependencies = [
"hermit-abi 0.1.19",
"libc",
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -548,12 +548,6 @@ dependencies = [
"bytes",
]
[[package]]
name = "c_linked_list"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4964518bd3b4a8190e832886cdc0da9794f12e8e6c1613a9e90ff331c4c8724b"
[[package]]
name = "cc"
version = "1.0.79"
@ -581,7 +575,7 @@ dependencies = [
"num-traits",
"time 0.1.45",
"wasm-bindgen",
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -1060,12 +1054,6 @@ dependencies = [
"slab",
]
[[package]]
name = "gcc"
version = "0.3.55"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2"
[[package]]
name = "generic-array"
version = "0.14.7"
@ -1076,28 +1064,6 @@ dependencies = [
"version_check",
]
[[package]]
name = "get_if_addrs"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "abddb55a898d32925f3148bd281174a68eeb68bbfd9a5938a57b18f506ee4ef7"
dependencies = [
"c_linked_list",
"get_if_addrs-sys",
"libc",
"winapi 0.2.8",
]
[[package]]
name = "get_if_addrs-sys"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d04f9fb746cf36b191c00f3ede8bde9c8e64f9f4b05ae2694a9ccf5e3f5ab48"
dependencies = [
"gcc",
"libc",
]
[[package]]
name = "getrandom"
version = "0.2.9"
@ -1350,6 +1316,16 @@ dependencies = [
"unicode-normalization",
]
[[package]]
name = "if-addrs"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2cfc4a06638d2fd0dda83b01126fefd38ef9f04f54d2fc717a938df68b83a68d"
dependencies = [
"libc",
"windows-sys 0.45.0",
]
[[package]]
name = "ignore"
version = "0.4.20"
@ -1646,11 +1622,11 @@ dependencies = [
"fake-tty",
"fast_qr",
"futures",
"get_if_addrs",
"grass",
"hex",
"http",
"httparse",
"if-addrs",
"libflate",
"log",
"maud",
@ -1770,7 +1746,7 @@ version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "628223faebab4e3e40667ee0b2336d34a5b960ff60ea743ddfdbcf7770bcfb66"
dependencies = [
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -2112,7 +2088,7 @@ dependencies = [
"spin",
"untrusted",
"web-sys",
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -2379,7 +2355,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662"
dependencies = [
"libc",
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -2572,7 +2548,7 @@ checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a"
dependencies = [
"libc",
"wasi 0.10.0+wasi-snapshot-preview1",
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -2920,12 +2896,6 @@ dependencies = [
"webpki",
]
[[package]]
name = "winapi"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
[[package]]
name = "winapi"
version = "0.3.9"
@ -2948,7 +2918,7 @@ version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
dependencies = [
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -3104,7 +3074,7 @@ version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d"
dependencies = [
"winapi 0.3.9",
"winapi",
]
[[package]]

View File

@ -35,7 +35,7 @@ clap_mangen = "0.2"
comrak = { version = "0.18", default-features = false }
fast_qr = { version = "0.8", features = ["svg"] }
futures = "0.3"
get_if_addrs = "0.5"
if-addrs = "0.10"
hex = "0.4"
http = "0.2"
httparse = "1"

View File

@ -142,7 +142,7 @@ async fn run(miniserve_config: MiniserveConfig) -> Result<(), ContextualError> {
if !wildcard.is_empty() {
let all_ipv4 = wildcard.iter().any(|addr| addr.is_ipv4());
let all_ipv6 = wildcard.iter().any(|addr| addr.is_ipv6());
ifaces = get_if_addrs::get_if_addrs()
ifaces = if_addrs::get_if_addrs()
.unwrap_or_else(|e| {
error!("Failed to get local interface addresses: {}", e);
Default::default()