1
0
mirror of https://github.com/containers/netavark.git synced 2026-02-05 06:45:56 +01:00

update tonic and prost dependencies

update tonic to 0.12.3, prost to 0.13.3 and add hyper-util which is
needed foe the tokio async io trait. this was rather ahrd to figure out
because of super cryptic compile errors to missing traits
implementations.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger
2024-10-02 16:21:30 +02:00
parent 97d56bb081
commit c198914c4a
4 changed files with 95 additions and 61 deletions

134
Cargo.lock generated
View File

@@ -307,18 +307,17 @@ checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0"
[[package]]
name = "axum"
version = "0.6.20"
version = "0.7.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b829e4e32b91e643de6eafe82b1d90675f5874230191a4ffbc1b336dec4d6bf"
checksum = "504e3947307ac8326a5437504c517c4b56716c9d98fac0028c2acc7ca47d70ae"
dependencies = [
"async-trait",
"axum-core",
"bitflags 1.3.2",
"bytes",
"futures-util",
"http",
"http-body",
"hyper",
"http-body-util",
"itoa",
"matchit",
"memchr",
@@ -327,25 +326,28 @@ dependencies = [
"pin-project-lite",
"rustversion",
"serde",
"sync_wrapper",
"tower 0.4.13",
"sync_wrapper 1.0.1",
"tower 0.5.1",
"tower-layer",
"tower-service",
]
[[package]]
name = "axum-core"
version = "0.3.4"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "759fa577a247914fd3f7f76d62972792636412fbfd634cd452f6a385a74d2d2c"
checksum = "09f2bd6146b97ae3359fa0cc6d6b376d9539582c7b4220f041a33ec24c226199"
dependencies = [
"async-trait",
"bytes",
"futures-util",
"http",
"http-body",
"http-body-util",
"mime",
"pin-project-lite",
"rustversion",
"sync_wrapper 1.0.1",
"tower-layer",
"tower-service",
]
@@ -367,9 +369,9 @@ dependencies = [
[[package]]
name = "base64"
version = "0.21.7"
version = "0.22.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567"
checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
[[package]]
name = "bitflags"
@@ -419,9 +421,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
[[package]]
name = "bytes"
version = "1.7.0"
version = "1.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fca2be1d5c43812bae364ee3f30b3afcb7877cf59f4aeb94c66f313a41d2fac9"
checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3"
[[package]]
name = "cc"
@@ -952,15 +954,15 @@ checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd"
[[package]]
name = "h2"
version = "0.3.26"
version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8"
checksum = "524e8ac6999421f49a846c2d4411f337e53497d8ec55d67753beffa43c5d9205"
dependencies = [
"atomic-waker",
"bytes",
"fnv",
"futures-core",
"futures-sink",
"futures-util",
"http",
"indexmap 2.2.6",
"slab",
@@ -1013,9 +1015,9 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
[[package]]
name = "http"
version = "0.2.12"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1"
checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258"
dependencies = [
"bytes",
"fnv",
@@ -1024,12 +1026,24 @@ dependencies = [
[[package]]
name = "http-body"
version = "0.4.6"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2"
checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184"
dependencies = [
"bytes",
"http",
]
[[package]]
name = "http-body-util"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f"
dependencies = [
"bytes",
"futures-util",
"http",
"http-body",
"pin-project-lite",
]
@@ -1053,13 +1067,12 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
[[package]]
name = "hyper"
version = "0.14.30"
version = "1.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a152ddd61dfaec7273fe8419ab357f33aee0d914c5f4efbf0d96fa749eea5ec9"
checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05"
dependencies = [
"bytes",
"futures-channel",
"futures-core",
"futures-util",
"h2",
"http",
@@ -1068,23 +1081,41 @@ dependencies = [
"httpdate",
"itoa",
"pin-project-lite",
"socket2 0.5.7",
"smallvec",
"tokio",
"tower-service",
"tracing",
"want",
]
[[package]]
name = "hyper-timeout"
version = "0.4.1"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1"
checksum = "3203a961e5c83b6f5498933e78b6b263e208c197b63e9c6c53cc82ffd3f63793"
dependencies = [
"hyper",
"hyper-util",
"pin-project-lite",
"tokio",
"tokio-io-timeout",
"tower-service",
]
[[package]]
name = "hyper-util"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41296eb09f183ac68eec06e03cdbea2e759633d4067b2f6552fc2e009bcad08b"
dependencies = [
"bytes",
"futures-channel",
"futures-util",
"http",
"http-body",
"hyper",
"pin-project-lite",
"socket2 0.5.7",
"tokio",
"tower-service",
"tracing",
]
[[package]]
@@ -1369,6 +1400,7 @@ dependencies = [
"futures-channel",
"futures-core",
"futures-util",
"hyper-util",
"ipnet",
"iptables",
"libc",
@@ -1755,9 +1787,9 @@ dependencies = [
[[package]]
name = "prost"
version = "0.12.6"
version = "0.13.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "deb1435c188b76130da55f17a466d252ff7b1418b2ad3e037d127b94e3411f29"
checksum = "7b0487d90e047de87f984913713b85c601c05609aad5b0df4b4573fbf69aa13f"
dependencies = [
"bytes",
"prost-derive",
@@ -1765,9 +1797,9 @@ dependencies = [
[[package]]
name = "prost-build"
version = "0.12.6"
version = "0.13.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22505a5c94da8e3b7c2996394d1c933236c4d743e81a410bcca4e6989fc066a4"
checksum = "0c1318b19085f08681016926435853bbf7858f9c082d0999b80550ff5d9abe15"
dependencies = [
"bytes",
"heck 0.5.0",
@@ -1786,9 +1818,9 @@ dependencies = [
[[package]]
name = "prost-derive"
version = "0.12.6"
version = "0.13.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "81bddcdb20abf9501610992b6759a4c888aef7d1a7247ef75e2404275ac24af1"
checksum = "e9552f850d5f0964a4e4d0bf306459ac29323ddfbae05e35a7c0d35cb0803cc5"
dependencies = [
"anyhow",
"itertools",
@@ -1799,9 +1831,9 @@ dependencies = [
[[package]]
name = "prost-types"
version = "0.12.6"
version = "0.13.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9091c90b0a32608e984ff2fa4091273cbdd755d54935c51d520887f4a1dbd5b0"
checksum = "4759aa0d3a6232fb8dbdb97b61de2c20047c68aca932c7ed76da9d788508d670"
dependencies = [
"prost",
]
@@ -2134,6 +2166,12 @@ version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160"
[[package]]
name = "sync_wrapper"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394"
[[package]]
name = "sysctl"
version = "0.6.0"
@@ -2213,16 +2251,6 @@ dependencies = [
"windows-sys 0.52.0",
]
[[package]]
name = "tokio-io-timeout"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30b74022ada614a1b4834de765f9bb43877f910cc8ce4be40e89042c9223a8bf"
dependencies = [
"pin-project-lite",
"tokio",
]
[[package]]
name = "tokio-macros"
version = "2.4.0"
@@ -2277,9 +2305,9 @@ dependencies = [
[[package]]
name = "tonic"
version = "0.11.0"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "76c4eb7a4e9ef9d4763600161f12f5070b92a578e1b634db88a6887844c91a13"
checksum = "877c5b330756d856ffcc4553ab34a5684481ade925ecc54bcd1bf02b1d0d4d52"
dependencies = [
"async-stream",
"async-trait",
@@ -2289,11 +2317,14 @@ dependencies = [
"h2",
"http",
"http-body",
"http-body-util",
"hyper",
"hyper-timeout",
"hyper-util",
"percent-encoding",
"pin-project",
"prost",
"socket2 0.5.7",
"tokio",
"tokio-stream",
"tower 0.4.13",
@@ -2304,13 +2335,14 @@ dependencies = [
[[package]]
name = "tonic-build"
version = "0.11.0"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be4ef6dd70a610078cb4e338a0f79d06bc759ff1b22d2120c2ff02ae264ba9c2"
checksum = "9557ce109ea773b399c9b9e5dca39294110b74f1f342cb347a80d1fce8c26a11"
dependencies = [
"prettyplease",
"proc-macro2",
"prost-build",
"prost-types",
"quote",
"syn 2.0.72",
]
@@ -2344,7 +2376,7 @@ dependencies = [
"futures-core",
"futures-util",
"pin-project-lite",
"sync_wrapper",
"sync_wrapper 0.1.2",
"tower-layer",
"tower-service",
]

View File

@@ -54,18 +54,19 @@ fs2 = "0.4.3"
netlink-sys = "0.8.6"
tokio = { version = "1.40.0", features = ["rt", "rt-multi-thread", "signal", "fs"] }
tokio-stream = { version = "0.1.16", features = ["net"] }
tonic = "0.11"
tonic = "0.12.3"
mozim = "0.2.4"
prost = "0.12.6"
prost = "0.13.3"
futures-channel = "0.3.30"
futures-core = "0.3.30"
futures-util = "0.3.30"
nispor = "1.2.21"
tower = { version = "0.5.1", features = ["util"] }
hyper-util = "0.1.9"
[build-dependencies]
chrono = { version = "0.4.38", default-features = false, features = ["clock"] }
tonic-build = "0.11"
tonic-build = "0.12.3"
[dev-dependencies]
once_cell = "1.20.1"

View File

@@ -36,7 +36,7 @@ fn main() {
.out_dir(PathBuf::from("src/proto-build"));
builder
.compile(&[Path::new("src/proto/proxy.proto")], &[Path::new("proto")])
.compile_protos(&[Path::new("src/proto/proxy.proto")], &[Path::new("proto")])
.unwrap_or_else(|e| panic!("Failed at builder: {:?}", e.to_string()));
// Generate the default 'cargo:' instruction output

View File

@@ -6,13 +6,14 @@ use std::convert::TryFrom;
use std::error::Error;
use g_rpc::netavark_proxy_client::NetavarkProxyClient;
use hyper_util::rt::TokioIo;
use log::debug;
use std::fs::File;
use std::net::AddrParseError;
use std::net::Ipv4Addr;
use std::str::FromStr;
use tokio::net::UnixStream;
use tonic::transport::{Channel, Endpoint, Uri};
use tonic::transport::{Channel, Endpoint};
use tonic::Request;
use tower::service_fn;
@@ -183,12 +184,12 @@ impl NetworkConfig {
// We know this is safe and if it ever fails test will catch it
let endpoint = Endpoint::try_from("http://[::1]").unwrap();
debug!("using uds path: {}", &p);
let path = p.clone();
let channel = endpoint
.connect_with_connector(service_fn(move |_: Uri| {
let pp = p.clone();
debug!("using uds path: {}", pp);
UnixStream::connect(pp)
.connect_with_connector(service_fn(move |_| {
let path = p.clone();
async{Ok::<_, std::io::Error>(TokioIo::new(UnixStream::connect(path).await?))}
}))
.await
.map_err(|e| {
@@ -201,7 +202,7 @@ impl NetworkConfig {
.and_then(|e| e.downcast_ref::<std::io::Error>())
.and_then(|e| {
if e.kind() == std::io::ErrorKind::NotFound || e.kind() == std::io::ErrorKind::ConnectionRefused {
Some(format!("socket \"{path}\": {e}, is the netavark-dhcp-proxy.socket unit enabled?"))
Some(format!("socket \"{}\": {e}, is the netavark-dhcp-proxy.socket unit enabled?", &path))
} else {
None
}