From 39b056c87a5c9c3d1419c24d34cc4bc05fbf2005 Mon Sep 17 00:00:00 2001 From: KKRainbow <443152178@qq.com> Date: Sun, 28 Dec 2025 23:19:30 +0800 Subject: [PATCH] bump version to v2.5.0 (#1715) --- .github/workflows/docker.yml | 2 +- .github/workflows/release.yml | 2 +- Cargo.lock | 6 +-- README.md | 6 +-- README_CN.md | 6 +-- easytier-contrib/easytier-magisk/module.prop | 2 +- easytier-gui/package.json | 2 +- easytier-gui/src-tauri/Cargo.toml | 2 +- easytier-gui/src-tauri/tauri.conf.json | 2 +- easytier-web/Cargo.toml | 2 +- easytier/Cargo.toml | 2 +- easytier/src/common/stun.rs | 11 ++--- easytier/src/connector/tcp_hole_punch.rs | 40 ++++--------------- .../src/tunnel/fake_tcp/netfilter/pnet.rs | 7 +++- 14 files changed, 34 insertions(+), 58 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index ecc58c73..0e1c616d 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -11,7 +11,7 @@ on: image_tag: description: 'Tag for this image build' type: string - default: 'v2.4.5' + default: 'v2.5.0' required: true mark_latest: description: 'Mark this image as latest' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cded4cf4..f59be4c0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,7 +18,7 @@ on: version: description: 'Version for this release' type: string - default: 'v2.4.5' + default: 'v2.5.0' required: true make_latest: description: 'Mark this release as latest' diff --git a/Cargo.lock b/Cargo.lock index 05e30d17..e81c9eb4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2078,7 +2078,7 @@ checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125" [[package]] name = "easytier" -version = "2.4.5" +version = "2.5.0" dependencies = [ "aes-gcm", "anyhow", @@ -2234,7 +2234,7 @@ dependencies = [ [[package]] name = "easytier-gui" -version = "2.4.5" +version = "2.5.0" dependencies = [ "anyhow", "async-trait", @@ -2323,7 +2323,7 @@ dependencies = [ [[package]] name = "easytier-web" -version = "2.4.5" +version = "2.5.0" dependencies = [ "anyhow", "async-trait", diff --git a/README.md b/README.md index 2828d9c4..1138966b 100644 --- a/README.md +++ b/README.md @@ -105,9 +105,9 @@ After successful execution, you can check the network status using `easytier-cli ```text | ipv4 | hostname | cost | lat_ms | loss_rate | rx_bytes | tx_bytes | tunnel_proto | nat_type | id | version | | ------------ | -------------- | ----- | ------ | --------- | -------- | -------- | ------------ | -------- | ---------- | --------------- | -| 10.126.126.1 | abc-1 | Local | * | * | * | * | udp | FullCone | 439804259 | 2.4.5-70e69a38~ | -| 10.126.126.2 | abc-2 | p2p | 3.452 | 0 | 17.33 kB | 20.42 kB | udp | FullCone | 390879727 | 2.4.5-70e69a38~ | -| | PublicServer_a | p2p | 27.796 | 0.000 | 50.01 kB | 67.46 kB | tcp | Unknown | 3771642457 | 2.4.5-70e69a38~ | +| 10.126.126.1 | abc-1 | Local | * | * | * | * | udp | FullCone | 439804259 | 2.5.0-70e69a38~ | +| 10.126.126.2 | abc-2 | p2p | 3.452 | 0 | 17.33 kB | 20.42 kB | udp | FullCone | 390879727 | 2.5.0-70e69a38~ | +| | PublicServer_a | p2p | 27.796 | 0.000 | 50.01 kB | 67.46 kB | tcp | Unknown | 3771642457 | 2.5.0-70e69a38~ | ``` You can test connectivity between nodes: diff --git a/README_CN.md b/README_CN.md index 3f25f72b..3b617bcc 100644 --- a/README_CN.md +++ b/README_CN.md @@ -106,9 +106,9 @@ sudo easytier-core -d --network-name abc --network-secret abc -p tcp://public.ea ```text | ipv4 | hostname | cost | lat_ms | loss_rate | rx_bytes | tx_bytes | tunnel_proto | nat_type | id | version | | ------------ | -------------- | ----- | ------ | --------- | -------- | -------- | ------------ | -------- | ---------- | --------------- | -| 10.126.126.1 | abc-1 | Local | * | * | * | * | udp | FullCone | 439804259 | 2.4.5-70e69a38~ | -| 10.126.126.2 | abc-2 | p2p | 3.452 | 0 | 17.33 kB | 20.42 kB | udp | FullCone | 390879727 | 2.4.5-70e69a38~ | -| | PublicServer_a | p2p | 27.796 | 0.000 | 50.01 kB | 67.46 kB | tcp | Unknown | 3771642457 | 2.4.5-70e69a38~ | +| 10.126.126.1 | abc-1 | Local | * | * | * | * | udp | FullCone | 439804259 | 2.5.0-70e69a38~ | +| 10.126.126.2 | abc-2 | p2p | 3.452 | 0 | 17.33 kB | 20.42 kB | udp | FullCone | 390879727 | 2.5.0-70e69a38~ | +| | PublicServer_a | p2p | 27.796 | 0.000 | 50.01 kB | 67.46 kB | tcp | Unknown | 3771642457 | 2.5.0-70e69a38~ | ``` 您可以测试节点之间的连通性: diff --git a/easytier-contrib/easytier-magisk/module.prop b/easytier-contrib/easytier-magisk/module.prop index c2289524..733ebc2f 100644 --- a/easytier-contrib/easytier-magisk/module.prop +++ b/easytier-contrib/easytier-magisk/module.prop @@ -1,6 +1,6 @@ id=easytier_magisk name=EasyTier_Magisk -version=v2.4.5 +version=v2.5.0 versionCode=1 author=EasyTier description=easytier magisk module @EasyTier(https://github.com/EasyTier/EasyTier) diff --git a/easytier-gui/package.json b/easytier-gui/package.json index e5e2cb01..b94e6e62 100644 --- a/easytier-gui/package.json +++ b/easytier-gui/package.json @@ -1,7 +1,7 @@ { "name": "easytier-gui", "type": "module", - "version": "2.4.5", + "version": "2.5.0", "private": true, "packageManager": "pnpm@9.12.1+sha512.e5a7e52a4183a02d5931057f7a0dbff9d5e9ce3161e33fa68ae392125b79282a8a8a470a51dfc8a0ed86221442eb2fb57019b0990ed24fab519bf0e1bc5ccfc4", "scripts": { diff --git a/easytier-gui/src-tauri/Cargo.toml b/easytier-gui/src-tauri/Cargo.toml index 4e731bbd..10a3ed6b 100644 --- a/easytier-gui/src-tauri/Cargo.toml +++ b/easytier-gui/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "easytier-gui" -version = "2.4.5" +version = "2.5.0" description = "EasyTier GUI" authors = ["you"] edition = "2021" diff --git a/easytier-gui/src-tauri/tauri.conf.json b/easytier-gui/src-tauri/tauri.conf.json index 0eeb6a5b..7b4a30ac 100644 --- a/easytier-gui/src-tauri/tauri.conf.json +++ b/easytier-gui/src-tauri/tauri.conf.json @@ -17,7 +17,7 @@ "createUpdaterArtifacts": false }, "productName": "easytier-gui", - "version": "2.4.5", + "version": "2.5.0", "identifier": "com.kkrainbow.easytier", "plugins": { "shell": { diff --git a/easytier-web/Cargo.toml b/easytier-web/Cargo.toml index 55f34bed..f12e8ed5 100644 --- a/easytier-web/Cargo.toml +++ b/easytier-web/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "easytier-web" -version = "2.4.5" +version = "2.5.0" edition = "2021" description = "Config server for easytier. easytier-core gets config from this and web frontend use it as restful api server." diff --git a/easytier/Cargo.toml b/easytier/Cargo.toml index a2c63a07..596ee360 100644 --- a/easytier/Cargo.toml +++ b/easytier/Cargo.toml @@ -3,7 +3,7 @@ name = "easytier" description = "A full meshed p2p VPN, connecting all your devices in one network with one command." homepage = "https://github.com/EasyTier/EasyTier" repository = "https://github.com/EasyTier/EasyTier" -version = "2.4.5" +version = "2.5.0" edition = "2021" authors = ["kkrainbow"] keywords = ["vpn", "p2p", "network", "easytier"] diff --git a/easytier/src/common/stun.rs b/easytier/src/common/stun.rs index 0f832048..4201fe13 100644 --- a/easytier/src/common/stun.rs +++ b/easytier/src/common/stun.rs @@ -432,7 +432,7 @@ impl StunNatTypeDetectResult { false } - fn is_pat(&self) -> bool { + fn is_no_pat(&self) -> bool { for resp in self.stun_resps.iter() { if resp.mapped_socket_addr.map(|x| x.port()) == Some(self.source_addr.port()) { return true; @@ -470,7 +470,7 @@ impl StunNatTypeDetectResult { if self.has_ip_changed_resp() { if self.is_open_internet() { NatType::OpenInternet - } else if self.is_pat() { + } else if self.is_no_pat() { NatType::NoPat } else { NatType::FullCone @@ -522,7 +522,7 @@ impl StunNatTypeDetectResult { } if self.is_cone() { - if self.is_pat() { + if self.is_no_pat() { NatType::NoPat } else { NatType::FullCone @@ -802,8 +802,6 @@ impl TcpStunClient { #[tracing::instrument(ret, level = Level::TRACE)] pub async fn bind_request(self) -> Result { - let mut tids = vec![]; - let mut stream = self.connect().await?; let local_addr = stream.local_addr()?; let stun_host = self.stun_server; @@ -814,14 +812,13 @@ impl TcpStunClient { let msg = encoder .encode_into_bytes(message.clone()) .with_context(|| "encode tcp stun message")?; - tids.push(tid); tokio::time::timeout(self.io_timeout, stream.write_all(msg.as_slice())).await??; let now = Instant::now(); let msg = Self::tcp_read_stun_message(&mut stream, self.io_timeout).await?; if msg.class() != MessageClass::SuccessResponse || msg.method() != BINDING - || !tids.contains(&tid_to_u32(&msg.transaction_id())) + || tid_to_u32(&msg.transaction_id()) != tid { return Err(Error::MessageDecodeError( "unexpected stun response".to_string(), diff --git a/easytier/src/connector/tcp_hole_punch.rs b/easytier/src/connector/tcp_hole_punch.rs index 13d140ad..e6373f9d 100644 --- a/easytier/src/connector/tcp_hole_punch.rs +++ b/easytier/src/connector/tcp_hole_punch.rs @@ -24,7 +24,6 @@ use crate::{ rpc_types::{self, controller::BaseController}, }, tunnel::{ - common::setup_sokcet2, tcp::{TcpTunnelConnector, TcpTunnelListener}, TunnelConnector as _, TunnelListener as _, }, @@ -73,36 +72,6 @@ async fn select_local_port(peer_mgr: &Arc, is_v6: bool) -> Result, - local_port: u16, - dst: SocketAddr, -) -> Result<(), Error> { - let bind_addr = bind_addr_for_port(local_port, dst.is_ipv6()); - tracing::debug!(?bind_addr, ?dst, "tcp hole punch send syn"); - let _g = peer_mgr.get_global_ctx().net_ns.guard(); - - let socket2_socket = socket2::Socket::new( - socket2::Domain::for_address(dst), - socket2::Type::STREAM, - Some(socket2::Protocol::TCP), - )?; - setup_sokcet2(&socket2_socket, &bind_addr)?; - let socket = tokio::net::TcpSocket::from_std_stream(socket2_socket.into()); - match tokio::time::timeout(Duration::from_millis(600), socket.connect(dst)).await { - Ok(Ok(_stream)) => { - tracing::trace!(?bind_addr, ?dst, "tcp hole punch syn connect succeeded"); - } - Ok(Err(e)) => { - tracing::trace!(?bind_addr, ?dst, ?e, "tcp hole punch syn connect failed"); - } - Err(e) => { - tracing::trace!(?bind_addr, ?dst, ?e, "tcp hole punch syn connect timeout"); - } - } - Ok(()) -} - // tcp support simultaneous connect, so initiator and server can both use connect. async fn try_connect_to_remote( peer_mgr: Arc, @@ -576,8 +545,13 @@ impl TcpHolePunchConnector { } pub async fn run(&mut self) -> Result<(), Error> { - if self.peer_mgr.get_global_ctx().get_flags().disable_p2p { - tracing::debug!("tcp hole punch disabled by disable_p2p"); + let flags = self.peer_mgr.get_global_ctx().get_flags(); + if flags.disable_p2p || flags.disable_tcp_hole_punching { + tracing::debug!( + "tcp hole punch disabled by disable_p2p(={}) or disable_tcp_hole_punching(={});", + flags.disable_p2p, + flags.disable_tcp_hole_punching + ); return Ok(()); } diff --git a/easytier/src/tunnel/fake_tcp/netfilter/pnet.rs b/easytier/src/tunnel/fake_tcp/netfilter/pnet.rs index c5ef0759..2e9d5c49 100644 --- a/easytier/src/tunnel/fake_tcp/netfilter/pnet.rs +++ b/easytier/src/tunnel/fake_tcp/netfilter/pnet.rs @@ -225,7 +225,12 @@ fn get_or_create_worker(interface_name: &str) -> io::Result let interface = interfaces .into_iter() .find(|iface| iface.name == interface_name) - .expect("Network interface not found"); + .ok_or_else(|| { + io::Error::new( + io::ErrorKind::NotFound, + format!("Network interface '{}' not found", interface_name), + ) + })?; let worker = InterfaceWorker::new(interface)?; INTERFACE_MANAGERS.insert(interface_name.to_string(), Arc::downgrade(&worker));