diff --git a/.github/workflows/net.yml b/.github/workflows/net.yml index 38abb87..b1220c0 100644 --- a/.github/workflows/net.yml +++ b/.github/workflows/net.yml @@ -20,7 +20,7 @@ on: - '**.txt' - 'art' workflow_dispatch: - schedule: [cron: "40 1 * * *"] + schedule: [cron: "0 1 */7 * *"] jobs: test: diff --git a/.github/workflows/quinn.yml b/.github/workflows/quinn.yml index 8666f84..197c3dc 100644 --- a/.github/workflows/quinn.yml +++ b/.github/workflows/quinn.yml @@ -20,7 +20,7 @@ on: - '**.txt' - 'art' workflow_dispatch: - schedule: [cron: "40 1 * * *"] + schedule: [cron: "0 1 */7 * *"] jobs: test: diff --git a/.github/workflows/s2n.yml b/.github/workflows/s2n.yml index 5cfaa53..f81292c 100644 --- a/.github/workflows/s2n.yml +++ b/.github/workflows/s2n.yml @@ -20,7 +20,7 @@ on: - '**.txt' - 'art' workflow_dispatch: - schedule: [cron: "40 1 * * *"] + schedule: [cron: "0 1 */7 * *"] jobs: test: diff --git a/Cargo.toml b/Cargo.toml index c1a2949..6a2dc40 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,9 +29,9 @@ rustdoc-args = ["--cfg", "docsrs"] auto_impl = "1" atomic_refcell = "0.1" agnostic-lite = { version = "0.3", features = ["time"] } -agnostic = "0.4" +agnostic = "0.5" # agnostic-lite = { version = "0.3", features = ["time"], path = "../agnostic/lite" } -# agnostic = { version = "0.4", path = "../agnostic/agnostic" } +# agnostic = { version = "0.5", path = "../agnostic/agnostic" } async-lock = "3" async-channel = "2" bytes = "1" @@ -39,7 +39,7 @@ byteorder = "1" derive_more = { version = "1", features = ["full"] } futures = "0.3" indexmap = "2" -local-ip-address = "0.6" +getifs = "0.2" metrics = "0.24" nodecraft = { version = "0.4", features = [ "transformable", @@ -58,6 +58,7 @@ pin-project = "1" scopeguard = "1" serde = { version = "1", features = ["derive", "rc"] } humantime-serde = "1" +rkyv = { version = "0.8", features = ["smol_str-0_3", "bytes-1"] } smallvec = "1" smallvec-wrapper = { version = "0.2", features = ["const_new", "either"] } smol_str = "0.3" diff --git a/core/Cargo.toml b/core/Cargo.toml index 3961b19..cb914ca 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "memberlist-core" -version = "0.3.0" +version = "0.3.1" edition.workspace = true license.workspace = true repository.workspace = true @@ -32,7 +32,7 @@ rkyv = ["dep:rkyv", "nodecraft/rkyv", "memberlist-types/rkyv"] # expose all tests fn for users who want to use other runtime # see memberlist-wasm for more examples about how to use those tests fn -test = ["tracing-subscriber", "pnet"] +test = ["tracing-subscriber"] [target.'cfg(target_family = "wasm")'.dependencies] getrandom = { version = "0.2", features = ["js"] } @@ -70,13 +70,7 @@ tracing.workspace = true viewit.workspace = true base64 = { version = "0.22", optional = true } - -# rkyv feature -rkyv = { version = "0.7", features = [ - "validation", - "bytes", - "smol_str", -], optional = true } +rkyv = { workspace = true, optional = true } # serde feature serde = { workspace = true, optional = true } @@ -87,8 +81,6 @@ tracing-subscriber = { version = "0.3", optional = true, features = [ "env-filter", "tracing-log", ] } -pnet = { version = "0.35", optional = true } - # metrics feature metrics = { workspace = true, optional = true } @@ -98,7 +90,6 @@ tracing-subscriber = { version = "0.3", features = [ "env-filter", "tracing-log", ] } -pnet = "0.35" agnostic = { workspace = true, features = ["net", "tokio"] } rand = "0.8" tokio = { version = "1", features = ["full"] } diff --git a/transports/net/Cargo.toml b/transports/net/Cargo.toml index 8759b98..0e60093 100644 --- a/transports/net/Cargo.toml +++ b/transports/net/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "memberlist-net" -version = "0.3.1" +version = "0.3.2" edition.workspace = true license.workspace = true repository.workspace = true @@ -74,7 +74,7 @@ crc32fast = "1" either = "1" futures.workspace = true indexmap.workspace = true -local-ip-address.workspace = true +getifs.workspace = true nodecraft = { workspace = true, features = ["async", "resolver", "agnostic"] } peekable = { version = "0.2", features = ["future"] } pin-project.workspace = true @@ -97,7 +97,6 @@ aes-gcm = { version = "0.10", optional = true } cbc = { version = "0.1", optional = true } rayon = { version = "1.8", optional = true } weezl = { version = "0.1", optional = true } -pnet = { version = "0.34", optional = true } # serde serde = { workspace = true, optional = true } diff --git a/transports/net/src/error.rs b/transports/net/src/error.rs index 8cdc906..1c2978d 100644 --- a/transports/net/src/error.rs +++ b/transports/net/src/error.rs @@ -12,9 +12,6 @@ pub enum NetTransportError { /// Returns when there is no explicit advertise address and no private IP address found. #[error("no private IP address found, and explicit IP not provided")] NoPrivateIP, - /// Returns when there is no interface addresses found. - #[error("failed to get interface addresses {0}")] - NoInterfaceAddresses(#[from] local_ip_address::Error), /// Returns when there is no bind address provided. #[error("at least one bind address is required")] EmptyBindAddresses, diff --git a/transports/net/src/lib.rs b/transports/net/src/lib.rs index 154e32c..8d3df3f 100644 --- a/transports/net/src/lib.rs +++ b/transports/net/src/lib.rs @@ -334,10 +334,15 @@ where // find final advertise address let final_advertise_addr = if advertise_addr.ip().is_unspecified() { - let ip = local_ip_address::local_ip().map_err(|e| match e { - local_ip_address::Error::LocalIpAddressNotFound => NetTransportError::NoPrivateIP, - e => NetTransportError::NoInterfaceAddresses(e), - })?; + let ip = getifs::private_addrs() + .map_err(|_| NetTransportError::NoPrivateIP) + .and_then(|ips| { + if let Some(ip) = ips.into_iter().next().map(|ip| ip.addr()) { + Ok(ip) + } else { + Err(NetTransportError::NoPrivateIP) + } + })?; SocketAddr::new(ip, advertise_addr.port()) } else { advertise_addr diff --git a/transports/quic/Cargo.toml b/transports/quic/Cargo.toml index 75ff062..a4042bb 100644 --- a/transports/quic/Cargo.toml +++ b/transports/quic/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "memberlist-quic" -version = "0.3.0" +version = "0.3.1" edition.workspace = true license.workspace = true repository.workspace = true @@ -57,7 +57,7 @@ byteorder.workspace = true crossbeam-skiplist = "0.1" futures.workspace = true indexmap = "2" -local-ip-address.workspace = true +getifs.workspace = true memberlist-core.workspace = true nodecraft = { workspace = true, features = ["async", "resolver", "agnostic"] } pin-project.workspace = true @@ -83,8 +83,8 @@ rustls = { version = "0.23", default-features = false, optional = true } rcgen = { version = "0.13", optional = true } # s2n -s2n-quic = { version = "1.51", optional = true } -s2n-quic-transport = { version = "0.51", optional = true } +s2n-quic = { version = "1.52", optional = true } +s2n-quic-transport = { version = "0.52", optional = true } # compression rayon = { version = "1.8", optional = true } diff --git a/transports/quic/src/error.rs b/transports/quic/src/error.rs index d42d33c..8bb6af5 100644 --- a/transports/quic/src/error.rs +++ b/transports/quic/src/error.rs @@ -6,9 +6,6 @@ pub enum QuicTransportError { /// Returns when there is no explicit advertise address and no private IP address found. #[error("no private IP address found, and explicit IP not provided")] NoPrivateIP, - /// Returns when there is no interface addresses found. - #[error("failed to get interface addresses {0}")] - NoInterfaceAddresses(#[from] local_ip_address::Error), /// Returns when there is no bind address provided. #[error("at least one bind address is required")] EmptyBindAddresses, diff --git a/transports/quic/src/lib.rs b/transports/quic/src/lib.rs index c01836c..685549f 100644 --- a/transports/quic/src/lib.rs +++ b/transports/quic/src/lib.rs @@ -224,10 +224,15 @@ where // find final advertise address let final_advertise_addr = if advertise_addr.ip().is_unspecified() { - let ip = local_ip_address::local_ip().map_err(|e| match e { - local_ip_address::Error::LocalIpAddressNotFound => QuicTransportError::NoPrivateIP, - e => QuicTransportError::NoInterfaceAddresses(e), - })?; + let ip = getifs::private_addrs() + .map_err(|_| QuicTransportError::NoPrivateIP) + .and_then(|ips| { + if let Some(ip) = ips.into_iter().next().map(|ip| ip.addr()) { + Ok(ip) + } else { + Err(QuicTransportError::NoPrivateIP) + } + })?; SocketAddr::new(ip, advertise_addr.port()) } else { advertise_addr diff --git a/types/Cargo.toml b/types/Cargo.toml index aea5d8b..3060ba4 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -54,7 +54,7 @@ metrics = { workspace = true, optional = true } serde = { workspace = true, optional = true } base64 = { version = "0.22", optional = true } -rkyv = { version = "0.8", optional = true, features = ["smol_str-0_3", "bytes-1"] } +rkyv = { workspace = true, optional = true } [dev-dependencies] rand = "0.8"