mirror of
https://github.com/EasyTier/EasyTier.git
synced 2025-09-26 20:51:17 +08:00
2
.github/workflows/docker.yml
vendored
2
.github/workflows/docker.yml
vendored
@@ -11,7 +11,7 @@ on:
|
||||
image_tag:
|
||||
description: 'Tag for this image build'
|
||||
type: string
|
||||
default: 'v2.3.0'
|
||||
default: 'v2.3.1'
|
||||
required: true
|
||||
mark_latest:
|
||||
description: 'Mark this image as latest'
|
||||
|
13
.github/workflows/release.yml
vendored
13
.github/workflows/release.yml
vendored
@@ -21,7 +21,7 @@ on:
|
||||
version:
|
||||
description: 'Version for this release'
|
||||
type: string
|
||||
default: 'v2.3.0'
|
||||
default: 'v2.3.1'
|
||||
required: true
|
||||
make_latest:
|
||||
description: 'Mark this release as latest'
|
||||
@@ -57,7 +57,7 @@ jobs:
|
||||
repo: EasyTier/EasyTier
|
||||
path: release_assets_nozip
|
||||
|
||||
- name: Download GUI Artifact
|
||||
- name: Download Mobile Artifact
|
||||
uses: dawidd6/action-download-artifact@v6
|
||||
with:
|
||||
github_token: ${{secrets.GITHUB_TOKEN}}
|
||||
@@ -78,7 +78,14 @@ jobs:
|
||||
ls -l -R ./
|
||||
chmod -R 755 .
|
||||
for x in `ls`; do
|
||||
zip ../zipped_assets/$x-${VERSION}.zip $x/*;
|
||||
if [ "$x" = "Easytier-Magisk" ]; then
|
||||
# for Easytier-Magisk, make sure files are in the root of the zip
|
||||
cd $x;
|
||||
zip -r ../../zipped_assets/$x-${VERSION}.zip .;
|
||||
cd ..;
|
||||
else
|
||||
zip -r ../zipped_assets/$x-${VERSION}.zip $x;
|
||||
fi
|
||||
done
|
||||
|
||||
- name: Release
|
||||
|
6
Cargo.lock
generated
6
Cargo.lock
generated
@@ -1918,7 +1918,7 @@ checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125"
|
||||
|
||||
[[package]]
|
||||
name = "easytier"
|
||||
version = "2.3.0"
|
||||
version = "2.3.1"
|
||||
dependencies = [
|
||||
"aes-gcm",
|
||||
"anyhow",
|
||||
@@ -2045,7 +2045,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "easytier-gui"
|
||||
version = "2.3.0"
|
||||
version = "2.3.1"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"chrono",
|
||||
@@ -2091,7 +2091,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "easytier-web"
|
||||
version = "2.3.0"
|
||||
version = "2.3.1"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
|
@@ -2,5 +2,5 @@
|
||||
magisk安装后重启
|
||||
|
||||
目录位置:/data/adb/modules/easytier_magisk
|
||||
配置文件位置://data/adb/modules/easytier_magisk/config/config.conf
|
||||
配置文件位置://data/adb/modules/easytier_magisk/config/config.toml
|
||||
修改config.conf即可,修改后配置文件后去magisk app重新开关模块即可生效
|
||||
|
@@ -1,16 +0,0 @@
|
||||
#!/data/adb/magisk/busybox sh
|
||||
MODDIR=${0%/*}
|
||||
echo 'Easytier 服务停止中....'
|
||||
|
||||
PIDS=$(pgrep -f "^${MODDIR}/easytier-core -c ${MODDIR}/config/config.conf")
|
||||
|
||||
if [ -n "$PIDS" ]; then
|
||||
kill $PIDS # 杀死所有匹配的进程
|
||||
echo "已停止所有 Easytier 进程 (PIDs: $PIDS)"
|
||||
else
|
||||
echo "Easytier 服务未运行"
|
||||
fi
|
||||
echo '重启服务中...'
|
||||
nohup sh ${MODDIR}/service.sh >> ${MODDIR}/log/start.log 2>&1 &
|
||||
echo '服务已重启'
|
||||
exit
|
@@ -2,6 +2,6 @@ ui_print '安装完成'
|
||||
ui_print '当前架构为' + $ARCH
|
||||
ui_print '当前系统版本为' + $API
|
||||
ui_print '安装目录为: /data/adb/modules/easytier_magisk'
|
||||
ui_print '配置文件位置: /data/adb/modules/easytier_magisk/config/config.conf'
|
||||
ui_print '配置文件位置: /data/adb/modules/easytier_magisk/config/config.toml'
|
||||
ui_print '修改后配置文件后在magisk app点击操作按钮即可生效'
|
||||
ui_print '记得重启'
|
48
easytier-contrib/easytier-magisk/easytier_core.sh
Normal file
48
easytier-contrib/easytier-magisk/easytier_core.sh
Normal file
@@ -0,0 +1,48 @@
|
||||
#!/system/bin/sh
|
||||
|
||||
MODDIR=${0%/*}
|
||||
CONFIG_FILE="${MODDIR}/config/config.toml"
|
||||
LOG_FILE="${MODDIR}/log.log"
|
||||
MODULE_PROP="${MODDIR}/module.prop"
|
||||
EASYTIER="${MODDIR}/easytier-core"
|
||||
|
||||
# 更新module.prop文件中的description
|
||||
update_module_description() {
|
||||
local status_message=$1
|
||||
sed -i "/^description=/c\description=[状态]${status_message}" ${MODULE_PROP}
|
||||
}
|
||||
|
||||
if [ ! -e /dev/net/tun ]; then
|
||||
if [ ! -d /dev/net ]; then
|
||||
mkdir -p /dev/net
|
||||
fi
|
||||
|
||||
ln -s /dev/tun /dev/net/tun
|
||||
fi
|
||||
|
||||
while true; do
|
||||
if ls $MODDIR | grep -q "disable"; then
|
||||
update_module_description "关闭中"
|
||||
if pgrep -f 'easytier-core' >/dev/null; then
|
||||
echo "开关控制$(date "+%Y-%m-%d %H:%M:%S") 进程已存在,正在关闭 ..."
|
||||
pkill easytier-core # 关闭进程
|
||||
fi
|
||||
else
|
||||
if ! pgrep -f 'easytier-core' >/dev/null; then
|
||||
if [ ! -f "$CONFIG_FILE" ]; then
|
||||
update_module_description "config.toml不存在"
|
||||
sleep 3s
|
||||
continue
|
||||
fi
|
||||
|
||||
TZ=Asia/Shanghai ${EASYTIER} -c ${CONFIG_FILE} > ${LOG_FILE} &
|
||||
sleep 5s # 等待easytier-core启动完成
|
||||
update_module_description "已开启(不一定运行成功)"
|
||||
ip rule add from all lookup main
|
||||
else
|
||||
echo "开关控制$(date "+%Y-%m-%d %H:%M:%S") 进程已存在"
|
||||
fi
|
||||
fi
|
||||
|
||||
sleep 3s # 暂停3秒后再次执行循环
|
||||
done
|
14
easytier-contrib/easytier-magisk/kill.sh
Normal file
14
easytier-contrib/easytier-magisk/kill.sh
Normal file
@@ -0,0 +1,14 @@
|
||||
#!/data/adb/magisk/busybox sh
|
||||
MODDIR=${0%/*}
|
||||
|
||||
# 查找 easytier-core 进程的 PID
|
||||
PID=$(pgrep easytier-core)
|
||||
|
||||
# 检查是否找到了进程
|
||||
if [ -z "$PID" ]; then
|
||||
echo "easytier-core 进程未找到"
|
||||
else
|
||||
# 结束进程
|
||||
kill $PID
|
||||
echo "已结束 easytier-core 进程 (PID: $PID)"
|
||||
fi
|
@@ -1,7 +1,7 @@
|
||||
id=easytier_magisk
|
||||
name=easytier_magisk版
|
||||
version=v2.2.4
|
||||
name=EasyTier_Magisk
|
||||
version=v2.3.1
|
||||
versionCode=1
|
||||
author=EasyTier
|
||||
description=easytier_magisk版模块 作者:EasyTier https://github.com/EasyTier/EasyTier
|
||||
description=easytier magisk module @EasyTier(https://github.com/EasyTier/EasyTier)
|
||||
updateJson=https://raw.githubusercontent.com/EasyTier/EasyTier/refs/heads/main/easytier-contrib/easytier-magisk/magisk_update.json
|
||||
|
@@ -1,20 +1,27 @@
|
||||
#!/data/adb/magisk/busybox sh
|
||||
MODDIR=${0%/*}
|
||||
# MODDIR="$(dirname $(readlink -f "$0"))"
|
||||
mkdir -p ${MODDIR}/log
|
||||
chmod 755 ${MODDIR}/*
|
||||
|
||||
echo $MODDIR >> ${MODDIR}/log/start.log
|
||||
# 等待系统启动成功
|
||||
while [ "$(getprop sys.boot_completed)" != "1" ]; do
|
||||
sleep 5s
|
||||
done
|
||||
|
||||
echo "Easytier 服务启动" >> ${MODDIR}/log/start.log
|
||||
# 防止系统挂起
|
||||
echo "PowerManagerService.noSuspend" > /sys/power/wake_lock
|
||||
|
||||
# 启动
|
||||
nohup ${MODDIR}/easytier-core -c ${MODDIR}/config/config.conf >> ${MODDIR}/log/start.log 2>&1 &
|
||||
# 修改模块描述
|
||||
sed -i 's/$(description=)$[^"]*/\1[状态]关闭中/' "$MODDIR/module.prop"
|
||||
|
||||
# 等待 3 秒
|
||||
sleep 3s
|
||||
|
||||
"${MODDIR}/easytier_core.sh" &
|
||||
|
||||
# 检查是否启用模块
|
||||
while [ ! -f ${MODDIR}/disable ]; do
|
||||
sleep 2
|
||||
done
|
||||
PID=$(ps -ef|grep "${MODDIR}/easytier-core -c ${MODDIR}/config/config.conf" | awk '{print $2}')
|
||||
kill $PID
|
||||
echo "Easytier 服务停止" >> ${MODDIR}/log/start.log
|
||||
|
||||
pkill easytier-core
|
||||
|
2
easytier-contrib/easytier-magisk/system/etc/resolv.conf
Normal file
2
easytier-contrib/easytier-magisk/system/etc/resolv.conf
Normal file
@@ -0,0 +1,2 @@
|
||||
nameserver 114.114.114.114
|
||||
nameserver 223.5.5.5
|
@@ -1,2 +1,3 @@
|
||||
MODDIR=${0%/*}
|
||||
pkill easytier-core # 结束 easytier-core 进程
|
||||
rm -rf $MODDIR/*
|
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "easytier-gui",
|
||||
"type": "module",
|
||||
"version": "2.2.4",
|
||||
"version": "2.3.1",
|
||||
"private": true,
|
||||
"packageManager": "pnpm@9.12.1+sha512.e5a7e52a4183a02d5931057f7a0dbff9d5e9ce3161e33fa68ae392125b79282a8a8a470a51dfc8a0ed86221442eb2fb57019b0990ed24fab519bf0e1bc5ccfc4",
|
||||
"scripts": {
|
||||
|
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "easytier-gui"
|
||||
version = "2.3.0"
|
||||
version = "2.3.1"
|
||||
description = "EasyTier GUI"
|
||||
authors = ["you"]
|
||||
edition = "2021"
|
||||
|
@@ -17,7 +17,7 @@
|
||||
"createUpdaterArtifacts": false
|
||||
},
|
||||
"productName": "easytier-gui",
|
||||
"version": "2.3.0",
|
||||
"version": "2.3.1",
|
||||
"identifier": "com.kkrainbow.easytier",
|
||||
"plugins": {},
|
||||
"app": {
|
||||
|
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "easytier-web"
|
||||
version = "2.3.0"
|
||||
version = "2.3.1"
|
||||
edition = "2021"
|
||||
description = "Config server for easytier. easytier-core gets config from this and web frontend use it as restful api server."
|
||||
|
||||
|
@@ -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.3.0"
|
||||
version = "2.3.1"
|
||||
edition = "2021"
|
||||
authors = ["kkrainbow"]
|
||||
keywords = ["vpn", "p2p", "network", "easytier"]
|
||||
|
@@ -109,6 +109,9 @@ pub fn get_machine_id() -> uuid::Uuid {
|
||||
))]
|
||||
let gen_mid = machine_uid::get()
|
||||
.map(|x| {
|
||||
if x.is_empty() {
|
||||
return uuid::Uuid::new_v4();
|
||||
}
|
||||
let mut b = [0u8; 16];
|
||||
crate::tunnel::generate_digest_from_str("", x.as_str(), &mut b);
|
||||
uuid::Uuid::from_bytes(b)
|
||||
|
@@ -55,7 +55,7 @@ impl std::fmt::Debug for PingIntervalController {
|
||||
|
||||
impl PingIntervalController {
|
||||
fn new(throughput: Arc<Throughput>, loss_counter: Arc<AtomicU32>) -> Self {
|
||||
let last_throughput = *throughput;
|
||||
let last_throughput = (*throughput).clone();
|
||||
|
||||
Self {
|
||||
throughput,
|
||||
@@ -92,7 +92,7 @@ impl PingIntervalController {
|
||||
self.backoff_idx = 0;
|
||||
}
|
||||
|
||||
self.last_throughput = *self.throughput;
|
||||
self.last_throughput = (*self.throughput).clone();
|
||||
|
||||
if (self.logic_time - self.last_send_logic_time) < (1 << self.backoff_idx) {
|
||||
return false;
|
||||
|
@@ -1,4 +1,7 @@
|
||||
use std::sync::atomic::{AtomicU32, Ordering::Relaxed};
|
||||
use std::{
|
||||
cell::UnsafeCell,
|
||||
sync::atomic::{AtomicU32, Ordering::Relaxed},
|
||||
};
|
||||
|
||||
pub struct WindowLatency {
|
||||
latency_us_window: Vec<AtomicU32>,
|
||||
@@ -58,13 +61,38 @@ impl WindowLatency {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default, Copy, Clone, Debug)]
|
||||
#[derive(Debug)]
|
||||
pub struct Throughput {
|
||||
tx_bytes: u64,
|
||||
rx_bytes: u64,
|
||||
tx_bytes: UnsafeCell<u64>,
|
||||
rx_bytes: UnsafeCell<u64>,
|
||||
tx_packets: UnsafeCell<u64>,
|
||||
rx_packets: UnsafeCell<u64>,
|
||||
}
|
||||
|
||||
tx_packets: u64,
|
||||
rx_packets: u64,
|
||||
impl Clone for Throughput {
|
||||
fn clone(&self) -> Self {
|
||||
Self {
|
||||
tx_bytes: UnsafeCell::new(unsafe { *self.tx_bytes.get() }),
|
||||
rx_bytes: UnsafeCell::new(unsafe { *self.rx_bytes.get() }),
|
||||
tx_packets: UnsafeCell::new(unsafe { *self.tx_packets.get() }),
|
||||
rx_packets: UnsafeCell::new(unsafe { *self.rx_packets.get() }),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// add sync::Send and sync::Sync traits to Throughput
|
||||
unsafe impl Send for Throughput {}
|
||||
unsafe impl Sync for Throughput {}
|
||||
|
||||
impl Default for Throughput {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
tx_bytes: UnsafeCell::new(0),
|
||||
rx_bytes: UnsafeCell::new(0),
|
||||
tx_packets: UnsafeCell::new(0),
|
||||
rx_packets: UnsafeCell::new(0),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Throughput {
|
||||
@@ -73,34 +101,32 @@ impl Throughput {
|
||||
}
|
||||
|
||||
pub fn tx_bytes(&self) -> u64 {
|
||||
self.tx_bytes
|
||||
unsafe { *self.tx_bytes.get() }
|
||||
}
|
||||
|
||||
pub fn rx_bytes(&self) -> u64 {
|
||||
self.rx_bytes
|
||||
unsafe { *self.rx_bytes.get() }
|
||||
}
|
||||
|
||||
pub fn tx_packets(&self) -> u64 {
|
||||
self.tx_packets
|
||||
unsafe { *self.tx_packets.get() }
|
||||
}
|
||||
|
||||
pub fn rx_packets(&self) -> u64 {
|
||||
self.rx_packets
|
||||
unsafe { *self.rx_packets.get() }
|
||||
}
|
||||
|
||||
pub fn record_tx_bytes(&self, bytes: u64) {
|
||||
#[allow(invalid_reference_casting)]
|
||||
unsafe {
|
||||
*(&self.tx_bytes as *const u64 as *mut u64) += bytes;
|
||||
*(&self.tx_packets as *const u64 as *mut u64) += 1;
|
||||
*self.tx_bytes.get() += bytes;
|
||||
*self.tx_packets.get() += 1;
|
||||
}
|
||||
}
|
||||
|
||||
pub fn record_rx_bytes(&self, bytes: u64) {
|
||||
#[allow(invalid_reference_casting)]
|
||||
unsafe {
|
||||
*(&self.rx_bytes as *const u64 as *mut u64) += bytes;
|
||||
*(&self.rx_packets as *const u64 as *mut u64) += 1;
|
||||
*self.rx_bytes.get() += bytes;
|
||||
*self.rx_packets.get() += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user