From 2cc68c067f0a3e3ef53200841f02584112778784 Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Tue, 23 Jan 2024 15:28:55 -0800 Subject: [PATCH] deps: use usptream `str0m` (#3365) All major upstream contributions to `str0m` have been merged, meaning we can now discontinue the dependency on the fork. --- .github/workflows/_rust.yml | 16 ++++++++-------- rust/Cargo.lock | 4 ++-- rust/Cargo.toml | 4 ++-- rust/connlib/connection/src/pool.rs | 24 ++++++++++++------------ 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/.github/workflows/_rust.yml b/.github/workflows/_rust.yml index 4a0039881..3fb7461bf 100644 --- a/.github/workflows/_rust.yml +++ b/.github/workflows/_rust.yml @@ -25,9 +25,9 @@ jobs: - runs-on: ubuntu-22.04 packages: # Intentionally blank as a package catch-all linter - runs-on: macos-13 - packages: -p connlib-client-apple + packages: -p connlib-client-apple -p firezone-connection - runs-on: windows-2022 - packages: -p connlib-client-shared -p firezone-windows-client + packages: -p connlib-client-shared -p firezone-windows-client -p firezone-connection runs-on: ${{ matrix.runs-on }} steps: - uses: actions/checkout@v4 @@ -47,17 +47,17 @@ jobs: # TODO: https://github.com/rust-lang/cargo/issues/5220 include: - runs-on: ubuntu-20.04 - packages: -p firezone-linux-client -p firezone-gateway -p connlib-client-android + packages: -p firezone-linux-client -p firezone-gateway -p connlib-client-android -p firezone-connection - runs-on: ubuntu-22.04 - packages: -p firezone-linux-client -p firezone-gateway -p connlib-client-android + packages: -p firezone-linux-client -p firezone-gateway -p connlib-client-android -p firezone-connection - runs-on: macos-12 - packages: -p connlib-client-apple + packages: -p connlib-client-apple -p firezone-connection - runs-on: macos-13 - packages: -p connlib-client-apple + packages: -p connlib-client-apple -p firezone-connection - runs-on: windows-2019 - packages: -p firezone-windows-client -p connlib-client-shared + packages: -p firezone-windows-client -p connlib-client-shared -p firezone-connection - runs-on: windows-2022 - packages: -p firezone-windows-client -p connlib-client-shared + packages: -p firezone-windows-client -p connlib-client-shared -p firezone-connection runs-on: ${{ matrix.runs-on }} steps: - uses: actions/checkout@v4 diff --git a/rust/Cargo.lock b/rust/Cargo.lock index d9de14772..c6c217ad1 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -6076,13 +6076,13 @@ checksum = "9e08d8363704e6c71fc928674353e6b7c23dcea9d82d7012c8faf2a3a025f8d0" [[package]] name = "str0m" version = "0.4.1" -source = "git+https://github.com/thomaseizinger/str0m?branch=main#12575cab1c8c466cbf1e05b0b7459136eeaba8ed" +source = "git+https://github.com/algesten/str0m?branch=main#e6fa6808dfcdac23e0d1f61d405f938035e4eaf9" dependencies = [ "combine", "crc", + "fastrand 2.0.1", "hmac", "once_cell", - "rand 0.8.5", "sctp-proto", "serde", "sha-1", diff --git a/rust/Cargo.toml b/rust/Cargo.toml index 6edb90abf..178315980 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -27,7 +27,7 @@ tracing-subscriber = { version = "0.3.17", features = ["parking_lot"] } secrecy = "0.8" hickory-resolver = { version = "0.24", features = ["tokio-runtime"] } webrtc = "0.9" -str0m = "0.4" +str0m = { version = "0.4", default-features = false } futures-bounded = "0.2.1" domain = { version = "0.9", features = ["serde"] } dns-lookup = "2.0" @@ -48,7 +48,7 @@ phoenix-channel = { path = "phoenix-channel"} [patch.crates-io] boringtun = { git = "https://github.com/cloudflare/boringtun", branch = "master" } # Contains unreleased patches we need (bump of x25519-dalek) webrtc = { git = "https://github.com/firezone/webrtc", branch = "expose-new-endpoint" } -str0m = { git = "https://github.com/thomaseizinger/str0m", branch = "main" } +str0m = { git = "https://github.com/algesten/str0m", branch = "main" } [profile.release] strip = true diff --git a/rust/connlib/connection/src/pool.rs b/rust/connlib/connection/src/pool.rs index 50be51d94..8f8393266 100644 --- a/rust/connlib/connection/src/pool.rs +++ b/rust/connlib/connection/src/pool.rs @@ -15,9 +15,9 @@ use std::{ net::SocketAddr, sync::Arc, }; -use str0m::ice::{IceAgent, IceAgentEvent, IceCreds}; -use str0m::net::{Protocol, Receive}; -use str0m::{Candidate, IceConnectionState, StunMessage}; +use str0m::ice::{IceAgent, IceAgentEvent, IceCreds, StunMessage, StunPacket}; +use str0m::net::Protocol; +use str0m::{Candidate, IceConnectionState}; use crate::index::IndexLfsr; use crate::stun_binding::StunBinding; @@ -147,17 +147,17 @@ where } // Next: If we can parse the message as a STUN message, cycle through all agents to check which one it is for. - if let Ok(stun_message) = StunMessage::parse(packet) { + if let Ok(message) = StunMessage::parse(packet) { for (_, conn) in self.initial_connections.iter_mut() { // TODO: `accepts_message` cannot demultiplexing multiple connections until https://github.com/algesten/str0m/pull/418 is merged. - if conn.agent.accepts_message(&stun_message) { - conn.agent.handle_receive( + if conn.agent.accepts_message(&message) { + conn.agent.handle_packet( now, - Receive { + StunPacket { proto: Protocol::Udp, source: from, destination: local, - contents: str0m::net::DatagramRecv::Stun(stun_message), + message, }, ); return Ok(None); @@ -166,14 +166,14 @@ where for (_, conn) in self.negotiated_connections.iter_mut() { // Would the ICE agent of this connection like to handle the packet? - if conn.agent.accepts_message(&stun_message) { - conn.agent.handle_receive( + if conn.agent.accepts_message(&message) { + conn.agent.handle_packet( now, - Receive { + StunPacket { proto: Protocol::Udp, source: from, destination: local, - contents: str0m::net::DatagramRecv::Stun(stun_message), + message, }, ); return Ok(None);