diff --git a/.github/workflows/core.yml b/.github/workflows/core.yml index 4e202bb5..fd55bf72 100644 --- a/.github/workflows/core.yml +++ b/.github/workflows/core.yml @@ -186,7 +186,7 @@ jobs: fi if [[ $OS =~ ^ubuntu.*$ && $TARGET =~ ^mips.*$ ]]; then - cargo +nightly-2025-09-01 build -r --target $TARGET -Z build-std=std,panic_abort --package=easytier --features=jemalloc + cargo +nightly-2026-02-02 build -r --target $TARGET -Z build-std=std,panic_abort --package=easytier --features=jemalloc else if [[ $OS =~ ^windows.*$ ]]; then SUFFIX=.exe @@ -228,8 +228,8 @@ jobs: rustup set auto-self-update disable - rustup install 1.89 - rustup default 1.89 + rustup install 1.93 + rustup default 1.93 export CC=clang export CXX=clang++ diff --git a/.github/workflows/install_rust.sh b/.github/workflows/install_rust.sh index 778a78b7..0074e4ac 100644 --- a/.github/workflows/install_rust.sh +++ b/.github/workflows/install_rust.sh @@ -31,8 +31,8 @@ fi # see https://github.com/rust-lang/rustup/issues/3709 rustup set auto-self-update disable -rustup install 1.89 -rustup default 1.89 +rustup install 1.93 +rustup default 1.93 # mips/mipsel cannot add target from rustup, need compile by ourselves if [[ $OS =~ ^ubuntu.*$ && $TARGET =~ ^mips.*$ ]]; then @@ -44,8 +44,8 @@ if [[ $OS =~ ^ubuntu.*$ && $TARGET =~ ^mips.*$ ]]; then ar x libgcc.a _ctzsi2.o _clz.o _bswapsi2.o ar rcs libctz.a _ctzsi2.o _clz.o _bswapsi2.o - rustup toolchain install nightly-2025-09-01-x86_64-unknown-linux-gnu - rustup component add rust-src --toolchain nightly-2025-09-01-x86_64-unknown-linux-gnu + rustup toolchain install nightly-2026-02-02-x86_64-unknown-linux-gnu + rustup component add rust-src --toolchain nightly-2026-02-02-x86_64-unknown-linux-gnu # https://github.com/rust-lang/rust/issues/128808 # remove it after Cargo or rustc fix this. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d4cb38a2..bc8ebe6d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -26,7 +26,7 @@ Thank you for your interest in contributing to EasyTier! This document provides #### Required Tools - Node.js v21 or higher - pnpm v9 or higher -- Rust toolchain (version 1.89) +- Rust toolchain (version 1.93) - LLVM and Clang - Protoc (Protocol Buffers compiler) @@ -79,8 +79,8 @@ sudo apt install -y bridge-utils 2. Install dependencies: ```bash # Install Rust toolchain - rustup install 1.89 - rustup default 1.89 + rustup install 1.93 + rustup default 1.93 # Install project dependencies pnpm -r install diff --git a/CONTRIBUTING_zh.md b/CONTRIBUTING_zh.md index 7e663da6..e91d677c 100644 --- a/CONTRIBUTING_zh.md +++ b/CONTRIBUTING_zh.md @@ -34,7 +34,7 @@ #### 必需工具 - Node.js v21 或更高版本 - pnpm v9 或更高版本 -- Rust 工具链(版本 1.89) +- Rust 工具链(版本 1.93) - LLVM 和 Clang - Protoc(Protocol Buffers 编译器) @@ -87,8 +87,8 @@ sudo apt install -y bridge-utils 2. 安装依赖: ```bash # 安装 Rust 工具链 - rustup install 1.89 - rustup default 1.89 + rustup install 1.93 + rustup default 1.93 # 安装项目依赖 pnpm -r install diff --git a/easytier-rpc-build/Cargo.toml b/easytier-rpc-build/Cargo.toml index 3ed328ee..9c65ec44 100644 --- a/easytier-rpc-build/Cargo.toml +++ b/easytier-rpc-build/Cargo.toml @@ -8,7 +8,7 @@ repository = "https://github.com/EasyTier/EasyTier" authors = ["kkrainbow"] keywords = ["vpn", "p2p", "network", "easytier"] categories = ["network-programming", "command-line-utilities"] -rust-version = "1.89.0" +rust-version = "1.93.0" license-file = "LICENSE" readme = "README.md" diff --git a/easytier/Cargo.toml b/easytier/Cargo.toml index 8a1acdad..b712b9c0 100644 --- a/easytier/Cargo.toml +++ b/easytier/Cargo.toml @@ -8,7 +8,7 @@ edition = "2021" authors = ["kkrainbow"] keywords = ["vpn", "p2p", "network", "easytier"] categories = ["network-programming", "command-line-utilities"] -rust-version = "1.89.0" +rust-version = "1.93.0" license-file = "LICENSE" readme = "README.md" diff --git a/easytier/src/common/config.rs b/easytier/src/common/config.rs index e6f07fd2..8689490a 100644 --- a/easytier/src/common/config.rs +++ b/easytier/src/common/config.rs @@ -636,12 +636,13 @@ impl ConfigLoader for TomlConfigLoader { fn get_id(&self) -> uuid::Uuid { let mut locked_config = self.config.lock().unwrap(); - if locked_config.instance_id.is_none() { - let id = uuid::Uuid::new_v4(); - locked_config.instance_id = Some(id); - id - } else { - *locked_config.instance_id.as_ref().unwrap() + match locked_config.instance_id { + Some(id) => id, + None => { + let id = uuid::Uuid::new_v4(); + locked_config.instance_id = Some(id); + id + } } } diff --git a/easytier/src/common/stun.rs b/easytier/src/common/stun.rs index 2829f282..cfe5ec0b 100644 --- a/easytier/src/common/stun.rs +++ b/easytier/src/common/stun.rs @@ -484,18 +484,14 @@ impl StunNatTypeDetectResult { if self.public_ips().len() != 1 || self.usable_stun_resp_count() <= 1 || self.max_port() - self.min_port() > 15 - || self.extra_bind_test.is_none() - || self - .extra_bind_test - .as_ref() - .unwrap() - .mapped_socket_addr - .is_none() { NatType::Symmetric - } else { - let extra_bind_test = self.extra_bind_test.as_ref().unwrap(); - let extra_port = extra_bind_test.mapped_socket_addr.unwrap().port(); + } else if let Some(extra_bind_mapped) = self + .extra_bind_test + .as_ref() + .and_then(|extra| extra.mapped_socket_addr) + { + let extra_port = extra_bind_mapped.port(); let max_port_diff = extra_port.saturating_sub(self.max_port()); let min_port_diff = self.min_port().saturating_sub(extra_port); @@ -506,6 +502,8 @@ impl StunNatTypeDetectResult { } else { NatType::Symmetric } + } else { + NatType::Symmetric } } else { NatType::Unknown diff --git a/easytier/src/peers/peer_manager.rs b/easytier/src/peers/peer_manager.rs index 442312d9..59672db9 100644 --- a/easytier/src/peers/peer_manager.rs +++ b/easytier/src/peers/peer_manager.rs @@ -1377,12 +1377,9 @@ impl PeerManager { .config .get_proxy_cidrs() .into_iter() - .map(|x| { - if x.mapped_cidr.is_none() { - x.cidr.to_string() - } else { - format!("{}->{}", x.cidr, x.mapped_cidr.unwrap()) - } + .map(|x| match x.mapped_cidr { + None => x.cidr.to_string(), + Some(mapped) => format!("{}->{}", x.cidr, mapped), }) .collect(), hostname: self.global_ctx.get_hostname(), diff --git a/easytier/src/peers/peer_ospf_route.rs b/easytier/src/peers/peer_ospf_route.rs index 2b8f3316..bdefcbf3 100644 --- a/easytier/src/peers/peer_ospf_route.rs +++ b/easytier/src/peers/peer_ospf_route.rs @@ -2214,54 +2214,55 @@ impl PeerRouteServiceImpl { ret, sync_route_info_req, session, self.global_ctx.network, next_last_sync_succ_timestamp ); - if let Err(e) = &ret { - tracing::error!( - ?ret, - ?my_peer_id, - ?dst_peer_id, - ?e, - "sync_route_info failed" - ); - session - .need_sync_initiator_info - .store(true, Ordering::Relaxed); - } else { - let resp = ret.as_ref().unwrap(); - if resp.error.is_some() { - let err = resp.error.unwrap(); - if err == Error::DuplicatePeerId as i32 { - if !self.global_ctx.get_feature_flags().is_public_server { - panic!("duplicate peer id"); + match ret.as_ref() { + Err(e) => { + tracing::error!( + ?ret, + ?my_peer_id, + ?dst_peer_id, + ?e, + "sync_route_info failed" + ); + session + .need_sync_initiator_info + .store(true, Ordering::Relaxed); + } + Ok(resp) => { + if let Some(err) = resp.error { + if err == Error::DuplicatePeerId as i32 { + if !self.global_ctx.get_feature_flags().is_public_server { + panic!("duplicate peer id"); + } + } else { + tracing::error!(?ret, ?my_peer_id, ?dst_peer_id, "sync_route_info failed"); + session + .need_sync_initiator_info + .store(true, Ordering::Relaxed); } } else { - tracing::error!(?ret, ?my_peer_id, ?dst_peer_id, "sync_route_info failed"); + session.rpc_tx_count.fetch_add(1, Ordering::Relaxed); + session - .need_sync_initiator_info - .store(true, Ordering::Relaxed); + .dst_is_initiator + .store(resp.is_initiator, Ordering::Relaxed); + + session.update_dst_session_id(resp.session_id); + + if let Some(peer_infos) = &peer_infos { + session.update_dst_saved_peer_info_version(peer_infos, dst_peer_id); + } + + if let Some(conn_info) = &conn_info { + session.update_dst_saved_conn_info_version(conn_info, dst_peer_id); + } + + if let Some(foreign_network) = &foreign_network { + session + .update_dst_saved_foreign_network_version(foreign_network, dst_peer_id); + } + + session.update_last_sync_succ_timestamp(next_last_sync_succ_timestamp); } - } else { - session.rpc_tx_count.fetch_add(1, Ordering::Relaxed); - - session - .dst_is_initiator - .store(resp.is_initiator, Ordering::Relaxed); - - session.update_dst_session_id(resp.session_id); - - if let Some(peer_infos) = &peer_infos { - session.update_dst_saved_peer_info_version(peer_infos, dst_peer_id); - } - - // Update session saved versions based on the connection info format used - if let Some(conn_info) = &conn_info { - session.update_dst_saved_conn_info_version(conn_info, dst_peer_id); - } - - if let Some(foreign_network) = &foreign_network { - session.update_dst_saved_foreign_network_version(foreign_network, dst_peer_id); - } - - session.update_last_sync_succ_timestamp(next_last_sync_succ_timestamp); } } false diff --git a/flake.nix b/flake.nix index 5964a37c..8c0ea92a 100644 --- a/flake.nix +++ b/flake.nix @@ -29,7 +29,7 @@ allowUnfree = true; }; }; - rustVersion = "1.89.0"; + rustVersion = "1.93.0"; makeRust = features: let diff --git a/tauri-plugin-vpnservice/src/models.rs b/tauri-plugin-vpnservice/src/models.rs index 3a09abd1..71f0e45b 100644 --- a/tauri-plugin-vpnservice/src/models.rs +++ b/tauri-plugin-vpnservice/src/models.rs @@ -1,3 +1,5 @@ +#![allow(dead_code)] + use serde::{Deserialize, Serialize}; #[derive(Debug, Deserialize, Serialize)]