[ENG-1399] Upgrade Rust workspace + IPv6 mDNS (#1729)

Upgrade Rust workspace + IPv6 mDNS
This commit is contained in:
Oscar Beaumont 2023-11-04 21:20:22 +11:00 committed by GitHub
parent 395e0ee3da
commit 6941912891
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 817 additions and 633 deletions

1311
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -49,14 +49,14 @@ tauri-specta = { version = "1.0.2" }
swift-rs = { version = "1.0.6" }
tokio = { version = "1.32.0" }
uuid = { version = "1.4.1", features = ["v4", "serde"] }
tokio = { version = "1.33.0" }
uuid = { version = "1.5.0", features = ["v4", "serde"] }
serde = { version = "1.0" }
serde_json = { version = "1.0" }
[patch.crates-io]
# Proper IOS Support
if-watch = { git = "https://github.com/oscartbeaumont/if-watch.git", rev = "f804ad9b2005e4e760732a708aa95b4bfb376ddf" }
if-watch = { git = "https://github.com/oscartbeaumont/if-watch.git", rev = "f732786057e57250e863a9ea0b1874e4cc9907c2" }
# Beta features
specta = { git = "https://github.com/oscartbeaumont/specta", rev = "4bc6e46fc8747cd8d8a07597c1fe13c52aa16a41" }

View file

@ -6,8 +6,8 @@ repository = { workspace = true }
edition = { workspace = true }
[dependencies]
indoc = "2.0.3"
clap = { version = "4.4.2", features = ["derive"] }
indoc = "2.0.4"
clap = { version = "4.4.7", features = ["derive"] }
anyhow = "1.0.75"
hex = "0.4.3"
sd-crypto = { path = "../../crates/crypto" }

View file

@ -6,7 +6,7 @@ repository = { workspace = true }
edition = { workspace = true }
[dependencies]
thiserror = "1.0.48"
thiserror = "1.0.50"
normpath = "1.1.1"
libc = "0.2"

View file

@ -30,12 +30,12 @@ sd-core = { path = "../../../core", features = [
] }
tokio = { workspace = true, features = ["sync"] }
tracing = { workspace = true }
serde = "1.0.188"
serde = "1.0.190"
http = "0.2.9"
opener = { version = "0.6.1", features = ["reveal"] }
specta = { workspace = true }
tauri-specta = { workspace = true, features = ["typescript"] }
uuid = { version = "1.4.1", features = ["serde"] }
uuid = { version = "1.5.0", features = ["serde"] }
futures = "0.3"
axum = { version = "0.6.20", features = ["headers", "query"] }
rand = "0.8.5"

View file

@ -14,7 +14,7 @@ sd-core = { path = "../../../../../core", features = [
rspc = { workspace = true }
serde_json = { workspace = true }
tokio = { workspace = true }
futures = "0.3.28"
futures = "0.3.29"
tracing = { workspace = true }
futures-channel = "0.3.28"
futures-channel = "0.3.29"
futures-locks = "0.7.1"

View file

@ -57,29 +57,29 @@ tokio = { workspace = true, features = [
"process",
] }
serde = { version = "1.0", features = ["derive"] }
chrono = { version = "0.4.30", features = ["serde"] }
chrono = { version = "0.4.31", features = ["serde"] }
serde_json = { workspace = true }
futures = "0.3"
rmp-serde = "^1.1.2"
rmpv = "^1.0.1"
blake3 = "1.4.1"
blake3 = "1.5.0"
hostname = "0.3.1"
uuid = { workspace = true }
sysinfo = "0.29.10"
thiserror = "1.0.48"
async-trait = "^0.1.73"
thiserror = "1.0.50"
async-trait = "^0.1.74"
image = "0.24.7"
webp = "0.2.6"
tracing = { workspace = true }
tracing-subscriber = { workspace = true, features = ["env-filter"] }
async-stream = "0.3.5"
once_cell = "1.18.0"
ctor = "0.2.4"
ctor = "0.2.5"
globset = { version = "^0.4.13", features = ["serde1"] }
itertools = "^0.11.0"
http-range = "0.1.5"
mini-moka = "0.10.2"
serde_with = "3.3.0"
serde_with = "3.4.0"
notify = { version = "=5.2.0", default-features = false, features = [
"macos_fsevent",
], optional = true }
@ -89,21 +89,21 @@ normpath = { version = "1.1.1", features = ["localization"] }
tracing-appender = { workspace = true }
strum = { version = "0.25", features = ["derive"] }
strum_macros = "0.25"
regex = "1.9.5"
regex = "1.10.2"
int-enum = "0.5.0"
tokio-stream = { version = "0.1.14", features = ["fs"] }
futures-concurrency = "7.4.3"
async-channel = "2.0.0"
tokio-util = { version = "0.7.8", features = ["io"] }
tokio-util = { version = "0.7.10", features = ["io"] }
slotmap = "1.0.6"
flate2 = "1.0.27"
flate2 = "1.0.28"
tar = "0.4.40"
tempfile = "^3.8.0"
tempfile = "^3.8.1"
axum = "0.6.20"
http-body = "0.4.5"
pin-project-lite = "0.2.13"
bytes = "1.5.0"
reqwest = { version = "0.11.20", features = ["json", "native-tls-vendored"] }
reqwest = { version = "0.11.22", features = ["json", "native-tls-vendored"] }
directories = "5.0.1"
async-recursion = "1.0.5"
@ -119,7 +119,7 @@ features = ["vendored"]
plist = "1"
[target.'cfg(windows)'.dependencies.winapi-util]
version = "0.1.5"
version = "0.1.6"
[dev-dependencies]
tracing-test = "^0.2.4"

View file

@ -8,9 +8,9 @@ repository = { workspace = true }
edition = { workspace = true }
[dependencies]
reqwest = { version = "0.11.20", features = ["blocking"] }
clap = { version = "4.4.2", features = ["derive"] }
reqwest = { version = "0.11.22", features = ["blocking"] }
clap = { version = "4.4.7", features = ["derive"] }
anyhow = "1.0.75"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
cargo_metadata = "0.18.0"
cargo_metadata = "0.18.1"

View file

@ -13,10 +13,10 @@ edition = { workspace = true }
ffmpeg-sys-next = "6.0.1"
tracing = { workspace = true }
thiserror = "1.0.48"
thiserror = "1.0.50"
webp = "0.2.6"
tokio = { workspace = true, features = ["fs", "rt"] }
[dev-dependencies]
tempfile = "3.8.0"
tempfile = "3.8.1"
tokio = { workspace = true, features = ["fs", "rt", "macros"] }

View file

@ -10,7 +10,7 @@ repository = { workspace = true }
edition = { workspace = true }
[dependencies]
serde = { version = "1.0.188", features = ["derive"] }
serde = { version = "1.0.190", features = ["derive"] }
serde_json = { workspace = true }
strum = { version = "0.25", features = ["derive"] }
tokio = { workspace = true, features = ["fs", "rt", "io-util"] }

View file

@ -14,7 +14,7 @@ heif = ["dep:libheif-rs", "dep:libheif-sys"]
[dependencies]
image = "0.24.7"
thiserror = "1.0.49"
thiserror = "1.0.50"
resvg = "0.36.0"
rspc = { workspace = true, optional = true } # error conversion
specta = { workspace = true, optional = true }
@ -30,4 +30,4 @@ tracing = { workspace = true }
# this broke builds as we build our own liibheif, so i disabled their default features
libheif-rs = { version = "0.22.0", default-features = false, optional = true }
libheif-sys = { version = "2.0.0", default-features = false, optional = true }
pdfium-render = { version = "0.8.8", features = ["image"] }
pdfium-render = { version = "0.8.14", features = ["image"] }

View file

@ -6,9 +6,9 @@ edition = "2021"
[dependencies]
kamadak-exif = "0.5.5"
thiserror = "1.0.49"
thiserror = "1.0.50"
image-rs = { package = "image", version = "0.24.7" }
serde = { version = "1.0.188", features = ["derive"] }
serde = { version = "1.0.190", features = ["derive"] }
serde_json = { workspace = true }
specta = { workspace = true, features = ["chrono"] }
chrono = { version = "0.4.31", features = ["serde"] }

View file

@ -21,30 +21,30 @@ tokio = { workspace = true, features = [
"io-util",
"fs",
] }
libp2p = { version = "0.52.3", features = ["tokio", "serde"] }
libp2p-quic = { version = "0.9.2", features = ["tokio"] }
if-watch = { version = "=3.0.1", features = [
libp2p = { version = "0.52.4", features = ["tokio", "serde"] }
libp2p-quic = { version = "0.9.3", features = ["tokio"] }
if-watch = { version = "=3.1.0", features = [
"tokio",
] } # Override the features of if-watch which is used by libp2p-quic
mdns-sd = "0.7.4"
thiserror = "1.0.48"
mdns-sd = "0.9.3"
thiserror = "1.0.50"
tracing = { workspace = true }
serde = { version = "1.0.188", features = ["derive"] } # TODO: Optional or remove feature
serde = { version = "1.0.190", features = [
"derive",
] } # TODO: Optional or remove feature
specta = { workspace = true }
flume = "0.10.0" # Must match version used by `mdns-sd`
tokio-util = { version = "0.7.8", features = ["compat"] }
tokio-util = { version = "0.7.10", features = ["compat"] }
ed25519-dalek = { version = "2.0.0", features = [] }
rand_core = { version = "0.6.4" }
uuid = "1.4.1"
uuid = "1.5.0"
streamunordered = "0.5.3"
futures-core = "0.3.29"
tokio-stream = { version = "0.1.14", features = ["sync"] }
pin-project-lite = "0.2.13"
base64 = "0.21.5"
# chacha20poly1305 = "0.10.1"
# rand = "0.8.5"
[dev-dependencies]
tokio = { workspace = true, features = ["rt-multi-thread"] }
tracing-subscriber = { workspace = true, features = ["env-filter"] }
uuid = { version = "1.4.1", features = ["v4"] }
uuid = { version = "1.5.0", features = ["v4"] }

View file

@ -1,6 +1,6 @@
use std::{
collections::HashMap,
net::{IpAddr, SocketAddr},
net::SocketAddr,
pin::Pin,
str::FromStr,
sync::PoisonError,
@ -64,13 +64,6 @@ impl Mdns {
let mut ports_to_service = HashMap::new();
for addr in listen_addrs.iter() {
let addr = match addr {
SocketAddr::V4(addr) => addr,
// TODO: Our mdns library doesn't support Ipv6. This code has the infra to support it so once this issue is fixed upstream we can just flip it on.
// Refer to issue: https://github.com/keepsimple1/mdns-sd/issues/61
SocketAddr::V6(_) => continue,
};
ports_to_service
.entry(addr.port())
.or_insert_with(Vec::new)
@ -254,7 +247,7 @@ impl Mdns {
addresses: info
.get_addresses()
.iter()
.map(|addr| SocketAddr::new(IpAddr::V4(*addr), info.get_port()))
.map(|addr| SocketAddr::new(*addr, info.get_port()))
.collect(),
},
);

View file

@ -1,5 +1,6 @@
use std::{
collections::{HashMap, HashSet},
convert::Infallible,
fmt,
net::SocketAddr,
sync::{
@ -10,8 +11,7 @@ use std::{
use libp2p::{
core::{muxing::StreamMuxerBox, transport::ListenerId, ConnectedPoint},
swarm::SwarmBuilder,
PeerId, Transport,
PeerId, SwarmBuilder, Transport,
};
use serde::{Deserialize, Serialize};
use specta::Type;
@ -94,15 +94,16 @@ impl Manager {
event_stream_tx2,
});
let mut swarm = SwarmBuilder::with_tokio_executor(
libp2p_quic::GenTransport::<libp2p_quic::tokio::Provider>::new(
libp2p_quic::Config::new(&keypair.inner()),
)
.map(|(p, c), _| (p, StreamMuxerBox::new(c)))
.boxed(),
SpaceTime::new(this.clone()),
keypair.peer_id(),
)
let mut swarm = ok(ok(SwarmBuilder::with_existing_identity(keypair.inner())
.with_tokio()
.with_other_transport(|keypair| {
libp2p_quic::GenTransport::<libp2p_quic::tokio::Provider>::new(
libp2p_quic::Config::new(keypair),
)
.map(|(p, c), _| (p, StreamMuxerBox::new(c)))
.boxed()
}))
.with_behaviour(|_| SpaceTime::new(this.clone())))
.build();
ManagerStream::refresh_listeners(
@ -280,6 +281,8 @@ pub enum ManagerError {
InvalidAppName,
#[error("error with mdns discovery: {0}")]
Mdns(#[from] mdns_sd::Error),
// #[error("todo")]
// Manager(#[from] ManagerError),
}
/// The configuration for the P2P Manager
@ -302,3 +305,10 @@ impl Default for ManagerConfig {
}
}
}
fn ok<T>(v: Result<T, Infallible>) -> T {
match v {
Ok(v) => v,
Err(_) => unreachable!(),
}
}

View file

@ -28,6 +28,7 @@ const SUBSTREAM_TIMEOUT: Duration = Duration::from_secs(10); // TODO: Tune value
pub struct SpaceTimeConnection {
peer_id: PeerId,
manager: Arc<Manager>,
#[allow(deprecated)]
pending_events: VecDeque<
ConnectionHandlerEvent<
OutboundProtocol,
@ -91,6 +92,7 @@ impl ConnectionHandler for SpaceTimeConnection {
KeepAlive::Yes // TODO: Make this work how the old one did with storing it on `self` and updating on events
}
#[allow(deprecated)]
fn poll(
&mut self,
_cx: &mut Context<'_>,

View file

@ -8,5 +8,5 @@ edition = { workspace = true }
[dependencies]
nom = "7.1.3"
prisma-client-rust-sdk = { workspace = true }
serde = { version = "1.0.188", features = ["derive"] }
thiserror = "1.0.48"
serde = { version = "1.0.190", features = ["derive"] }
thiserror = "1.0.50"

View file

@ -7,8 +7,8 @@ edition = { workspace = true }
[dependencies]
specta = { workspace = true, features = ["uuid", "uhlc"] }
serde = "1.0.188"
serde = "1.0.190"
serde_json = { workspace = true }
uhlc = "=0.5.2"
uuid = { version = "1.4.1", features = ["serde", "v4"] }
uuid = { version = "1.5.0", features = ["serde", "v4"] }
prisma-client-rust = { workspace = true }