style: format code

This commit is contained in:
Sofia
2026-01-15 15:35:19 +08:00
committed by GitHub
parent 281595f79f
commit a5668dd94b

View File

@@ -28,7 +28,7 @@ ssh_tools() {
echo "-----------------------------------------------"
read -p "请输入对应数字 > " num
case "$num" in
""|0)
"" | 0)
break
;;
1)
@@ -77,10 +77,10 @@ ssh_tools() {
done
}
#工具与优化
# 工具与优化
tools() {
while true; do
#获取设置默认显示
# 获取设置默认显示
grep -qE "^\s*[^#].*otapredownload" /etc/crontabs/root >/dev/null 2>&1 && mi_update=禁用 || mi_update=启用
[ "$mi_mi_autoSSH" = "已配置" ] && mi_mi_autoSSH_type=32m已配置 || mi_mi_autoSSH_type=31m未配置
[ -f "$CRASHDIR"/tools/tun.ko ] && mi_tunfix=32mON || mi_tunfix=31mOFF
@@ -103,7 +103,7 @@ tools() {
echo "-----------------------------------------------"
read -p "请输入对应数字 > " num
case "$num" in
""|0)
"" | 0)
break
;;
1)
@@ -219,7 +219,7 @@ mi_autoSSH() {
sleep 1
}
#日志菜单
# 日志菜单
log_pusher() {
while true; do
[ -n "$push_TG" ] && stat_TG=32mON || stat_TG=33mOFF
@@ -249,7 +249,7 @@ log_pusher() {
echo "-----------------------------------------------"
read -p "请输入对应数字 > " num
case "$num" in
""|0)
"" | 0)
break
;;
1)
@@ -496,8 +496,8 @@ log_pusher() {
done
}
#测试菜单
testcommand(){
# 测试菜单
testcommand() {
echo "$crashcore" | grep -q 'singbox' && config_path=${JSONSDIR}/config.json || config_path=${YAMLSDIR}/config.yaml
echo "-----------------------------------------------"
echo -e "\033[30;47m这里是测试命令菜单\033[0m"
@@ -522,19 +522,19 @@ testcommand(){
;;
2)
echo "-----------------------------------------------"
netstat -ntulp |grep 53
netstat -ntulp | grep 53
echo "-----------------------------------------------"
echo -e "可以使用\033[44m netstat -ntulp |grep xxx \033[0m来查询任意(xxx)端口"
exit;
exit
;;
3)
echo "-----------------------------------------------"
openssl speed -multi 4 -evp aes-128-gcm
echo "-----------------------------------------------"
exit;
exit
;;
4)
if [ "$firewall_mod" = "nftables" ];then
if [ "$firewall_mod" = "nftables" ]; then
nft list table inet shellcrash | sed '/set cn_ip {/,/}/d;/set cn_ip6 {/,/}/d;/^[[:space:]]*}/d'
else
[ "$firewall_area" = 1 -o "$firewall_area" = 3 -o "$firewall_area" = 5 -o "$vm_redir" = "ON" ] && {
@@ -582,20 +582,26 @@ testcommand(){
echo "----------------本机防火墙---------------------"
iptables -L INPUT --line-numbers
fi
exit;
exit
;;
5)
echo "-----------------------------------------------"
sed -n '1,40p' ${config_path}
echo "-----------------------------------------------"
exit;
exit
;;
6)
echo "注意依赖curl(不支持wget),且测试结果不保证一定准确!"
delay=`curl -kx ${authentication}@127.0.0.1:$mix_port -o /dev/null -s -w '%{time_starttransfer}' 'https://google.tw' & { sleep 3 ; kill $! >/dev/null 2>&1 & }` > /dev/null 2>&1
delay=`echo |awk "{print $delay*1000}"` > /dev/null 2>&1
delay=$(
curl -kx ${authentication}@127.0.0.1:$mix_port -o /dev/null -s -w '%{time_starttransfer}' 'https://google.tw' &
{
sleep 3
kill $! >/dev/null 2>&1 &
}
) >/dev/null 2>&1
delay=$(echo | awk "{print $delay*1000}") >/dev/null 2>&1
echo "-----------------------------------------------"
if [ `echo ${#delay}` -gt 1 ];then
if [ $(echo ${#delay}) -gt 1 ]; then
echo -e "\033[32m连接成功响应时间为"$delay" ms\033[0m"
else
echo -e "\033[31m连接超时请重试或检查节点配置\033[0m"
@@ -608,7 +614,8 @@ testcommand(){
;;
esac
}
debug(){
debug() {
echo "$crashcore" | grep -q 'singbox' && config_tmp="$TMPDIR"/jsons || config_tmp="$TMPDIR"/config.yaml
echo "-----------------------------------------------"
echo -e "\033[36m注意Debug运行均会停止原本的内核服务\033[0m"
@@ -633,9 +640,12 @@ debug(){
1)
"$CRASHDIR"/start.sh stop
"$CRASHDIR"/start.sh bfstart
if echo "$crashcore" | grep -q 'singbox' ;then
if echo "$crashcore" | grep -q 'singbox'; then
"$TMPDIR"/CrashCore run -D "$BINDIR" -C "$TMPDIR"/jsons &
{ sleep 4 ; kill $! >/dev/null 2>&1 & }
{
sleep 4
kill $! >/dev/null 2>&1 &
}
wait
else
"$TMPDIR"/CrashCore -t -d "$BINDIR" -f "$TMPDIR"/config.yaml
@@ -684,4 +694,3 @@ debug(){
;;
esac
}