-
Notifications
You must be signed in to change notification settings - Fork 142
/
Copy pathgo.sh
52 lines (46 loc) · 1.28 KB
/
go.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/sh
# 检测系统架构
ARCH=$(uname -m)
CFNAT_BINARY='./cfnat'
colo_upper=$(echo "$colo" | tr '[:lower:]' '[:upper:]')
# 记录启动信息
{
echo "系统架构: $ARCH"
echo "使用二进制文件: $CFNAT_BINARY"
echo "IP类型(ips): $ips"
echo "TLS: $tls"
echo "随机IP(random): $random"
echo "数据中心(colo): $colo_upper"
echo "有效延迟(delay): $delay"
echo "转发端口(port): $port"
echo "有效IP数(ipnum): $ipnum"
echo "负载IP数(num): $num"
echo "最大并发请求数(task): $task"
echo "响应状态码(code): $code"
echo "检查域名(domain): $domain"
} >> cfnat.log
while true
do
# 记录每次启动时间
echo "$(date '+%Y-%m-%d %H:%M:%S') - cfnat 启动 ..." >> cfnat.log
# 运行主程序 - 使用检测到的正确二进制文件
$CFNAT_BINARY \
-colo="$colo_upper" \
-port="$port" \
-delay="$delay" \
-ips="$ips" \
-addr="0.0.0.0:1234" \
-ipnum="$ipnum" \
-num="$num" \
-random="$random" \
-task="$task" \
-tls="$tls" \
-code="$code" \
-domain="$domain"
# 检查执行是否成功
if [ $? -ne 0 ]; then
echo "$(date '+%Y-%m-%d %H:%M:%S') - cfnat 崩溃,5 秒后重启..." >> cfnat.log
fi
# 等待 5 秒后重启
sleep 5
done